pub struct ObjectAccumulator { /* private fields */ }Expand description
Accumulates encoded rows for one open object, and says when to roll.
The sink pushes each page’s rows in, takes whatever completed objects come
back, and calls finish at flush time for the partial
remainder.
Implementations§
Source§impl ObjectAccumulator
impl ObjectAccumulator
Sourcepub fn new(max_rows: Option<usize>, max_bytes: Option<usize>) -> Self
pub fn new(max_rows: Option<usize>, max_bytes: Option<usize>) -> Self
Build an accumulator. max_rows/max_bytes of None or 0 mean “no
limit on this axis”; with neither set, nothing ever rolls and the whole
run lands in one object at finish.
Sourcepub fn with_part_size(self, bytes: usize) -> Self
pub fn with_part_size(self, bytes: usize) -> Self
Emit Emit::Parts once the unflushed tail reaches bytes, so the
sink can stream them into a multipart upload and free the memory.
Without this, an object with a large (or absent) byte cap is held whole
in RAM before its single-shot upload — which is what caps output size
by available memory. 0 disables parting.
Sourcepub fn parted_bytes(&self) -> usize
pub fn parted_bytes(&self) -> usize
Bytes of the open object already uploaded as parts.
Sourcepub fn has_parts(&self) -> bool
pub fn has_parts(&self) -> bool
Whether any part of the open object has already been uploaded — the sink needs this to know whether to complete a multipart upload or do a single-shot put.
Sourcepub fn push_encoded(&mut self, encoded: &[u8]) -> Emit
pub fn push_encoded(&mut self, encoded: &[u8]) -> Emit
Append one encoded record (caller-encoded, so the accumulator stays format-agnostic) and return any object this completed.
The threshold is checked after appending, so a single record larger
than max_bytes still lands in its own object rather than being
refused or split — splitting would corrupt it, and refusing would drop
data the source really produced.
Sourcepub fn push_record(&mut self, record: &Value) -> Result<Emit, FaucetError>
pub fn push_record(&mut self, record: &Value) -> Result<Emit, FaucetError>
Append one JSON record as an NDJSON line.
Sourcepub fn finish(&mut self) -> Option<CompletedObject>
pub fn finish(&mut self) -> Option<CompletedObject>
Close the open object, if any. Called at flush, and on drop-time
finalisation — an object left unfinished is data loss, so a sink must
never skip it.
Returns Some whenever the object holds rows, including when the
unflushed tail is empty but parts were already uploaded: a multipart
upload still has to be completed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObjectAccumulator
impl RefUnwindSafe for ObjectAccumulator
impl Send for ObjectAccumulator
impl Sync for ObjectAccumulator
impl Unpin for ObjectAccumulator
impl UnsafeUnpin for ObjectAccumulator
impl UnwindSafe for ObjectAccumulator
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<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