Struct sled::LockFreeLog [] [src]

pub struct LockFreeLog { /* fields omitted */ }

A sequential store which allows users to create reservations placed at known log offsets, used for writing persistent data structures that need to know where to find persisted bits in the future.

Working with LockFreeLog

use sled::Log;

let log = sled::Config::default().log();
let first_offset = log.write(b"1".to_vec());
log.write(b"22".to_vec());
log.write(b"333".to_vec());

// stick an abort in the middle, which should not be returned
let res = log.reserve(b"never_gonna_hit_disk".to_vec());
res.abort();

log.write(b"4444".to_vec());
let last_offset = log.write(b"55555".to_vec());
log.make_stable(last_offset);
let mut iter = log.iter_from(first_offset);
assert_eq!(iter.next().unwrap().1, b"1".to_vec());
assert_eq!(iter.next().unwrap().1, b"22".to_vec());
assert_eq!(iter.next().unwrap().1, b"333".to_vec());
assert_eq!(iter.next().unwrap().1, b"4444".to_vec());
assert_eq!(iter.next().unwrap().1, b"55555".to_vec());
assert_eq!(iter.next(), None);

Methods

impl LockFreeLog
[src]

[src]

create new lock-free log

[src]

Flush the next io buffer.

[src]

Clean up log entries for data that may not yet be on the disk yet.

Trait Implementations

impl Send for LockFreeLog
[src]

impl Sync for LockFreeLog
[src]

impl Drop for LockFreeLog
[src]

[src]

Executes the destructor for this type. Read more

impl Log for LockFreeLog
[src]

[src]

Create a log offset reservation for a particular write, which may later be filled or canceled. Read more

[src]

return the config in use for this log

[src]

Write a buffer to underlying storage.

[src]

read a buffer from the disk

[src]

returns the current stable offset written to disk

[src]

blocks until the specified id has been made stable on disk

[src]

deallocates the data part of a log id

[src]

Return an iterator over the log, starting with a specified offset. Read more