Skip to main content

InputReaderCommand

Enum InputReaderCommand 

Source
pub enum InputReaderCommand {
    Replay {
        metadata: Value,
        data: Value,
    },
    Extend,
    Pause,
    Queue {
        checkpoint_requested: bool,
    },
    Disconnect,
}
Expand description

Commands for an InputReader to execute.

§Transitions

The following diagram shows the possible order in which the controller can issue commands to InputReaders:

  ┌─⯇─ (start) ─⯈──┐
  │      │         │
  │      │  ┌───┐  │
  │      ▼  ▼   │  │
  ├─⯇─ Replay ──┘  │
  │      │         │
  │      ▼         │
  ├─⯇─ Extend⯇─────┤
  │      │         │
  │      │ ┌───┐   │
  │      ▼ ▼   │   │
  ├─⯇─ Queue ──┘   │
  │      │         │
  │      ▼         │
  ├─⯇─ Pause ─⯈────┘
  │      │
  │      ▼
  └───⯈Disconnect
         │
         ▼
       (end)

§Stalls

When the controller issues a InputReaderCommand::Replay or InputReaderCommand::Queue command to an input adapter, it waits for the input adapter to respond to them. Until it receives a reply, the next step cannot proceed. An input adapter that does not respond to one of these commands will stall the entire pipeline. However, the controller also uses InputReader::is_closed to detect that an input adapter has died due to an error or reaching end-of-input, so input adapters for which it is difficult to handle errors gracefully can report that they have died using is_closed, if necessary, as described in more detail below.

§End-of-input handling

If an input adapter reaches the end of its input, and it isn’t implemented to wait for and pass along further input, then it should:

  • Make sure that it has already indicated that it has buffered all of its data, via InputConsumer::buffered.

  • Call InputConsumer::eoi to indicate that it has reached end of input.

  • Respond to InputReaderCommand::Queue until it has queued all of its input and has none left.

  • Optionally, at this point, it may exit and start returning true from InputReader::is_closed.

§Error handling

If an input adapter encounters a fatal error that keeps it from continuing to obtain input, then it should report the error via InputConsumer::error with true for fatal. Afterward, it may exit and start returning true from InputReader::is_closed.

§Additional requirement

An input adapter should ensure that, if it flushes any records to the circuit in response to InputReaderCommand::Replay or InputReaderCommand::Queue, then it finishes up and responds to the consumer using InputConsumer::replayed or InputConsumer::extended, respectively. If it instead dies mid-way, then the controller will not record the step properly and fault tolerance replay will be incorrect.

Variants§

§

Replay

Tells the input reader to replay the step described by metadata and data by reading and flushing buffers for the data in the step, and then InputConsumer::replayed to signal completion.

The input reader should report the data that it queues to InputConsumer::buffered as it does the replay.

The input reader doesn’t have to process other commands while it does the replay.

§Constraints

Only fault-tolerant input readers need to accept this. It will be issued zero or more times, before any other command.

Fields

§metadata: Value
§data: Value
§

Extend

Tells the input reader to accept further input. The first time it receives this command, the reader should start from the resume point passed as resume_info when the endpoint was opened, if any, and otherwise from the beginning of input.

The input reader should report the data that it queues to InputConsumer::buffered as it queues it.

§Constraints

The controller will not call this function:

§

Pause

Tells the input reader to stop reading more input.

The controller uses this to limit the number of buffered records and to respond to user requests to pause the pipeline.

§Constraints

The controller issues this only after a paired InputReaderCommand::Extend.

§

Queue

Tells the input reader to flush input buffers to the circuit.

The input reader can call InputConsumer::max_batch_size to find out how many records it should flush. When it’s done, it must call InputConsumer::extended to report it.

The checkpoint_requested flag indicates that the controller is trying to checkpoint or suspend the pipeline. This serves as a hint to the reader to try to clear the checkpoint barrier by returning Resume::Seek or Resume::Replay if possible. For instance, if the reader has multiple buffers queued, it can choose to stop flushing them after reaching the first buffer that corresponds to a seekable position in the input stream.

§Constraints

The controller won’t issue this command before it first issues InputReaderCommand::Extend.

Fields

§checkpoint_requested: bool
§

Disconnect

Tells the reader it’s going to be dropped soon and should clean up.

The reader can continue to queue some data buffers afterward if that’s the easiest implementation.

§Constraints

The controller calls this only once and won’t call any other functions for a given reader after it calls this one.

Implementations§

Source§

impl InputReaderCommand

Source

pub fn as_nonft(&self) -> Option<NonFtInputReaderCommand>

Returns this command translated to a NonFtInputReaderCommand, or None if that is not possible (because this command is only for fault-tolerant endpoints).

Trait Implementations§

Source§

impl Debug for InputReaderCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool