pub struct CovenReadHandle { /* private fields */ }Expand description
A read-only handle over one coven store, for a same-store secondary reader.
Open it with
Coven::builder(cfg).open_read_only().
Cheap to clone — every field is shared (an Arc or a Clone handle),
so a clone reads the same database and storage as the original.
§What it can do
- Rows — read via
sql_read. The closure receives the&Connectioncoven owns; because the connection is read-only, any write statement fails at the SQLite layer. - Blobs —
read_blobandopen_blob_streamresolve a blob’s locality and serve it from the local store, the cache, or a cloud fetch into the per-device cache.is_pinnedreports whether a set is kept offline.
It builds read storage from the current Config on a cloud miss, exactly as a
home-less full handle does — there is no sync loop to reuse.
Implementations§
Source§impl CovenReadHandle
impl CovenReadHandle
Sourcepub async fn sql_read<F, R>(&self, f: F) -> CovenResult<R>
pub async fn sql_read<F, R>(&self, f: F) -> CovenResult<R>
Run a pure read against the connection coven owns and await the result.
This is the read handle’s form of
CovenHandle::sql_read: the closure receives
the &Connection directly (coven serializes access on its connection
thread, so this never races the writer’s process), and a host closure
written against CovenHandle::sql_read ports unchanged here. The connection
is SQLITE_OPEN_READONLY: a SELECT/PRAGMA reads normally, and any
INSERT/UPDATE/DELETE/DDL is refused by SQLite — the read-only
guarantee is enforced at the connection, not left to the caller.
Sourcepub async fn row_blob_ref(
&self,
table: &str,
row_id: &str,
) -> Result<RowBlobRef, DbError>
pub async fn row_blob_ref( &self, table: &str, row_id: &str, ) -> Result<RowBlobRef, DbError>
Capture the exact current blob-bearing row version from this reader’s database snapshot.
Sourcepub async fn read_blob(
&self,
blob: &RowBlobRef,
) -> Result<Vec<u8>, BlobCacheError>
pub async fn read_blob( &self, blob: &RowBlobRef, ) -> Result<Vec<u8>, BlobCacheError>
Read a blob’s whole plaintext through coven’s locality-aware read: served from
the user’s file (Local user-provided), coven’s local store (Local
host-provided), the pinned/evictable cache on a Remote hit, or fetched from
the cloud into the cache on a Remote miss. The read counterpart of
CovenHandle::read_blob.
A cloud fetch writes the fetched bytes into the per-device cache
(storage/cache/) with an atomic temp-then-rename — device scratch, no synced
state touched — so a File Provider materializing remote content works through a
read-only handle. The supplied RowBlobRef already carries the exact stored
object and authority, so the read performs no database write or cloud listing.
Sourcepub async fn open_blob_stream(
&self,
blob: &RowBlobRef,
offset: u64,
len: u64,
) -> Result<Vec<u8>, BlobCacheError>
pub async fn open_blob_stream( &self, blob: &RowBlobRef, offset: u64, len: u64, ) -> Result<Vec<u8>, BlobCacheError>
Serve len plaintext bytes of an exact row blob starting at offset, for
streaming or seeking without loading the whole file. The RowBlobRef
carries the plaintext length used to bound the range. The ranged sibling of
read_blob; a Remote-miss range read fetches from the cloud
but writes no cache file (only a whole-file read populates).
Sourcepub fn open_app_data(
&self,
sealed: &[u8],
aad: &[u8],
) -> Result<Vec<u8>, SealError>
pub fn open_app_data( &self, sealed: &[u8], aad: &[u8], ) -> Result<Vec<u8>, SealError>
Open a payload
CovenHandle::seal_app_data produced,
resolving the store’s master keyring through this handle’s custody. The read
side of app-data sealing: a secondary reader opens what the writer sealed,
under whichever generation the payload names.
There is no seal counterpart here — sealing writes new ciphertext, which is the writer’s job; this handle only reads.
SealError::Locked if the store is locked; a wrong aad, a tampered
payload, an unreadable version, or a generation this store’s keyring lacks
each surface their own typed error.
Trait Implementations§
Source§impl Clone for CovenReadHandle
impl Clone for CovenReadHandle
Source§fn clone(&self) -> CovenReadHandle
fn clone(&self) -> CovenReadHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CovenReadHandle
impl !RefUnwindSafe for CovenReadHandle
impl Send for CovenReadHandle
impl Sync for CovenReadHandle
impl Unpin for CovenReadHandle
impl UnsafeUnpin for CovenReadHandle
impl !UnwindSafe for CovenReadHandle
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