pub struct S3StreamingUploader {
client: Client,
part_size: usize,
bucket: String,
key: String,
upload_id: Option<String>,
next_part_id: i32,
join_handles: Vec<JoinHandle<ObjectResult<(i32, UploadPartOutput)>>>,
buf: Vec<Bytes>,
not_uploaded_len: usize,
metrics: Arc<ObjectStoreMetrics>,
config: Arc<ObjectStoreConfig>,
}Expand description
S3 multipart upload handle. The multipart upload is not initiated until the first part is available for upload.
Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
Fields§
§client: Client§part_size: usize§bucket: String§key: StringThe key of the object.
upload_id: Option<String>The identifier of multipart upload task for S3.
next_part_id: i32Next part ID.
join_handles: Vec<JoinHandle<ObjectResult<(i32, UploadPartOutput)>>>Join handles for part uploads.
buf: Vec<Bytes>Buffer for data. It will store at least part_size bytes of data before wrapping itself
into a stream and upload to object store as a part.
not_uploaded_len: usizeLength of the data that have not been uploaded to S3.
metrics: Arc<ObjectStoreMetrics>To record metrics for uploading part.
config: Arc<ObjectStoreConfig>Implementations§
Source§impl S3StreamingUploader
impl S3StreamingUploader
const MEDIA_TYPE: &'static str = "s3"
pub fn new( client: Client, bucket: String, key: String, metrics: Arc<ObjectStoreMetrics>, config: Arc<ObjectStoreConfig>, ) -> S3StreamingUploader
async fn upload_next_part(&mut self) -> ObjectResult<()>
async fn flush_multipart_and_complete(&mut self) -> ObjectResult<()>
async fn abort_multipart_upload(&self) -> ObjectResult<()>
Trait Implementations§
Source§impl StreamingUploader for S3StreamingUploader
impl StreamingUploader for S3StreamingUploader
Source§async fn finish(self) -> ObjectResult<()>
async fn finish(self) -> ObjectResult<()>
If the multipart upload has not been initiated, we can use PutObject instead to save the
CreateMultipartUpload and CompleteMultipartUpload requests. Otherwise flush the
remaining data of the buffer to S3 as a new part.
async fn write_bytes(&mut self, data: Bytes) -> ObjectResult<()>
fn get_memory_usage(&self) -> u64
Auto Trait Implementations§
impl Freeze for S3StreamingUploader
impl !RefUnwindSafe for S3StreamingUploader
impl Send for S3StreamingUploader
impl Sync for S3StreamingUploader
impl Unpin for S3StreamingUploader
impl !UnwindSafe for S3StreamingUploader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
Source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level.Source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n.Source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n with metric_level set to
MetricLevel::Debug and relabel_num set to 1.