vector/sinks/aws_kinesis/
record.rs

1use std::future::Future;
2
3use aws_smithy_runtime_api::client::{orchestrator::HttpResponse, result::SdkError};
4use bytes::Bytes;
5
6use super::KinesisResponse;
7/// An AWS Kinesis record type primarily to store the underlying aws crates' actual record `T`, and
8/// to abstract the encoded length calculation.
9pub trait Record {
10    type T;
11
12    /// Create a new instance of this record.
13    fn new(payload_bytes: &Bytes, partition_key: &str) -> Self;
14
15    /// Returns the encoded length of the record.
16    fn encoded_length(&self) -> usize;
17
18    /// Moves the contained record to the caller.
19    fn get(self) -> Self::T;
20}
21
22/// Capable of sending records.
23pub trait SendRecord {
24    type T;
25    type E;
26
27    /// Sends the records.
28    fn send(
29        &self,
30        records: Vec<Self::T>,
31        stream_name: String,
32    ) -> impl Future<Output = Result<KinesisResponse, SdkError<Self::E, HttpResponse>>> + Send;
33}