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§
Sourcefn write_with<D>(&self, write_record: D) -> Result<(), Error>
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 recordu64: The index of the record in its chunkResult<(Segment, WALRecord<T>), io::Error>: The record data or error
§Returns
Ok(())if writing succeedsErr(io::Error)if fails to read Raft-log or user provided callback returns an error
Provided Methods§
Sourcefn write_to_string(&self) -> Result<String, Error>
fn write_to_string(&self) -> Result<String, Error>
Writes the Raft log contents to a String.
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.