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
impl RemoteConnection
Sourcepub async fn connect(path: impl AsRef<Path>) -> Result<Self>
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).
Sourcepub fn session_identity(&self) -> Option<SigKey>
pub fn session_identity(&self) -> Option<SigKey>
Build a SigKey from the session pubkey, when logged in.
pub async fn get_instance_metadata(&self) -> Result<Option<InstanceMetadata>>
pub async fn set_instance_metadata( &self, metadata: &InstanceMetadata, ) -> Result<()>
Sourcepub async fn begin_transaction(
&self,
root_id: ID,
identity: SigKey,
stores: Vec<String>,
scope: ReadScope,
) -> Result<TransactionContext>
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.
Sourcepub async fn get_store_state(
&self,
root_id: ID,
identity: SigKey,
store: String,
) -> Result<WireCrdtValue>
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.
Sourcepub async fn get_store_entries(
&self,
root_id: ID,
identity: SigKey,
store: String,
tips: Vec<ID>,
scope: ReadScope,
) -> Result<Vec<Entry>>
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.
Sourcepub async fn get_verified_tips(
&self,
root_id: ID,
identity: SigKey,
) -> Result<Snapshot>
pub async fn get_verified_tips( &self, root_id: ID, identity: SigKey, ) -> Result<Snapshot>
Fetch the database’s Verified-frontier tips.
Sourcepub async fn submit_signed_entry(
&self,
root_id: ID,
identity: SigKey,
entry: Entry,
) -> Result<()>
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.
Sourcepub async fn db_get_entry(
&self,
root_id: ID,
identity: SigKey,
id: ID,
) -> Result<Entry>
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.
Sourcepub async fn store_snapshot_at(
&self,
root_id: ID,
identity: SigKey,
store: String,
up_to: Vec<ID>,
) -> Result<Snapshot>
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.
Sourcepub async fn compute_merge_state(
&self,
root_id: ID,
identity: SigKey,
store: String,
entry_ids: Vec<ID>,
) -> Result<MergeState>
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.
Sourcepub async fn resolve_store_state(
&self,
identity: SigKey,
request: StoreStateRequest,
) -> Result<Option<String>>
pub async fn resolve_store_state( &self, identity: SigKey, request: StoreStateRequest, ) -> Result<Option<String>>
Resolve cached state, returning its opaque server-issued view onto the published record set.
Sourcepub async fn begin_store_state_staging(
&self,
identity: SigKey,
request: StoreStateRequest,
) -> Result<String>
pub async fn begin_store_state_staging( &self, identity: SigKey, request: StoreStateRequest, ) -> Result<String>
Begin a private build, returning its opaque capability.
Sourcepub async fn stage_store_state_records(
&self,
root: ID,
identity: SigKey,
token: String,
chunk_id: u64,
records: RecordMutations,
) -> Result<()>
pub async fn stage_store_state_records( &self, root: ID, identity: SigKey, token: String, chunk_id: u64, records: RecordMutations, ) -> Result<()>
Upload one idempotent chunk of records into the private build.
Sourcepub async fn publish_store_state(
&self,
root: ID,
identity: SigKey,
token: String,
) -> Result<String>
pub async fn publish_store_state( &self, root: ID, identity: SigKey, token: String, ) -> Result<String>
Publish the private build and return a view onto the published record set.
Sourcepub async fn abort_store_state(
&self,
root: ID,
identity: SigKey,
token: String,
) -> Result<()>
pub async fn abort_store_state( &self, root: ID, identity: SigKey, token: String, ) -> Result<()>
Discard an unfinished private build and its bytes.
Sourcepub async fn store_state_record_get(
&self,
root: ID,
identity: SigKey,
view: String,
key: Vec<u8>,
) -> Result<Option<Vec<u8>>>
pub async fn store_state_record_get( &self, root: ID, identity: SigKey, view: String, key: Vec<u8>, ) -> Result<Option<Vec<u8>>>
Read one record through a resolved view.
Sourcepub async fn store_state_record_scan(
&self,
root: ID,
identity: SigKey,
view: String,
range: RecordRange,
after: Option<Vec<u8>>,
max_records: u32,
max_encoded_bytes: u32,
) -> Result<RecordPage>
pub async fn store_state_record_scan( &self, root: ID, identity: SigKey, view: String, range: RecordRange, after: Option<Vec<u8>>, max_records: u32, max_encoded_bytes: u32, ) -> Result<RecordPage>
Read one bounded ordered page through a resolved view.
Trait Implementations§
Source§impl Clone for RemoteConnection
impl Clone for RemoteConnection
Source§fn clone(&self) -> RemoteConnection
fn clone(&self) -> RemoteConnection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RemoteConnection
impl !RefUnwindSafe for RemoteConnection
impl Send for RemoteConnection
impl Sync for RemoteConnection
impl Unpin for RemoteConnection
impl UnsafeUnpin for RemoteConnection
impl !UnwindSafe for RemoteConnection
Blanket Implementations§
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more