Struct branchless::core::eventlog::EventReplayer
source · [−]pub struct EventReplayer { /* private fields */ }
Expand description
Processes events in order and determine the repo’s visible commits.
Implementations
sourceimpl EventReplayer
impl EventReplayer
sourcepub fn from_event_log_db(
effects: &Effects,
repo: &Repo,
event_log_db: &EventLogDb<'_>
) -> Result<Self>
pub fn from_event_log_db(
effects: &Effects,
repo: &Repo,
event_log_db: &EventLogDb<'_>
) -> Result<Self>
Construct the replayer from all the events in the database.
Args:
event_log_db
: The database to query events from.
Returns: The constructed replayer.
sourcepub fn process_event(&mut self, event: &Event)
pub fn process_event(&mut self, event: &Event)
Process the given event.
This also sets the event cursor to point to immediately after the event that was just processed.
Args:
event
: The next event to process. Events should be passed to thereplayer
in order from oldest to newest.
sourcepub fn get_cursor_commit_activity_status(
&self,
cursor: EventCursor,
oid: NonZeroOid
) -> CommitActivityStatus
pub fn get_cursor_commit_activity_status(
&self,
cursor: EventCursor,
oid: NonZeroOid
) -> CommitActivityStatus
Determines whether a commit is considered “active” at the cursor’s point in time.
sourcepub fn get_cursor_commit_latest_event(
&self,
cursor: EventCursor,
oid: NonZeroOid
) -> Option<&Event>
pub fn get_cursor_commit_latest_event(
&self,
cursor: EventCursor,
oid: NonZeroOid
) -> Option<&Event>
Get the latest event affecting a given commit, as of the cursor’s point in time.
Args:
oid
: The OID of the commit to check.
Returns: The most recent event that affected that commit. If this commit
was not observed by the replayer, returns None
.
sourcepub fn get_cursor_oids(&self, cursor: EventCursor) -> HashSet<NonZeroOid>
pub fn get_cursor_oids(&self, cursor: EventCursor) -> HashSet<NonZeroOid>
Get all OIDs which have been observed so far. This should be the set of non-inactive commits.
sourcepub fn make_default_cursor(&self) -> EventCursor
pub fn make_default_cursor(&self) -> EventCursor
Create an event cursor pointing to immediately after the last event.
sourcepub fn make_cursor(&self, event_id: isize) -> EventCursor
pub fn make_cursor(&self, event_id: isize) -> EventCursor
Create an event cursor pointing to immediately after the provided event ID.
If the event ID is too low or too high, it will be clamped to the valid range for event IDs.
sourcepub fn advance_cursor(
&self,
cursor: EventCursor,
num_events: isize
) -> EventCursor
pub fn advance_cursor(
&self,
cursor: EventCursor,
num_events: isize
) -> EventCursor
Advance the event cursor by the specified number of events.
Args:
num_events
: The number of events to advance by. Can be positive, zero, or negative. If out of bounds, the cursor is set to the first or last valid position, as appropriate.
sourcepub fn advance_cursor_by_transaction(
&self,
cursor: EventCursor,
num_transactions: isize
) -> EventCursor
pub fn advance_cursor_by_transaction(
&self,
cursor: EventCursor,
num_transactions: isize
) -> EventCursor
Advance the cursor to the transaction which is num_transactions
after
the current cursor. num_transactions
can be negative.
The returned cursor will point to the position immediately after the last event in the subsequent transaction.
sourcepub fn get_references_snapshot(
&self,
repo: &Repo,
cursor: EventCursor
) -> Result<RepoReferencesSnapshot>
pub fn get_references_snapshot(
&self,
repo: &Repo,
cursor: EventCursor
) -> Result<RepoReferencesSnapshot>
Get the RepoReferencesSnapshot
at the cursor’s point in time.
sourcepub fn get_event_before_cursor(
&self,
cursor: EventCursor
) -> Option<(isize, &Event)>
pub fn get_event_before_cursor(
&self,
cursor: EventCursor
) -> Option<(isize, &Event)>
Get the event immediately before the cursor.
Returns: A tuple of event ID and the event that most recently happened.
If no event was before the event cursor, returns None
instead.
sourcepub fn get_tx_events_before_cursor(
&self,
cursor: EventCursor
) -> Option<(isize, &[Event])>
pub fn get_tx_events_before_cursor(
&self,
cursor: EventCursor
) -> Option<(isize, &[Event])>
Get all the events in the transaction immediately before the cursor.
Returns: A tuple of event ID and the events that happened in the most
recent transaction. The event ID corresponds to the ID of the first event
in the returned list of events. If there were no events before the event
cursor (and therefore no transactions), returns None
instead.
sourcepub fn get_events_since_cursor(&self, cursor: EventCursor) -> &[Event]
pub fn get_events_since_cursor(&self, cursor: EventCursor) -> &[Event]
Get all the events that have happened since the event cursor.
Returns: An ordered list of events that have happened since the event cursor, from least recent to most recent.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for EventReplayer
impl Send for EventReplayer
impl Sync for EventReplayer
impl Unpin for EventReplayer
impl UnwindSafe for EventReplayer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<D> OwoColorize for D
impl<D> OwoColorize for D
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read morefn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more