pub struct DiskPersister { /* private fields */ }Implementations§
Source§impl DiskPersister
impl DiskPersister
Sourcepub fn new(path: impl AsRef<Path>) -> Result<Self>
pub fn new(path: impl AsRef<Path>) -> Result<Self>
Open (or create) the JSONL log at path. The parent directory is
created if missing.
pub fn path(&self) -> &Path
Sourcepub fn replay(&self, ctx: &CellServerCtx) -> Result<usize>
pub fn replay(&self, ctx: &CellServerCtx) -> Result<usize>
Replay the JSONL log into ctx’s store. Call once after
CellServer::builder().build() and before server.run() so the
registry is hot before any client connects. Returns the number of
entities restored.
Sourcepub fn start_watcher(
self: &Arc<Self>,
ctx: CellServerCtx,
) -> Result<DiskWatcher>
pub fn start_watcher( self: &Arc<Self>, ctx: CellServerCtx, ) -> Result<DiskWatcher>
Spawn a filesystem watcher that tails the event log for external
appends, truncations, and replacements. Caller must keep the
returned DiskWatcher alive for the lifetime of the daemon — it
owns the underlying notify debouncer thread.
Self-write suppression: every persist/replay updates
applied_offset. The watcher only reads bytes past that mark, so
the daemon’s own appends are skipped (file size doesn’t grow
beyond the new offset before the watcher tick fires).
Truncation / replacement: detected by current_len < applied_offset or by an inode change. In either case the
persister reopens its file handle (so subsequent appends land in
the new file, not an unlinked one) and re-runs the
dedupe-from-top loader. Pre-existing entities not in the new file
are not DEL’d — hot-reload is a recovery affordance, not a full
state-replacement primitive.
Trait Implementations§
Source§impl Persister for DiskPersister
impl Persister for DiskPersister
Auto Trait Implementations§
impl Freeze for DiskPersister
impl RefUnwindSafe for DiskPersister
impl Send for DiskPersister
impl Sync for DiskPersister
impl Unpin for DiskPersister
impl UnsafeUnpin for DiskPersister
impl UnwindSafe for DiskPersister
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more