Skip to main content

GraphJournal

Struct GraphJournal 

Source
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

Source

pub fn new() -> Self

A fresh, empty journal (author user).

Source

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.

Source

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).

Source

pub fn author(&self) -> &str

The author subsequent records attribute.

Source

pub fn set_author(&mut self, author: impl Into<String>)

Scope the recording author (a denizen run); the host restores user when the run ends.

Source

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).

Source

pub fn record_as( &mut self, author: impl Into<String>, delta: CapturedDelta, ) -> Seq

Append one captured edit under an explicit author (the gate path).

Source

pub fn log(&self) -> &Codicil<AttributedDelta>

The underlying codicil, for cursors, replication, and persistence.

Source

pub fn entries(&self) -> &[AttributedDelta]

Every attributed edit, oldest first.

Source

pub fn len(&self) -> usize

The number of edits recorded.

Source

pub fn is_empty(&self) -> bool

Whether the journal holds no edits.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn id(&self) -> Option<&LogId>

This journal’s log identity, if any.

Source

pub fn provenance(&self) -> Option<&Provenance>

Where this journal forked from, if it is a fork.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> GraphJournal

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphJournal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GraphJournal

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl SourceTime for GraphJournal

Source§

type Cursor = Seq

An opaque source-owned identity for one snapshot.
Source§

type Snapshot = Graph

The source’s truth at one cursor.
Source§

fn source_extent(&self) -> SourceExtent<Self::Cursor>

The earliest and current selectable cursors.
Source§

fn source_ticks(&self, max_points: usize) -> Vec<Self::Cursor>

Evenly distributed, source-ordered cursors for a bounded scrubber. Read more
Source§

fn source_snapshot(&self, cursor: &Self::Cursor) -> Option<Self::Snapshot>

Reproduce truth at exactly cursor, refusing stale or foreign cursors.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.