Struct commitlog::CommitLog
[−]
[src]
pub struct CommitLog { /* fields omitted */ }
The commit log is an append-only sequence of messages.
Methods
impl CommitLog
[src]
pub fn new(opts: LogOptions) -> Result<CommitLog>
[src]
Creates or opens an existing commit log.
pub fn append_msg<B: AsRef<[u8]>>(
&mut self,
payload: B
) -> Result<Offset, AppendError>
[src]
&mut self,
payload: B
) -> Result<Offset, AppendError>
Appends a single message to the log, returning the offset appended.
pub fn append<T>(&mut self, buf: &mut T) -> Result<OffsetRange, AppendError> where
T: MessageSetMut,
[src]
T: MessageSetMut,
Appends log entrites to the commit log, returning the offsets appended.
pub fn last_offset(&self) -> Option<Offset>
[src]
Gets the last written offset.
pub fn read(
&self,
start: Offset,
limit: ReadLimit
) -> Result<MessageBuf, ReadError>
[src]
&self,
start: Offset,
limit: ReadLimit
) -> Result<MessageBuf, ReadError>
Reads a portion of the log, starting with the start
offset, inclusive, up to the limit.
pub fn reader<R: LogSliceReader>(
&self,
reader: &mut R,
start: Offset,
limit: ReadLimit
) -> Result<R::Result, ReadError>
[src]
&self,
reader: &mut R,
start: Offset,
limit: ReadLimit
) -> Result<R::Result, ReadError>
Reads a portion of the log, starting with the start
offset, inclusive, up to the limit
via the reader.
pub fn truncate(&mut self, offset: Offset) -> Result<()>
[src]
Truncates a file after the offset supplied. The resulting log will contain entries up to the offset.
pub fn flush(&mut self) -> Result<()>
[src]
Forces a flush of the log.