pub struct IpfrsClient { /* private fields */ }Expand description
Non-NAPI version used in unit tests and when building without the napi
feature (e.g. cargo test --lib).
Implementations§
Source§impl IpfrsClient
impl IpfrsClient
Sourcepub fn create(data_dir: String) -> Result<Self, ClientError>
pub fn create(data_dir: String) -> Result<Self, ClientError>
Create a new IpfrsClient backed by an in-memory store.
data_dir is recorded for informational purposes (e.g. stats());
it is not used for actual I/O in the in-memory implementation.
Sourcepub fn add_bytes_inner(&self, data: &[u8]) -> Result<String, ClientError>
pub fn add_bytes_inner(&self, data: &[u8]) -> Result<String, ClientError>
Add raw bytes, returning the CIDv1 string.
Sourcepub fn get_bytes_inner(&self, cid: &str) -> Result<Option<Vec<u8>>, ClientError>
pub fn get_bytes_inner(&self, cid: &str) -> Result<Option<Vec<u8>>, ClientError>
Retrieve bytes by CID. Returns None when the CID is not present.
Sourcepub fn has_inner(&self, cid: &str) -> Result<bool, ClientError>
pub fn has_inner(&self, cid: &str) -> Result<bool, ClientError>
Return true if cid is in the store.
Sourcepub fn list_cids_inner(&self) -> Result<Vec<String>, ClientError>
pub fn list_cids_inner(&self) -> Result<Vec<String>, ClientError>
Return all stored CIDs.
Sourcepub fn delete_inner(&self, cid: &str) -> Result<bool, ClientError>
pub fn delete_inner(&self, cid: &str) -> Result<bool, ClientError>
Delete a block. Returns true if the block existed and was removed.
Sourcepub fn version_inner(&self) -> String
pub fn version_inner(&self) -> String
Return the library version string.
Sourcepub fn stats_inner(&self) -> Result<String, ClientError>
pub fn stats_inner(&self) -> Result<String, ClientError>
Return a JSON string with basic storage statistics.
Auto Trait Implementations§
impl !Freeze for IpfrsClient
impl RefUnwindSafe for IpfrsClient
impl Send for IpfrsClient
impl Sync for IpfrsClient
impl Unpin for IpfrsClient
impl UnsafeUnpin for IpfrsClient
impl UnwindSafe for IpfrsClient
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