pub struct CovenReadHandle { /* private fields */ }Expand description
A handle that reads synced rows and maintains its local file cache (§4, E1).
Its shared store lock prevents deletion until all its connections close.
Its SQL may not read coven_sync_status: it can’t tell whether the writer
that last wrote the row still runs (E5).
async fn no_writes(handle: &coven::CovenReadHandle) {
handle.write(|_| Ok::<_, coven::CovenError>(())).await;
}fn no_live_query(handle: &coven::CovenReadHandle) {
handle.subscribe(|_| Ok::<_, coven::CovenError>(()));
}Implementations§
Source§impl CovenReadHandle
impl CovenReadHandle
Sourcepub async fn store_name(&self) -> CovenResult<String>
pub async fn store_name(&self) -> CovenResult<String>
The store’s current name from this device’s committed state (E9).
Sourcepub fn read<F, R, E>(&self, read: F) -> Read<'_, F, ReadOnly> ⓘwhere
F: FnOnce(SqlReadContext<'_>) -> Result<R, E> + Send + 'static,
R: Send + 'static,
E: From<DbError> + CarriesBug + Send + 'static,
pub fn read<F, R, E>(&self, read: F) -> Read<'_, F, ReadOnly> ⓘwhere
F: FnOnce(SqlReadContext<'_>) -> Result<R, E> + Send + 'static,
R: Send + 'static,
E: From<DbError> + CarriesBug + Send + 'static,
A read of one consistent snapshot, run when awaited.
Sourcepub async fn sqlite_settings(&self) -> Result<SqliteSettingsInEffect, DbError>
pub async fn sqlite_settings(&self) -> Result<SqliteSettingsInEffect, DbError>
The SQLite settings this handle’s connections have in effect (§4).
Sourcepub async fn file_ref(&self, file: FileId) -> Result<FileRef, DbError>
pub async fn file_ref(&self, file: FileId) -> Result<FileRef, DbError>
The file a row references, by the id the row holds.
Sourcepub async fn user_file(&self, file: FileId) -> Result<Option<UserFile>, DbError>
pub async fn user_file(&self, file: FileId) -> Result<Option<UserFile>, DbError>
The path, size and modification time recorded for a file’s original.
Sourcepub async fn read_file(
&self,
file: &FileRef,
lease: &FileLease,
) -> Result<Vec<u8>, FileReadError>
pub async fn read_file( &self, file: &FileRef, lease: &FileLease, ) -> Result<Vec<u8>, FileReadError>
Reads a whole file, in one place of lease. A stored file is checked
against its content hash.
Sourcepub async fn open_file_stream(
&self,
file: &FileRef,
lease: &FileLease,
) -> Result<FileStream<ReadOnly>, FileReadError>
pub async fn open_file_stream( &self, file: &FileRef, lease: &FileLease, ) -> Result<FileStream<ReadOnly>, FileReadError>
Opens a file for reading ranges (§17.7), as its record stands when it
opens; keep the stream for as long as the file is read. The stream
holds one place of lease until it drops. Its shared store lock
prevents deletion until it and its I/O finish.
Sourcepub async fn close(&self) -> Result<(), DbError>
pub async fn close(&self) -> Result<(), DbError>
Closes read and cache connections on all clones and releases their
storage client and shared store lock, while the app still holds the
handle. From its first poll every clone refuses new calls with
StoreClosed; the closing itself runs as its own task, so dropping
this future doesn’t stop it (E1, E15). File streams retain their own
locks.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CovenReadHandle
impl !UnwindSafe for CovenReadHandle
impl Freeze for CovenReadHandle
impl Send for CovenReadHandle
impl Sync for CovenReadHandle
impl Unpin for CovenReadHandle
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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