Skip to main content

coven/
handle_local_bytes.rs

1//! What this device keeps for the store, read from coven's tables, once and
2//! as it changes (§17.8, §19.3, E8).
3
4use crate::*;
5
6impl CovenHandle {
7    /// What the store keeps on this device, from one snapshot of coven's
8    /// tables: each declared namespace's budget and counters, the partial
9    /// downloads that pins left, the store's own files and the archives
10    /// that resets kept.
11    pub async fn local_bytes(&self) -> CovenResult<LocalBytes> {
12        Ok(self.database.local_bytes().await?)
13    }
14
15    /// The same read as a live query: it runs again after each write that
16    /// changes what it reads, such as the cache's committed entries, a
17    /// budget, a database file's size after a checkpoint, or the deletion of
18    /// an archive. A read that only updates a cache entry's last-read time does
19    /// not run the query again.
20    pub fn subscribe_local_bytes(&self) -> LiveQuery<LocalBytes, CovenError> {
21        self.database.subscribe_local_bytes()
22    }
23}
24
25#[cfg(test)]
26#[path = "handle_local_bytes_tests.rs"]
27mod tests;