pub struct SqliteFlowStore { /* private fields */ }Expand description
SQLite-backed Flow store.
Implementations§
Source§impl SqliteFlowStore
impl SqliteFlowStore
Sourcepub fn open(
path: impl AsRef<Path>,
site_id: impl Into<String>,
) -> Result<Self, VcsBackendError>
pub fn open( path: impl AsRef<Path>, site_id: impl Into<String>, ) -> Result<Self, VcsBackendError>
Open or create a store at path using site_id for locally emitted
atoms.
Sourcepub fn in_memory(site_id: impl Into<String>) -> Result<Self, VcsBackendError>
pub fn in_memory(site_id: impl Into<String>) -> Result<Self, VcsBackendError>
Create an in-memory store for tests and ephemeral callers.
pub fn site_id(&self) -> &str
Sourcepub fn emit_atoms(
&self,
atoms: &[Atom],
) -> Result<Vec<AtomRef>, VcsBackendError>
pub fn emit_atoms( &self, atoms: &[Atom], ) -> Result<Vec<AtomRef>, VcsBackendError>
Persist multiple locally emitted atoms in one transaction.
Sourcepub fn emit_preverified_atoms(
&self,
atoms: &[Atom],
) -> Result<Vec<AtomRef>, VcsBackendError>
pub fn emit_preverified_atoms( &self, atoms: &[Atom], ) -> Result<Vec<AtomRef>, VcsBackendError>
Persist new atoms that the caller has already verified.
This is intended for sync and benchmark hot paths that validate a batch once at the boundary, then measure storage throughput independently from signature verification cost. The caller must guarantee these atoms are not already present in the store.
Sourcepub fn insert_remote_atom(
&self,
atom: &Atom,
site_id: &str,
clock: u64,
) -> Result<AtomRef, VcsBackendError>
pub fn insert_remote_atom( &self, atom: &Atom, site_id: &str, clock: u64, ) -> Result<AtomRef, VcsBackendError>
Persist a remote atom at its original site clock.
Sourcepub fn atom_by_content_hash(
&self,
content_hash: AtomId,
) -> Result<Option<Atom>, VcsBackendError>
pub fn atom_by_content_hash( &self, content_hash: AtomId, ) -> Result<Option<Atom>, VcsBackendError>
Find an atom by its content hash. For Flow atoms the content hash is the atom id, so this uses the primary-key index directly.
Sourcepub fn atoms_for_principal_persona(
&self,
principal: &str,
persona: &str,
) -> Result<Vec<Atom>, VcsBackendError>
pub fn atoms_for_principal_persona( &self, principal: &str, persona: &str, ) -> Result<Vec<Atom>, VcsBackendError>
Load atoms for a principal/persona ordered by timestamp and atom id.
Sourcepub fn atom_count_for_principal_persona(
&self,
principal: &str,
persona: &str,
) -> Result<u64, VcsBackendError>
pub fn atom_count_for_principal_persona( &self, principal: &str, persona: &str, ) -> Result<u64, VcsBackendError>
Count atoms for a principal/persona using the timestamp index.
Sourcepub fn atoms_with_parent(
&self,
parent: AtomId,
) -> Result<Vec<Atom>, VcsBackendError>
pub fn atoms_with_parent( &self, parent: AtomId, ) -> Result<Vec<Atom>, VcsBackendError>
Load all child atoms that list parent as a parent edge.
Sourcepub fn state_vector(
&self,
principal: &str,
persona: &str,
) -> Result<StateVector, VcsBackendError>
pub fn state_vector( &self, principal: &str, persona: &str, ) -> Result<StateVector, VcsBackendError>
Current state vector for one principal/persona stream.
Sourcepub fn causal_delta(
&self,
principal: &str,
persona: &str,
remote: &StateVector,
) -> Result<Vec<AtomDelta>, VcsBackendError>
pub fn causal_delta( &self, principal: &str, persona: &str, remote: &StateVector, ) -> Result<Vec<AtomDelta>, VcsBackendError>
Return atoms this store has that are newer than remote.
Sourcepub fn put_intent(&self, intent: &Intent) -> Result<(), VcsBackendError>
pub fn put_intent(&self, intent: &Intent) -> Result<(), VcsBackendError>
Persist an intent record and its atom edges.
pub fn get_intent(&self, intent_id: IntentId) -> Result<Intent, VcsBackendError>
Sourcepub fn put_derived_slice(
&self,
slice: &DerivedSlice,
) -> Result<(), VcsBackendError>
pub fn put_derived_slice( &self, slice: &DerivedSlice, ) -> Result<(), VcsBackendError>
Persist a derived Flow slice record.
Sourcepub fn put_shipped_derived_slice(
&self,
slice: &DerivedSlice,
) -> Result<(), VcsBackendError>
pub fn put_shipped_derived_slice( &self, slice: &DerivedSlice, ) -> Result<(), VcsBackendError>
Persist a derived Flow slice as shipped.
This writes the immutable shipped record directly; callers should not persist an unshipped row first and later mutate it.
pub fn get_derived_slice( &self, slice_id: SliceId, ) -> Result<DerivedSlice, VcsBackendError>
Sourcepub fn shipped_derived_slices_since(
&self,
since: Option<OffsetDateTime>,
) -> Result<Vec<StoredDerivedSlice>, VcsBackendError>
pub fn shipped_derived_slices_since( &self, since: Option<OffsetDateTime>, ) -> Result<Vec<StoredDerivedSlice>, VcsBackendError>
List shipped derived slices, optionally filtering by store creation timestamp.
Trait Implementations§
Source§impl Debug for SqliteFlowStore
impl Debug for SqliteFlowStore
Source§impl VcsBackend for SqliteFlowStore
impl VcsBackend for SqliteFlowStore
Source§fn emit_atom(&self, atom: &Atom) -> Result<AtomRef, VcsBackendError>
fn emit_atom(&self, atom: &Atom) -> Result<AtomRef, VcsBackendError>
Source§fn derive_slice(&self, atoms: &[AtomId]) -> Result<FlowSlice, VcsBackendError>
fn derive_slice(&self, atoms: &[AtomId]) -> Result<FlowSlice, VcsBackendError>
Source§fn ship_slice(&self, slice: &FlowSlice) -> Result<ShipReceipt, VcsBackendError>
fn ship_slice(&self, slice: &FlowSlice) -> Result<ShipReceipt, VcsBackendError>
Source§fn list_atoms(&self) -> Result<Vec<AtomRef>, VcsBackendError>
fn list_atoms(&self) -> Result<Vec<AtomRef>, VcsBackendError>
Source§fn replay_slice(&self, slice: &FlowSlice) -> Result<Vec<Atom>, VcsBackendError>
fn replay_slice(&self, slice: &FlowSlice) -> Result<Vec<Atom>, VcsBackendError>
Source§fn export_git(
&self,
_slice: &FlowSlice,
_ref_name: &str,
) -> Result<GitExportReceipt, VcsBackendError>
fn export_git( &self, _slice: &FlowSlice, _ref_name: &str, ) -> Result<GitExportReceipt, VcsBackendError>
Source§fn import_git(&self, _ref_name: &str) -> Result<FlowSlice, VcsBackendError>
fn import_git(&self, _ref_name: &str) -> Result<FlowSlice, VcsBackendError>
Auto Trait Implementations§
impl !Freeze for SqliteFlowStore
impl RefUnwindSafe for SqliteFlowStore
impl Send for SqliteFlowStore
impl Sync for SqliteFlowStore
impl Unpin for SqliteFlowStore
impl UnsafeUnpin for SqliteFlowStore
impl UnwindSafe for SqliteFlowStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);