pub struct Repo { /* private fields */ }
Expand description
Describes a repo.
Consolidates a blockstore, a datastore and a subscription registry.
Implementations§
source§impl Repo
impl Repo
pub fn new(path: PathBuf) -> (Self, Receiver<RepoEvent>)
pub fn new_memory() -> (Self, Receiver<RepoEvent>)
sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Shutdowns the repo, cancelling any pending subscriptions; Likely going away after some
refactoring, see notes on crate::Ipfs::exit_daemon
.
pub async fn init(&self) -> Result<(), Error>
pub async fn open(&self) -> Result<(), Error>
sourcepub async fn put_block(&self, block: Block) -> Result<(Cid, BlockPut), Error>
pub async fn put_block(&self, block: Block) -> Result<(Cid, BlockPut), Error>
Puts a block into the block store.
sourcepub async fn get_block(&self, cid: &Cid) -> Result<Block, Error>
pub async fn get_block(&self, cid: &Cid) -> Result<Block, Error>
Retrives a block from the block store, or starts fetching it from the network and awaits until it has been fetched.
sourcepub async fn get_block_now(&self, cid: &Cid) -> Result<Option<Block>, Error>
pub async fn get_block_now(&self, cid: &Cid) -> Result<Option<Block>, Error>
Retrieves a block from the block store if it’s available locally.
sourcepub async fn list_blocks(&self) -> Result<Vec<Cid>, Error>
pub async fn list_blocks(&self) -> Result<Vec<Cid>, Error>
Lists the blocks in the blockstore.
sourcepub async fn remove_block(&self, cid: &Cid) -> Result<Cid, Error>
pub async fn remove_block(&self, cid: &Cid) -> Result<Cid, Error>
Remove block from the block store.
sourcepub async fn get_ipns(&self, ipns: &PeerId) -> Result<Option<IpfsPath>, Error>
pub async fn get_ipns(&self, ipns: &PeerId) -> Result<Option<IpfsPath>, Error>
Get an ipld path from the datastore.
sourcepub async fn put_ipns(&self, ipns: &PeerId, path: &IpfsPath) -> Result<(), Error>
pub async fn put_ipns(&self, ipns: &PeerId, path: &IpfsPath) -> Result<(), Error>
Put an ipld path into the datastore.
sourcepub async fn remove_ipns(&self, ipns: &PeerId) -> Result<(), Error>
pub async fn remove_ipns(&self, ipns: &PeerId) -> Result<(), Error>
Remove an ipld path from the datastore.
sourcepub async fn insert_direct_pin(&self, cid: &Cid) -> Result<(), Error>
pub async fn insert_direct_pin(&self, cid: &Cid) -> Result<(), Error>
Inserts a direct pin for a Cid
.
sourcepub async fn insert_recursive_pin(
&self,
cid: &Cid,
refs: BoxStream<'_, Result<Cid, IpldRefsError>>
) -> Result<(), Error>
pub async fn insert_recursive_pin( &self, cid: &Cid, refs: BoxStream<'_, Result<Cid, IpldRefsError>> ) -> Result<(), Error>
Inserts a recursive pin for a Cid
.
sourcepub async fn remove_direct_pin(&self, cid: &Cid) -> Result<(), Error>
pub async fn remove_direct_pin(&self, cid: &Cid) -> Result<(), Error>
Removes a direct pin for a Cid
.
sourcepub async fn remove_recursive_pin(
&self,
cid: &Cid,
refs: BoxStream<'_, Result<Cid, IpldRefsError>>
) -> Result<(), Error>
pub async fn remove_recursive_pin( &self, cid: &Cid, refs: BoxStream<'_, Result<Cid, IpldRefsError>> ) -> Result<(), Error>
Removes a recursive pin for a Cid
.
sourcepub async fn cleanup(&self) -> Result<Vec<Cid>, Error>
pub async fn cleanup(&self) -> Result<Vec<Cid>, Error>
Function to perform a basic cleanup of unpinned blocks