pub struct FsTileStore { /* private fields */ }Expand description
Filesystem-backed tile store.
Stores tiles and checkpoints as plain files under a base directory.
Full tiles (paths without .p/) are write-once: subsequent writes
are silently skipped. Partial tiles (paths containing .p/) and
the checkpoint file are always overwritable.
Args:
base_path— Root directory for all tile and checkpoint files.
Usage:
ⓘ
let store = FsTileStore::new("/home/user/.auths/tlog".into());
store.write_tile("tile/0/000", &data).await?;Implementations§
Source§impl FsTileStore
impl FsTileStore
Sourcepub fn new(base_path: PathBuf) -> Self
pub fn new(base_path: PathBuf) -> Self
Creates a new filesystem tile store rooted at the given path.
Args:
base_path— Directory where tiles and checkpoints are stored.
Usage:
ⓘ
let store = FsTileStore::new(PathBuf::from("/tmp/tlog"));Sourcepub fn ensure_base_dir(&self) -> Result<(), TransparencyError>
pub fn ensure_base_dir(&self) -> Result<(), TransparencyError>
Create the store’s base directory (and any missing parents).
Args:
- none beyond
self.
Usage:
ⓘ
store.ensure_base_dir()?;Sourcepub fn load_or_create_key(
&self,
create: bool,
) -> Result<Option<LogSigningKey>, TransparencyError>
pub fn load_or_create_key( &self, create: bool, ) -> Result<Option<LogSigningKey>, TransparencyError>
Load the log’s signing key from <base>/log.key, minting and
persisting a fresh one (mode 0600 on Unix) on first use when create
is set.
Returns Ok(None) when the key is absent and create is false, so a
caller can distinguish “no log here yet” from an I/O failure without
itself touching the filesystem.
Args:
create— Generate and persist a key if none exists yet.
Usage:
ⓘ
let key = store.load_or_create_key(true)?.expect("created on first use");Trait Implementations§
Source§impl TileStore for FsTileStore
impl TileStore for FsTileStore
Source§fn read_tile<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, TransparencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_tile<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, TransparencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a tile by its C2SP path (e.g., “tile/0/000”).
Source§fn write_tile<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), TransparencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_tile<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), TransparencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write a tile at the given C2SP path.
Auto Trait Implementations§
impl Freeze for FsTileStore
impl RefUnwindSafe for FsTileStore
impl Send for FsTileStore
impl Sync for FsTileStore
impl Unpin for FsTileStore
impl UnsafeUnpin for FsTileStore
impl UnwindSafe for FsTileStore
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
Mutably borrows from an owned value. Read more