Struct dataflow::source::Timestamper [−][src]
pub struct Timestamper {
inner: Arc<RwLock<Timestamp>>,
sender: Sender<Event<Option<Timestamp>, Result<(Row, Timestamp, Diff), SourceError>>>,
tick_duration: Duration,
now: NowFn,
}
Expand description
A thread-safe transaction manager that is responsible for assigning timestamps to the transactions submitted to the system. Rows can be inserted individually using the insert and delete methods or as part of a bigger transaction.
When a transaction is started using start_tx the internal clock will be frozen and any subsequent rows will be timestamped with the exact same timestamp. The transaction is committed automatically as soon as the transaction object gets dropped.
Fields
inner: Arc<RwLock<Timestamp>>
sender: Sender<Event<Option<Timestamp>, Result<(Row, Timestamp, Diff), SourceError>>>
tick_duration: Duration
now: NowFn
Implementations
fn new(
sender: Sender<Event<Option<Timestamp>, Result<(Row, Timestamp, Diff), SourceError>>>,
tick_duration: Duration,
now: NowFn
) -> Self
Start a transaction at a particular point in time. The timestamper will freeze its internal clock while a transaction is active.
Records an error. After this method is called the source will permanently be in an errored state
Attempts to monotonically increase the current timestamp and provides a Progress message to timely.
This method will wait for all current transactions to commit before advancing the clock and will cause any new requests for transactions to wait for the tick to complete before starting. This is due to the write-preferring behaviour of the tokio RwLock.
Auto Trait Implementations
impl !RefUnwindSafe for Timestamper
impl Send for Timestamper
impl Sync for Timestamper
impl Unpin for Timestamper
impl !UnwindSafe for Timestamper
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more