Struct growthring::wal::WALWriter
source · pub struct WALWriter<F: WALStore> { /* private fields */ }
Implementations§
source§impl<F: WALStore> WALWriter<F>
impl<F: WALStore> WALWriter<F>
sourcepub fn grow<'a, R: Record + 'a>(
&'a mut self,
records: Vec<R>
) -> Vec<impl Future<Output = Result<(R, WALRingId), ()>> + 'a>
pub fn grow<'a, R: Record + 'a>( &'a mut self, records: Vec<R> ) -> Vec<impl Future<Output = Result<(R, WALRingId), ()>> + 'a>
Submit a sequence of records to WAL. It returns a vector of futures, each of which
corresponds to one record. When a future resolves to WALRingId
, it is guaranteed the
record is already logged. Then, after finalizing the changes encoded by that record to
the persistent storage, the caller can recycle the WAL files by invoking the given
peel
with the given WALRingId
s. Note: each serialized record should contain at least 1
byte (empty record payload will result in assertion failure).
sourcepub async fn peel<'a, T: AsRef<[WALRingId]>>(
&'a mut self,
records: T,
keep_nrecords: u32
) -> Result<(), ()>
pub async fn peel<'a, T: AsRef<[WALRingId]>>( &'a mut self, records: T, keep_nrecords: u32 ) -> Result<(), ()>
Inform the WALWriter
that some data writes are complete so that it could automatically
remove obsolete WAL files. The given list of WALRingId
does not need to be ordered and
could be of arbitrary length. Use 0
for keep_nrecords
if all obsolete WAL files
need to removed (the obsolete files do not affect the speed of recovery or correctness).