Skip to main content

Replayer

Struct Replayer 

Source
pub struct Replayer<'a> { /* private fields */ }
Expand description

Plays a trace file back against a DB.

The replayer keeps raw pointers to the DB and to the column family handles it was built from and executes operations through them, so 'a ties it to the DB it came from.

prepare must succeed before replay, which otherwise fails with Result incomplete. Preparing again rewinds the trace, which is also how to replay a second time after a run has consumed it.

Implementations§

Source§

impl Replayer<'_>

Source

pub fn prepare(&mut self) -> Result<(), Error>

Reads the trace header and positions the replayer at the first record.

Required before replay. Calling it again rewinds the trace and clears the end-of-trace state.

Source

pub fn replay(&mut self, options: &ReplayOptions) -> Result<(), Error>

Replays every remaining record against the DB, honouring the recorded delay between them as scaled by options.

Blocks until the trace is exhausted, then returns Ok. Per-operation results are discarded: db/c.cc passes no result callback, so only an overall status comes back. A record whose type this RocksDB build cannot execute is skipped rather than failing the run. Once the run reaches the end of the trace, further calls fail with Result incomplete until prepare rewinds it.

Fails with Result incomplete if prepare has not succeeded, and with Invalid argument if ReplayOptions::set_fast_forward was given a value at or below 0.0.

Source

pub fn header_timestamp(&self) -> u64

The timestamp recorded in the trace header, in microseconds, which is when tracing started.

Returns 0 until prepare has succeeded, since that is what reads the header.

Trait Implementations§

Source§

impl Drop for Replayer<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Replayer<'_>

Auto Trait Implementations§

§

impl<'a> !Sync for Replayer<'a>

§

impl<'a> Freeze for Replayer<'a>

§

impl<'a> RefUnwindSafe for Replayer<'a>

§

impl<'a> Unpin for Replayer<'a>

§

impl<'a> UnsafeUnpin for Replayer<'a>

§

impl<'a> UnwindSafe for Replayer<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.