Skip to main content

MultiResourceWriter

Struct MultiResourceWriter 

Source
pub struct MultiResourceWriter<O, Opener: MultiResourceWriterOpener<O>, P> { /* private fields */ }
Expand description

Writes a logical output partitioned across an ordered set of physical resources.

§Contract

  • Input/output: O, same as every delegate the opener produces.
  • State/checkpoint: ResourceSetRevision plus the current output resource’s ordinal and embedded delegate position, through the paired MultiResourceWriterStream, following the same nested-envelope scheme as MultiResourceReader.
  • Ordering: resources are filled in ResourceSet’s declared order; one write batch never spans two resources.
  • Restartability: supplied explicitly at construction, same as multi_resource_reader.
  • Thread safety: Send + Sync; one async-aware lock guards the active-or-poisoned state, the rollover decision, and the write together as one atomic critical section (this crate’s chunk runtime never actually calls write concurrently on one writer instance; the lock exists so this type’s own invariants hold regardless). The active resource and the poison flag deliberately share this single lock rather than living behind two separate ones: two locks would let a concurrent write read “not yet poisoned” before a poisoning transition commits and then roll over into a resource this writer is supposed to have permanently stopped using.
  • Transaction/delivery: never claims a stronger mode than the current delegate writer supports; a rollover happens between writer calls, never inside one enlisted call.
  • Failure semantics: a failure while writing to resource N does not roll over to resource N+1 – the same delegate is retried at the same resource on the framework’s own retry contract, exactly like an undecorated writer.
  • Close: rollover closes the outgoing resource’s delegate stream (with crate::StreamRuntimeOutcome::ResourceBoundary, never Committed – the enclosing step attempt has not reached a terminal outcome yet) before opening the next one, never leaving two resources’ delegates open at once; the paired MultiResourceWriterStream::close closes whichever resource is still active at the step attempt’s own terminal outcome, and never re-closes a resource already closed by a rollover.
  • Support tier: first-party.

Trait Implementations§

Source§

impl<O, Opener, P> ItemWriter<O> for MultiResourceWriter<O, Opener, P>
where O: Sync + 'static, Opener: MultiResourceWriterOpener<O> + 'static, P: RolloverPolicy + 'static,

Source§

async fn write<'a>( &'a self, items: &'a [O], context: WriteContext<'a>, ) -> Result<WriteOutcome, WriterError>

Writes one borrowed, nonempty batch. Read more

Auto Trait Implementations§

§

impl<O, Opener, P> !RefUnwindSafe for MultiResourceWriter<O, Opener, P>

§

impl<O, Opener, P> !UnwindSafe for MultiResourceWriter<O, Opener, P>

§

impl<O, Opener, P> Freeze for MultiResourceWriter<O, Opener, P>
where Arc<WriterShared<O, Opener, P>>: Freeze,

§

impl<O, Opener, P> Send for MultiResourceWriter<O, Opener, P>
where Arc<WriterShared<O, Opener, P>>: Send,

§

impl<O, Opener, P> Sync for MultiResourceWriter<O, Opener, P>
where Arc<WriterShared<O, Opener, P>>: Sync,

§

impl<O, Opener, P> Unpin for MultiResourceWriter<O, Opener, P>
where Arc<WriterShared<O, Opener, P>>: Unpin,

§

impl<O, Opener, P> UnsafeUnpin for MultiResourceWriter<O, Opener, P>
where Arc<WriterShared<O, Opener, P>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more