pub struct Table(_);
Expand description
A reference to a latch-free, log-structured table that stores sorted key-value entries.
This is the same as raw::Table
with the Std
environment.
Implementations§
source§impl Table
impl Table
sourcepub fn open<P: AsRef<Path>>(path: P, options: TableOptions) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P, options: TableOptions) -> Result<Self>
Opens a table in the path with the given options.
This is a synchronous version of raw::Table::open
with the Std
environment.
sourcepub fn close(self) -> Result<(), Self>
pub fn close(self) -> Result<(), Self>
Closes the table if this is the only reference to it.
This is a synchronous version of raw::Table::close
.
sourcepub fn get(&self, key: &[u8], lsn: u64) -> Result<Option<Vec<u8>>>
pub fn get(&self, key: &[u8], lsn: u64) -> Result<Option<Vec<u8>>>
Gets the value corresponding to the key.
This is a synchronous version of raw::Table::get
.
Methods from Deref<Target = Table<Std>>§
sourcepub async fn get(&self, key: &[u8], lsn: u64) -> Result<Option<Vec<u8>>>
pub async fn get(&self, key: &[u8], lsn: u64) -> Result<Option<Vec<u8>>>
Gets the value corresponding to the key.
sourcepub async fn put(&self, key: &[u8], lsn: u64, value: &[u8]) -> Result<()>
pub async fn put(&self, key: &[u8], lsn: u64, value: &[u8]) -> Result<()>
Puts a key-value entry to the table.
sourcepub async fn delete(&self, key: &[u8], lsn: u64) -> Result<()>
pub async fn delete(&self, key: &[u8], lsn: u64) -> Result<()>
Deletes the entry corresponding to the key from the table.
sourcepub fn stats(&self) -> TableStats
pub fn stats(&self) -> TableStats
Returns the statistics of the table.
sourcepub fn safe_lsn(&self) -> u64
pub fn safe_lsn(&self) -> u64
Returns the minimal LSN that the table can safely read with.
The table guarantees that entries visible to the returned LSN are retained for reads.
sourcepub fn set_safe_lsn(&self, lsn: u64)
pub fn set_safe_lsn(&self, lsn: u64)
Updates the minimal LSN that the table can safely read with.
The safe LSN must be increasing, so updating it with a smaller value has no effect. When the safe LSN is advanced, the table will gradually drop entries that are not visible to the LSN anymore.