pub struct FileStream { /* private fields */ }Expand description
A subscription descriptor for one stream key in the file.
A plain descriptor follows the live tail; where reading begins is the framework’s
start_at(..) clause with a FilePosition (or a live seek through
the SeekHandle context key). replay is the one
reading mode the position API cannot express: it reads the finished file and completes the
stream at its end instead of following live writes.
Implements SubscriptionSource, so it can sit inline in the #[subscriber(..)]
decorator, and IntoSource, so the manual path’s subscriber(..) constructor takes it
the way it takes a subject string. The
FileStream
page shows it in a service.
§Examples
A replay of a recorded file:
use ruststream_sea_file::file::prelude::*;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct Order {
id: u64,
}
#[subscriber(FileStream::new("orders").replay())]
async fn audit(order: &Order) -> HandlerOutcome {
tracing::info!(order.id, "audited");
HandlerOutcome::ack()
}
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("audit", "0.1.0"))
.with_broker(FileBroker::new("/var/lib/orders.ss").existing_only(), |b| {
b.include(audit);
})
}Implementations§
Source§impl FileStream
impl FileStream
Sourcepub fn replay(self) -> Self
pub fn replay(self) -> Self
Replays the retained file from the beginning instead of following live writes; the subscription completes at the end of the file.
Every message the file holds is delivered before the subscription completes. The end is
the end-of-stream mark a writer left with
end_with_eos, or the end of the file when there is
none.
Trait Implementations§
Source§impl Clone for FileStream
impl Clone for FileStream
Source§impl Debug for FileStream
impl Debug for FileStream
impl Eq for FileStream
Source§impl IntoSource for FileStream
impl IntoSource for FileStream
Source§type Source = FileStream
type Source = FileStream
Source§fn into_source(self) -> Self
fn into_source(self) -> Self
Source§impl PartialEq for FileStream
impl PartialEq for FileStream
Source§impl RedeliveryAddressed<ConnectedFileBroker> for FileStream
impl RedeliveryAddressed<ConnectedFileBroker> for FileStream
Source§fn redelivery_address(
&self,
_connected: &ConnectedFileBroker,
) -> impl Future<Output = Result<RedeliveryAddress, SeaFileError>>
fn redelivery_address( &self, _connected: &ConnectedFileBroker, ) -> impl Future<Output = Result<RedeliveryAddress, SeaFileError>>
impl StructuralPartialEq for FileStream
Source§impl SubscriptionSource<ConnectedFileBroker> for FileStream
impl SubscriptionSource<ConnectedFileBroker> for FileStream
Source§type Subscriber = FileSubscriber
type Subscriber = FileSubscriber
Source§type Copies = AddressedCopies
type Copies = AddressedCopies
AddressedCopies, NamedCopies or BrokerMoves. Read moreSource§async fn subscribe(
self,
connected: &ConnectedFileBroker,
) -> Result<FileSubscriber, SeaFileError>
async fn subscribe( self, connected: &ConnectedFileBroker, ) -> Result<FileSubscriber, SeaFileError>
Source§fn channel_bindings(&self) -> Bindings
fn channel_bindings(&self) -> Bindings
AsyncAPI document. Read moreSource§fn declare_retry(self, declaration: &RetryDeclaration) -> Selfwhere
Self: Sized,
fn declare_retry(self, declaration: &RetryDeclaration) -> Selfwhere
Self: Sized,
Source§fn declare_retry_on(
&self,
connected: &C,
declaration: &RetryDeclaration,
) -> Result<(), DeclareRetryError>
fn declare_retry_on( &self, connected: &C, declaration: &RetryDeclaration, ) -> Result<(), DeclareRetryError>
Source§fn operation_bindings(&self) -> Bindings
fn operation_bindings(&self) -> Bindings
receive operation in the document. Read moreSource§fn message_bindings(&self) -> Bindings
fn message_bindings(&self) -> Bindings
Auto Trait Implementations§
impl Freeze for FileStream
impl RefUnwindSafe for FileStream
impl Send for FileStream
impl Sync for FileStream
impl Unpin for FileStream
impl UnsafeUnpin for FileStream
impl UnwindSafe for FileStream
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more