vector/sinks/aws_s_s/
retry.rs

1use std::marker::PhantomData;
2
3use aws_smithy_runtime_api::client::{orchestrator::HttpResponse, result::SdkError};
4
5use super::{request_builder::SendMessageEntry, service::SendMessageResponse};
6use crate::{aws::is_retriable_error, sinks::util::retries::RetryLogic};
7
8#[derive(Debug)]
9pub(super) struct SSRetryLogic<E> {
10    _phantom: PhantomData<fn() -> E>,
11}
12
13impl<E> SSRetryLogic<E>
14where
15    E: std::fmt::Debug + std::fmt::Display + std::error::Error + Sync + Send + 'static,
16{
17    pub(super) fn new() -> SSRetryLogic<E> {
18        Self {
19            _phantom: PhantomData,
20        }
21    }
22}
23
24impl<E> RetryLogic for SSRetryLogic<E>
25where
26    E: std::fmt::Debug + std::fmt::Display + std::error::Error + Sync + Send + 'static,
27{
28    type Error = SdkError<E, HttpResponse>;
29    type Request = SendMessageEntry;
30    type Response = SendMessageResponse;
31
32    fn is_retriable_error(&self, error: &Self::Error) -> bool {
33        is_retriable_error(error)
34    }
35}
36
37impl<E> Clone for SSRetryLogic<E>
38where
39    E: std::fmt::Debug + std::fmt::Display + std::error::Error + Sync + Send + 'static,
40{
41    fn clone(&self) -> SSRetryLogic<E> {
42        SSRetryLogic {
43            _phantom: PhantomData,
44        }
45    }
46}