Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica
Skip to main content

RemoteConnection

Struct RemoteConnection 

Source
pub struct RemoteConnection { /* private fields */ }
Expand description

A connection to a remote Eidetica service server over a Unix domain socket.

RemoteConnection backs the RemoteBackend implementation of the Backend seam. It provides the storage operations as inherent methods, plus additional coordination methods like notify_entry_written.

Cloning is cheap (Arc-backed).

Teardown. The reader task holds a strong Arc<RemoteConnectionInner> and inner owns the socket’s WriteHalf, so neither half of the split stream can drop on its own: the reader parks in read_frame until the daemon EOFs, and the daemon only EOFs once our socket closes. The live token breaks that cycle — when the last user-facing handle drops it calls RemoteConnectionInner::mark_dead, aborting the reader so its Arc is released, inner drops, and the WriteHalf closes. The daemon then sees EOF and scrubs the connection’s subscriptions via its ConnectionGuard.

Implementations§

Source§

impl RemoteConnection

Source

pub async fn connect(path: impl AsRef<Path>) -> Result<Self>

Connect to a service server at the given socket path.

Performs the protocol handshake, then spawns a background reader task that demuxes ServerFrames: Response frames pop the next pending oneshot in FIFO order, Notification frames dispatch into the attached Instance’s callback registry (after Self::attach_instance has been called).

Source

pub fn session_identity(&self) -> Option<SigKey>

Build a SigKey from the session pubkey, when logged in.

Source

pub async fn get_instance_metadata(&self) -> Result<Option<InstanceMetadata>>

Source

pub async fn set_instance_metadata( &self, metadata: &InstanceMetadata, ) -> Result<()>

Source

pub async fn begin_transaction( &self, root_id: ID, identity: SigKey, stores: Vec<String>, scope: ReadScope, ) -> Result<TransactionContext>

Acquire a TransactionContext for the given stores and scope.

The returned context includes main-tree parents with heights, per-store subtree parents, _settings tips, and the merged _settings value — everything needed to build and sign an entry locally without further round-trips.

Source

pub async fn get_store_state( &self, root_id: ID, identity: SigKey, store: String, ) -> Result<WireCrdtValue>

Fetch the server-materialized merged state of an unencrypted store.

Source

pub async fn get_store_entries( &self, root_id: ID, identity: SigKey, store: String, tips: Vec<ID>, scope: ReadScope, ) -> Result<Vec<Entry>>

Fetch ordered, verified, opaque store entries reachable from tips.

Universal primitive — works for encrypted stores (client decrypts locally) as well as unencrypted ones.

Source

pub async fn get_verified_tips( &self, root_id: ID, identity: SigKey, ) -> Result<Snapshot>

Fetch the database’s Verified-frontier tips.

Source

pub async fn submit_signed_entry( &self, root_id: ID, identity: SigKey, entry: Entry, ) -> Result<()>

Submit a client-signed entry to the server.

The server stores the entry as Unverified and runs its own verification pass — it never trusts a submitted entry’s claimed validity.

Source

pub async fn db_get_entry( &self, root_id: ID, identity: SigKey, id: ID, ) -> Result<Entry>

Fetch a single database entry by id.

Gated post-fetch by the entry’s owning tree, so the caller must hold at least Read on the database the entry belongs to.

Source

pub async fn store_snapshot_at( &self, root_id: ID, identity: SigKey, store: String, up_to: Vec<ID>, ) -> Result<Snapshot>

Subtree tips reachable from given main-tree entries.

Source

pub async fn compute_merge_state( &self, root_id: ID, identity: SigKey, store: String, entry_ids: Vec<ID>, ) -> Result<MergeState>

Compute merge state: lowest common ancestor + path to tip entries.

Source

pub async fn get_cached_crdt_state_remote( &self, root_id: ID, identity: SigKey, store: String, key: ID, ) -> Result<Option<Vec<u8>>>

Tier 2 cache read: ask the daemon for a previously-stashed CRDT state blob. None on miss; the caller falls back to a full recompute from store entries.

Source

pub async fn cache_crdt_state_remote( &self, root_id: ID, identity: SigKey, store: String, key: ID, blob: Vec<u8>, ) -> Result<()>

Tier 2 cache write: stash a client-computed CRDT state blob in the daemon’s unified cache, scoped to the session user (crate::backend::CacheScope::User). Per-user trust; the daemon stores opaque bytes verbatim.

Trait Implementations§

Source§

impl Clone for RemoteConnection

Source§

fn clone(&self) -> RemoteConnection

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RemoteConnection

Source§

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

Formats the value using the given formatter. Read more

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

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,