Trait sqlite_vfs::DatabaseHandle
source · [−]pub trait DatabaseHandle: Sync {
type WalIndex: WalIndex;
fn size(&self) -> Result<u64, Error>;
fn read_exact_at(&mut self, buf: &mut [u8], offset: u64) -> Result<(), Error>;
fn write_all_at(&mut self, buf: &[u8], offset: u64) -> Result<(), Error>;
fn sync(&mut self, data_only: bool) -> Result<(), Error>;
fn set_len(&mut self, size: u64) -> Result<(), Error>;
fn lock(&mut self, lock: LockKind) -> Result<bool, Error>;
fn reserved(&mut self) -> Result<bool, Error>;
fn current_lock(&self) -> Result<LockKind, Error>;
fn wal_index(&self, readonly: bool) -> Result<Self::WalIndex, Error>;
fn unlock(&mut self, lock: LockKind) -> Result<bool, Error> { ... }
fn set_chunk_size(&self, _chunk_size: usize) -> Result<(), Error> { ... }
fn moved(&self) -> Result<bool, Error> { ... }
}
Expand description
A file opened by Vfs.
Required Associated Types
Required Methods
Reads the exact number of byte required to fill buf
from the given offset
.
Attempts to write an entire buf
starting from the given offset
.
Make sure all writes are committed to the underlying storage. If data_only
is set to
true
, only the data and not the metadata (like size, access time, etc) should be synced.
Set the database file to the specified size
. Truncates or extends the underlying storage.
Lock the database. Returns whether the requested lock could be acquired. Locking sequence:
- The lock is never moved from LockKind::None to anything higher than LockKind::Shared.
- A LockKind::Pending is never requested explicitly.
- A LockKind::Shared is always held when a LockKind::Reserved lock is requested
Check if the database this handle points to holds a LockKind::Reserved, LockKind::Pending or LockKind::Exclusive lock.
fn current_lock(&self) -> Result<LockKind, Error>
fn current_lock(&self) -> Result<LockKind, Error>
Return the current LockKind of the this handle.
Provided Methods
Change the chunk size of the database to chunk_size
.