pub struct FilesystemRemoteStore { /* private fields */ }Expand description
Local-filesystem implementation of RemoteStore.
All operations are idempotent and atomic where applicable.
upload uses a .tmp write + rename to prevent torn writes (T-04-10).
Implementations§
Source§impl FilesystemRemoteStore
impl FilesystemRemoteStore
Sourcepub fn new(base_dir: PathBuf) -> Result<Self, EdgestoreError>
pub fn new(base_dir: PathBuf) -> Result<Self, EdgestoreError>
Create a new FilesystemRemoteStore rooted at base_dir.
Creates base_dir (and all parent directories) if it does not exist.
Trait Implementations§
Source§impl RemoteStore for FilesystemRemoteStore
impl RemoteStore for FilesystemRemoteStore
Source§fn upload(&self, hash: &[u8; 32], data: &[u8]) -> Result<(), EdgestoreError>
fn upload(&self, hash: &[u8; 32], data: &[u8]) -> Result<(), EdgestoreError>
Store data under hash. Idempotent: if the file already exists, returns Ok(()).
Writes to a .tmp file first, then renames atomically (T-04-10).
Source§fn download(&self, hash: &[u8; 32]) -> Result<Vec<u8>, EdgestoreError>
fn download(&self, hash: &[u8; 32]) -> Result<Vec<u8>, EdgestoreError>
Download the segment bytes for hash.
Returns EdgestoreError::ReplicationError if the segment is not present.
Source§fn list(&self) -> Result<Vec<[u8; 32]>, EdgestoreError>
fn list(&self) -> Result<Vec<[u8; 32]>, EdgestoreError>
List all stored segment hashes by scanning {base_dir}/*.seg.
Filenames that are not exactly 64 lowercase hex characters followed by .seg
are silently skipped (T-04-12).
Source§fn delete(&self, hash: &[u8; 32]) -> Result<(), EdgestoreError>
fn delete(&self, hash: &[u8; 32]) -> Result<(), EdgestoreError>
Remove the segment for hash. No-op if the segment does not exist (idempotent).