1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use std::marker::PhantomData;

use aws_smithy_runtime_api::client::{orchestrator::HttpResponse, result::SdkError};

use super::service::SendMessageResponse;
use crate::{aws::is_retriable_error, sinks::util::retries::RetryLogic};

#[derive(Debug)]
pub(super) struct SSRetryLogic<E> {
    _phantom: PhantomData<fn() -> E>,
}

impl<E> SSRetryLogic<E>
where
    E: std::fmt::Debug + std::fmt::Display + std::error::Error + Sync + Send + 'static,
{
    pub(super) fn new() -> SSRetryLogic<E> {
        Self {
            _phantom: PhantomData,
        }
    }
}

impl<E> RetryLogic for SSRetryLogic<E>
where
    E: std::fmt::Debug + std::fmt::Display + std::error::Error + Sync + Send + 'static,
{
    type Error = SdkError<E, HttpResponse>;
    type Response = SendMessageResponse;

    fn is_retriable_error(&self, error: &Self::Error) -> bool {
        is_retriable_error(error)
    }
}

impl<E> Clone for SSRetryLogic<E>
where
    E: std::fmt::Debug + std::fmt::Display + std::error::Error + Sync + Send + 'static,
{
    fn clone(&self) -> SSRetryLogic<E> {
        SSRetryLogic {
            _phantom: PhantomData,
        }
    }
}