pub struct GraphJournal { /* private fields */ }Expand description
An append-only journal of a graph’s captured edits: the codicil-backed edit
spine. The materialized Graph is the replay of this log; forking it forks
the graph’s whole history with provenance, and it persists whole through one
muniment slot.
Implementations§
Source§impl GraphJournal
impl GraphJournal
Sourcepub fn with_id(id: LogId) -> Self
pub fn with_id(id: LogId) -> Self
A journal with a stable identity, so it can later be forked with provenance pointing back at it.
Sourcepub fn from_log(log: Codicil<AttributedDelta>) -> Self
pub fn from_log(log: Codicil<AttributedDelta>) -> Self
Adopt an existing codicil of attributed deltas (e.g. one just loaded from a store or received from a peer).
The author subsequent records attribute.
Scope the recording author (a denizen run); the host restores user
when the run ends.
Sourcepub fn record(&mut self, delta: CapturedDelta) -> Seq
pub fn record(&mut self, delta: CapturedDelta) -> Seq
Append one captured edit under the current author, returning the Seq
it was stamped with. This is the write path: a live mutation’s capture
lands here (usually via journal_capture_hook).
Sourcepub fn record_as(
&mut self,
author: impl Into<String>,
delta: CapturedDelta,
) -> Seq
pub fn record_as( &mut self, author: impl Into<String>, delta: CapturedDelta, ) -> Seq
Append one captured edit under an explicit author (the gate path).
Sourcepub fn log(&self) -> &Codicil<AttributedDelta>
pub fn log(&self) -> &Codicil<AttributedDelta>
The underlying codicil, for cursors, replication, and persistence.
Sourcepub fn entries(&self) -> &[AttributedDelta]
pub fn entries(&self) -> &[AttributedDelta]
Every attributed edit, oldest first.
Sourcepub fn next_seq(&self) -> Seq
pub fn next_seq(&self) -> Seq
The Seq the next recorded edit will receive — a durable cursor a
checkpoint can store to resume replay from.
Sourcepub const fn earliest_cursor(&self) -> Seq
pub const fn earliest_cursor(&self) -> Seq
The earliest source-time cursor: the empty graph before the first
captured delta. Journal source time is a prefix cursor, so this is
intentionally Seq(0) even though no entry is addressed there yet.
Sourcepub fn live_cursor(&self) -> Seq
pub fn live_cursor(&self) -> Seq
The current live source-time cursor: the prefix immediately after the newest captured delta. Appending later deltas never changes the graph a previously returned cursor replays to.
Sourcepub fn snapshot_at(&self, cursor: Seq) -> Option<Graph>
pub fn snapshot_at(&self, cursor: Seq) -> Option<Graph>
Materialize graph truth at a journal prefix cursor without changing the
journal or its current live graph. Seq(n) replays exactly the first
n entries; Seq(0) is empty and live_cursor
replays every current entry. A cursor beyond the known prefix is stale
and is refused rather than silently clamped to live.
Sourcepub fn sequence_ticks(&self, max_points: usize) -> Vec<Seq>
pub fn sequence_ticks(&self, max_points: usize) -> Vec<Seq>
Stable, evenly distributed prefix cursors for a compact scrubber. This
uses sequence order alone: journal history has no required wall-clock
timestamp. max_points == 1 yields only the current live cursor;
larger requests always include both earliest and live when distinct.
Sourcepub fn provenance(&self) -> Option<&Provenance>
pub fn provenance(&self) -> Option<&Provenance>
Where this journal forked from, if it is a fork.
Sourcepub fn replay(&self) -> Graph
pub fn replay(&self) -> Graph
Rebuild the whole graph by replaying every edit from empty (attribution rides the journal, not the graph — replay strips the envelope).
Sourcepub fn replay_from(&self, since: Seq, graph: &mut Graph)
pub fn replay_from(&self, since: Seq, graph: &mut Graph)
Advance an already-materialized graph by the edits from since onward.
The checkpoint-plus-tail path: restore a GraphSnapshot, then apply only
the journal entries recorded after the snapshot’s sequence. The incremental
twin of replay.
Sourcepub fn fork(&self, new_id: LogId) -> Self
pub fn fork(&self, new_id: LogId) -> Self
Fork this journal under a new identity: copies the whole edit history and records where it branched from, then diverges independently. The log-level mirror of a graph fork; the fork replays to an identical graph and then edits without touching the source.
Sourcepub async fn save<B: Backend, C: Codec>(
&self,
slots: &SlotStore<B, C>,
key: &str,
) -> Result<(), StoreError>
pub async fn save<B: Backend, C: Codec>( &self, slots: &SlotStore<B, C>, key: &str, ) -> Result<(), StoreError>
Write the whole journal to the muniment slot at key.
Sourcepub async fn load<B: Backend, C: Codec>(
slots: &SlotStore<B, C>,
key: &str,
) -> Result<Self, StoreError>
pub async fn load<B: Backend, C: Codec>( slots: &SlotStore<B, C>, key: &str, ) -> Result<Self, StoreError>
Load a journal from the muniment slot at key, or an empty journal if the
slot is absent.
Sourcepub fn migrate_bare_log(log: Codicil<CapturedDelta>) -> Self
pub fn migrate_bare_log(log: Codicil<CapturedDelta>) -> Self
Adopt a pre-envelope codicil of bare CapturedDeltas, attributing
every entry pre-gate (chartulary’s migration convention): the one-way
load-time migration for logs recorded before attribution existed.
Trait Implementations§
Source§impl Clone for GraphJournal
impl Clone for GraphJournal
Source§impl Debug for GraphJournal
impl Debug for GraphJournal
Source§impl Default for GraphJournal
impl Default for GraphJournal
Source§impl SourceTime for GraphJournal
impl SourceTime for GraphJournal
Source§fn source_extent(&self) -> SourceExtent<Self::Cursor>
fn source_extent(&self) -> SourceExtent<Self::Cursor>
Auto Trait Implementations§
impl Freeze for GraphJournal
impl RefUnwindSafe for GraphJournal
impl Send for GraphJournal
impl Sync for GraphJournal
impl Unpin for GraphJournal
impl UnsafeUnpin for GraphJournal
impl UnwindSafe for GraphJournal
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.