Struct rust_ipfs::repo::Repo

source ·
pub struct Repo { /* private fields */ }
Expand description

Describes a repo.

Consolidates a blockstore, a datastore and a subscription registry.

Implementations§

source§

impl Repo

source

pub fn new(repo_type: StoragePath) -> Self

source

pub fn new_raw( block_store: Arc<dyn BlockStore>, data_store: Arc<dyn DataStore>, lockfile: Arc<dyn Lock> ) -> Self

source

pub fn new_fs(path: impl AsRef<Path>) -> Self

source

pub fn new_memory() -> Self

source

pub async fn migrate(&self, repo: &Self) -> Result<(), Error>

source

pub fn shutdown(&self)

Shutdowns the repo, cancelling any pending subscriptions; Likely going away after some refactoring, see notes on crate::Ipfs::exit_daemon.

source

pub fn is_online(&self) -> bool

source

pub async fn init(&self) -> Result<(), Error>

source

pub async fn open(&self) -> Result<(), Error>

source

pub async fn put_block(&self, block: Block) -> Result<(Cid, BlockPut), Error>

Puts a block into the block store.

source

pub async fn get_block( &self, cid: &Cid, peers: &[PeerId], local_only: bool ) -> Result<Block, Error>

Retrives a block from the block store, or starts fetching it from the network and awaits until it has been fetched.

source

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.

source

pub async fn contains(&self, cid: &Cid) -> Result<bool, Error>

Check to determine if blockstore contain a block

source

pub async fn list_blocks(&self) -> Result<Vec<Cid>, Error>

Lists the blocks in the blockstore.

source

pub async fn remove_block(&self, cid: &Cid) -> Result<Cid, Error>

Remove block from the block store.

source

pub async fn get_ipns(&self, ipns: &PeerId) -> Result<Option<IpfsPath>, Error>

Get an ipld path from the datastore.

source

pub async fn put_ipns( &self, ipns: &PeerId, path: &IpfsPath ) -> Result<(), Error>

Put an ipld path into the datastore.

source

pub async fn remove_ipns(&self, ipns: &PeerId) -> Result<(), Error>

Remove an ipld path from the datastore.

source

pub async fn insert_pin( &self, cid: &Cid, recursive: bool, local_only: bool ) -> Result<(), Error>

Pins a given Cid recursively or directly (non-recursively).

source

pub async fn insert_direct_pin(&self, cid: &Cid) -> Result<(), Error>

Inserts a direct pin for a Cid.

source

pub async fn insert_recursive_pin( &self, cid: &Cid, refs: BoxStream<'_, Result<Cid, IpldRefsError>> ) -> Result<(), Error>

Inserts a recursive pin for a Cid.

source

pub async fn remove_direct_pin(&self, cid: &Cid) -> Result<(), Error>

Removes a direct pin for a Cid.

source

pub async fn remove_recursive_pin( &self, cid: &Cid, refs: BoxStream<'_, Result<Cid, IpldRefsError>> ) -> Result<(), Error>

Removes a recursive pin for a Cid.

source

pub async fn cleanup(&self) -> Result<Vec<Cid>, Error>

Function to perform a basic cleanup of unpinned blocks

source

pub async fn is_pinned(&self, cid: &Cid) -> Result<bool, Error>

Checks if a Cid is pinned.

source

pub async fn list_pins( &self, mode: Option<PinMode> ) -> BoxStream<'static, Result<(Cid, PinMode), Error>>

source

pub async fn query_pins( &self, cids: Vec<Cid>, requirement: Option<PinMode> ) -> Result<Vec<(Cid, PinKind<Cid>)>, Error>

source§

impl Repo

source

pub fn data_store(&self) -> &dyn DataStore

Trait Implementations§

source§

impl Clone for Repo

source§

fn clone(&self) -> Repo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Repo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Repo> for IpldDag

source§

fn from(repo: Repo) -> Self

Converts to this type from the input type.
source§

impl Store for Repo

source§

fn get_size<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid ) -> Pin<Box<dyn Future<Output = Result<Block>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn has<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Auto Trait Implementations§

§

impl !RefUnwindSafe for Repo

§

impl Send for Repo

§

impl Sync for Repo

§

impl Unpin for Repo

§

impl !UnwindSafe for Repo

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> References<RawCodec> for T

§

fn references<R, E>(_c: RawCodec, _r: &mut R, _set: &mut E) -> Result<(), Error>where R: Read, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more