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 persisted 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, recording as 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 starting_from(id: LogId, provenance: Provenance) -> Self

An empty journal that starts where provenance says another left off, without copying its entries: the keeper holds the graph they built as a snapshot. A session forked at a cursor starts this way.

Source

pub fn from_log(log: Journal<AttributedDelta>) -> Self

Adopt an existing journal of attributed deltas (e.g. one just loaded from a store or received from a peer).

Source

pub fn author(&self) -> &Author

The author subsequent records attribute.

Source

pub fn set_author(&mut self, author: Author)

Scope the recording author (a participant run); the host restores the previous one 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: Author, delta: CapturedDelta) -> Seq

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

Source

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

The underlying journal, 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) -> Result<Option<Graph>, ReplayRefused>

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 snapshot_at_from( &self, baseline: &Graph, cursor: Seq, ) -> Result<Option<Graph>, ReplayRefused>

Replay a prefix over its retained baseline, preserving baseline attribution.

Source

pub fn migrated_prefix_at_from( &self, baseline: &Graph, cursor: Seq, ) -> Result<Option<MigratedReplay>, LegacyMigrationError>

Migration of a caller-qualified legacy baseline and prefix. Ordinary replay does not infer a legacy profile from absent resource columns.

Source

pub fn migrated_prefix_at_from_with_resolutions( &self, baseline: &Graph, cursor: Seq, resolutions: &[LegacyResourceOriginResolution], ) -> Result<Option<MigratedReplay>, LegacyMigrationError>

Validate choices against this complete qualified legacy journal, then read a prefix. Future carried-handle choices do not change or invalidate earlier prefixes. A host with a modern suffix must supply only its qualified legacy prefix to the adapter.

Source

pub fn migrated_snapshot_at_from_with_resolutions( &self, baseline: &Graph, cursor: Seq, resolutions: &[LegacyResourceOriginResolution], ) -> Result<Option<Graph>, LegacyMigrationError>

Source

pub fn migrated_snapshot_at_from( &self, baseline: &Graph, cursor: Seq, ) -> Result<Option<Graph>, LegacyMigrationError>

The graph-only convenience form of migrated_prefix_at_from.

Source

pub fn migrated_replay_from_with_baseline( &self, since: Seq, graph: &mut Graph, baseline: &Graph, ) -> Result<(), LegacyMigrationError>

Reconstruct retained history before replacing a legacy checkpoint atomically. The full prefix supplies historical URLs and withdrawn handles; since is validated but cannot substitute the checkpoint’s current URL for that evidence.

Source

pub fn migrated_replay_from_with_baseline_and_resolutions( &self, since: Seq, graph: &mut Graph, baseline: &Graph, resolutions: &[LegacyResourceOriginResolution], ) -> Result<(), LegacyMigrationError>

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, using its author for legacy unattributed assertions.

Source

pub fn replay_from( &self, since: Seq, graph: &mut Graph, ) -> Result<(), ReplayRefused>

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. Without a retained baseline, exact records missing attribution stay unknown. Use replay_from_with_baseline to recover the original minting author across earlier removal and later restoration.

Source

pub fn replay_from_with_baseline( &self, since: Seq, graph: &mut Graph, baseline: &Graph, ) -> Result<(), ReplayRefused>

Replay a checkpoint tail with the baseline and original minting entries. baseline is the graph before entry zero, not the checkpoint at since.

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.

Trait Implementations§

Source§

impl Clone for GraphJournal

Source§

fn clone(&self) -> Self

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.