Skip to main content

DumpApi

Trait DumpApi 

Source
pub trait DumpApi<T: Types> {
    // Required method
    fn write_with<D>(&self, write_record: D) -> Result<(), Error>
       where D: FnMut(ChunkId, u64, Result<(Segment, WALRecord<T>), Error>) -> Result<(), Error>;

    // Provided methods
    fn write_to_string(&self) -> Result<String, Error> { ... }
    fn write<W: Write>(&self, w: W) -> Result<(), Error> { ... }
    fn write_display<W: Write>(&self, w: W) -> Result<(), Error>
       where WALRecord<T>: Display { ... }
}
Expand description

A trait for dumping Raft log contents in a human-readable format.

Required Methods§

Source

fn write_with<D>(&self, write_record: D) -> Result<(), Error>

Writes the Raft log contents using a custom record writer function.

§Arguments
  • write_record - A function that writes individual log records. It takes:
    • ChunkId: The ID of the chunk containing the record
    • u64: The index of the record in its chunk
    • Result<(Segment, WALRecord<T>), io::Error>: The record data or error
§Returns
  • Ok(()) if writing succeeds
  • Err(io::Error) if fails to read Raft-log or user provided callback returns an error

Provided Methods§

Source

fn write_to_string(&self) -> Result<String, Error>

Writes the Raft log contents to a String.

Source

fn write<W: Write>(&self, w: W) -> Result<(), Error>

Writes the Raft log contents to the provided writer.

Source

fn write_display<W: Write>(&self, w: W) -> Result<(), Error>
where WALRecord<T>: Display,

Writes the Raft log contents to the provided writer, using std::fmt::Display for record formatting.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Types> DumpApi<T> for Dump<T>