pub struct OplogSyncStore<'a> { /* private fields */ }Expand description
A SyncStore over one account’s op log on a live connection. Scoped to a single account: a
session syncs one account, and the hello handshake refuses a peer naming a different one.
Implementations§
Source§impl<'a> OplogSyncStore<'a>
impl<'a> OplogSyncStore<'a>
pub fn new(conn: &'a Connection, account_id: AccountId, now_ms: i64) -> Self
Trait Implementations§
Source§impl NodeAuth for OplogSyncStore<'_>
impl NodeAuth for OplogSyncStore<'_>
Source§fn local_binding(&self, local_node: &[u8; 32], now_ms: i64) -> Result<Vec<u8>>
fn local_binding(&self, local_node: &[u8; 32], now_ms: i64) -> Result<Vec<u8>>
Our signed binding vouching that
local_node is this account’s local device, stamped
now_ms. Err if this store cannot authorize (e.g. no local account/device yet — the
onboarding case).Whether
binding authorizes a peer whose iroh-authenticated node key is remote_node,
judged fresh against now_ms. Returns a plain bool — the store collapses the internal
failure taxonomy so the wire stays uniform. Err is reserved for a real fault (e.g. the
DB read failed), not a rejected peer.Source§impl SyncStore for OplogSyncStore<'_>
impl SyncStore for OplogSyncStore<'_>
Source§fn account_id(&self) -> [u8; 32]
fn account_id(&self) -> [u8; 32]
The account this session is scoped to. A peer whose hello names a different account is a
misdirected connection and the session aborts.
Source§fn snapshot(&self) -> Result<Vec<([u8; 32], Vec<u8>)>>
fn snapshot(&self) -> Result<Vec<([u8; 32], Vec<u8>)>>
Every held account-log entry as
(dedup_key, signed_bytes), read ONCE at session start. The
key is the SIGNED-envelope hash (sha256(signed_bytes)), NOT the entry_hash — two envelopes
can share an entry_hash but differ in signature, and the wire must treat them as distinct or
a peer holding one would suppress the other. Snapshotting up front keeps what we send
independent of what we concurrently ingest, so the two session halves never contend.Auto Trait Implementations§
impl<'a> !RefUnwindSafe for OplogSyncStore<'a>
impl<'a> !Send for OplogSyncStore<'a>
impl<'a> !Sync for OplogSyncStore<'a>
impl<'a> !UnwindSafe for OplogSyncStore<'a>
impl<'a> Freeze for OplogSyncStore<'a>
impl<'a> Unpin for OplogSyncStore<'a>
impl<'a> UnsafeUnpin for OplogSyncStore<'a>
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
Mutably borrows from an owned value. Read more
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>
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 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>
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