SiftStream

Struct SiftStream 

Source
pub struct SiftStream<E, T = LiveStreaming> { /* private fields */ }
Expand description

SiftStream is a smart wrapper over an actual gRPC stream that makes it robust and more ergonomic to work with. Some additional behaviors that SiftStream supports are:

  • Checkpointing
  • Retries (disabled by default)
  • Backups (disabled by default)
  • Tracing and ingestion metrics

To initialize a SiftStream users will use builder::SiftStreamBuilder. Refer to the crate-level documentation for further details and examples.

Implementations§

Source§

impl<E, T> SiftStream<E, T>
where E: Encoder + MetricsSnapshot, T: Transport<Encoder = E>,

Source

pub fn get_metrics_snapshot(&self) -> SiftStreamMetricsSnapshot

Available on crate feature metrics-unstable only.

Retrieve a snapshot of the current metrics for this stream.

Source

pub async fn attach_run(&mut self, run_selector: RunSelector) -> Result<()>

Attach a run to the stream. Any data provided through SiftStream::send after return of this function will be associated with the run.

Source

pub fn detach_run(&mut self)

Detach the run, if any, associated with the stream. Any data provided through SiftStream::send after this function is called will not be associated with a run.

Source

pub fn run(&self) -> Option<&Run>

Retrieves the attached run if it exists.

Source

pub async fn send<M>(&mut self, message: M) -> Result<()>
where M: Encodeable<Encoder = E, Output = <T as Transport>::Message> + Send + Sync,

The entry-point to send actual telemetry to Sift in the form of [Flow]s.

Source

pub async fn send_requests<I>(&mut self, requests: I) -> Result<()>
where I: IntoIterator<Item = <T as Transport>::Message> + Send, I::IntoIter: Send,

This method offers a way to send data in a manner that’s identical to the raw gRPC service for ingestion-config based streaming.

Source

pub fn send_requests_nonblocking<I>(&mut self, requests: I) -> Result<()>
where I: IntoIterator<Item = <T as Transport>::Message> + Send, I::IntoIter: Send,

This method offers a way to send data in a manner that’s identical to the raw gRPC service for ingestion-config based streaming.

Source

pub async fn finish(self) -> Result<()>

Gracefully finish the stream, draining any remaining data before returning.

It is important to always call this method when you are done sending data and before the object is dropped.

Trait Implementations§

Source§

impl<E, T> Deref for SiftStream<E, T>
where E: Encoder + MetricsSnapshot, T: Transport<Encoder = E>,

Source§

type Target = E

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<E, T> DerefMut for SiftStream<E, T>
where E: Encoder + MetricsSnapshot, T: Transport<Encoder = E>,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<E, T> Freeze for SiftStream<E, T>
where E: Freeze, T: Freeze,

§

impl<E, T = LiveStreaming> !RefUnwindSafe for SiftStream<E, T>

§

impl<E, T> Send for SiftStream<E, T>
where E: Send, T: Send,

§

impl<E, T> Sync for SiftStream<E, T>
where E: Sync, T: Sync,

§

impl<E, T> Unpin for SiftStream<E, T>
where E: Unpin, T: Unpin,

§

impl<E, T = LiveStreaming> !UnwindSafe for SiftStream<E, T>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

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
§

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

§

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

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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