pub struct LogStore { /* private fields */ }Expand description
The default store: every update is appended to a log file and synced before the service replies, and every so often the whole state is written as a checkpoint and the log emptied.
The directory holds naming.ckp, the last checkpoint, and
naming.log, the updates since. Both are text with one record per
line, starting with a header rustorb-naming 1 GENERATION:
rustorb-naming 1 3
context NameService
bind NameService o app.kind IOR:0100...
bind NameService c sub IOR:0100...
unbind NameService app.kind
destroy 5f3a9c0e12ab44d1A name component is written in the stringified name form
(id.kind, with \ escapes), and %, spaces and control characters
in it as %XX. A checkpoint ends with an end line.
A checkpoint is written to a temporary file, synced and renamed over
naming.ckp; then the log is started again with the checkpoint’s
generation. At load, a log of an older generation than the checkpoint
(a crash between the two steps) is ignored, and a last line without
its newline (a crash while appending) is dropped.
Implementations§
Source§impl LogStore
impl LogStore
Sourcepub fn new(dir: impl Into<PathBuf>) -> LogStore
pub fn new(dir: impl Into<PathBuf>) -> LogStore
A store in the directory dir, created if needed. A checkpoint is
written every 1000 updates.
Sourcepub fn checkpoint_every(self, records: usize) -> LogStore
pub fn checkpoint_every(self, records: usize) -> LogStore
Writes a checkpoint after records updates (at least 1).
Sourcepub fn checkpoint_interval(self, interval: Duration) -> LogStore
pub fn checkpoint_interval(self, interval: Duration) -> LogStore
Also writes a checkpoint at the first update after interval has
passed since the last one.