pub struct FileBroker { /* private fields */ }Expand description
A persistent, replayable stream on disk for the RustStream messaging framework: what
survives restarts, records for replay, and needs no external broker.
new is synchronous and records only the path; the file opens in the consuming
Broker::connect. Not supported on Windows (an upstream constraint of the file client).
§Examples
use ruststream_sea_file::FileBroker;
let broker = FileBroker::new("/var/lib/orders.ss");Implementations§
Source§impl FileBroker
impl FileBroker
Sourcepub fn new(path: impl Into<String>) -> Self
pub fn new(path: impl Into<String>) -> Self
Records the path of the stream file (created on connect when missing). No I/O.
Sourcepub fn existing_only(self) -> Self
pub fn existing_only(self) -> Self
Requires the file to exist instead of creating it on connect.
Sourcepub fn end_with_eos(self) -> Self
pub fn end_with_eos(self) -> Self
Writes an end-of-stream mark when the broker shuts down, so replay consumers of the finished file complete instead of waiting for more data.
Sourcepub fn beacon_interval(self, bytes: u32) -> Self
pub fn beacon_interval(self, bytes: u32) -> Self
The interval of the file’s in-place index (must be a positive multiple of 1024); denser beacons make seeking finer-grained at the cost of file size.
Sourcepub fn publisher(&self) -> FilePublisher
pub fn publisher(&self) -> FilePublisher
A publisher sharing this broker’s connection cell; buildable before connect.
Trait Implementations§
Source§impl Broker for FileBroker
impl Broker for FileBroker
Source§type Error = SeaFileError
type Error = SeaFileError
Source§type Connected = ConnectedFileBroker
type Connected = ConnectedFileBroker
connect
succeeded.Source§impl Clone for FileBroker
impl Clone for FileBroker
Source§fn clone(&self) -> FileBroker
fn clone(&self) -> FileBroker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more