pub struct FsStore { /* private fields */ }
Expand description
A file based store.
A store can be created using load
or load_with_opts
.
Load will use the default options and create the required directories, while load_with_opts allows
you to customize the options and the location of the database. Both variants will create the database
if it does not exist, and load an existing database if one is found at the configured location.
In addition to implementing the Store
API via Deref
,
there are a few additional methods that are specific to file based stores, such as dump
.
Implementations§
Methods from Deref<Target = Store>§
The tags API.
Sourcepub fn downloader(&self, endpoint: &Endpoint) -> Downloader
pub fn downloader(&self, endpoint: &Endpoint) -> Downloader
Create a downloader for more complex downloads.
Unlike the other APIs, this creates an object that has internal state, so don’t create it ad hoc but store it somewhere if you need it multiple times.
pub async fn sync_db(&self) -> RequestResult<()>
pub async fn shutdown(&self) -> Result<()>
Methods from Deref<Target = Blobs>§
pub async fn batch(&self) -> Result<Batch<'_>>
pub async fn delete_with_opts( &self, options: DeleteOptions, ) -> RequestResult<()>
pub async fn delete( &self, hashes: impl IntoIterator<Item = impl Into<Hash>>, ) -> RequestResult<()>
pub fn add_slice(&self, data: impl AsRef<[u8]>) -> AddProgress<'_>
pub fn add_bytes(&self, data: impl Into<Bytes>) -> AddProgress<'_>
pub fn add_bytes_with_opts( &self, options: impl Into<AddBytesOptions>, ) -> AddProgress<'_>
pub fn add_path_with_opts( &self, options: impl Into<AddPathOptions>, ) -> AddProgress<'_>
pub fn add_path(&self, path: impl AsRef<Path>) -> AddProgress<'_>
pub async fn add_stream( &self, data: impl Stream<Item = Result<Bytes>> + Send + Sync + 'static, ) -> AddProgress<'_>
pub fn export_ranges( &self, hash: impl Into<Hash>, ranges: impl Into<RangeSet2<u64>>, ) -> ExportRangesProgress
pub fn export_ranges_with_opts( &self, options: ExportRangesOptions, ) -> ExportRangesProgress
pub fn export_bao_with_opts( &self, options: ExportBaoOptions, local_update_cap: usize, ) -> ExportBaoProgress
pub fn export_bao( &self, hash: impl Into<Hash>, ranges: impl Into<ChunkRanges>, ) -> ExportBaoProgress
Sourcepub async fn export_chunk(
&self,
hash: impl Into<Hash>,
offset: u64,
) -> ExportBaoResult<Leaf>
pub async fn export_chunk( &self, hash: impl Into<Hash>, offset: u64, ) -> ExportBaoResult<Leaf>
Export a single chunk from the given hash, at the given offset.
Sourcepub async fn get_bytes(&self, hash: impl Into<Hash>) -> ExportBaoResult<Bytes>
pub async fn get_bytes(&self, hash: impl Into<Hash>) -> ExportBaoResult<Bytes>
Get the entire blob into a Bytes
This will run out of memory when called for very large blobs, so be careful!
Sourcepub fn observe(&self, hash: impl Into<Hash>) -> ObserveProgress
pub fn observe(&self, hash: impl Into<Hash>) -> ObserveProgress
Observe the bitfield of the given hash.