pub struct BlobsProtocol { /* private fields */ }
Expand description
A protocol handler for the blobs protocol.
Implementations§
Source§impl BlobsProtocol
impl BlobsProtocol
pub fn new( store: &Store, endpoint: Endpoint, events: Option<Sender<Event>>, ) -> Self
pub fn store(&self) -> &Store
pub fn endpoint(&self) -> &Endpoint
Sourcepub async fn ticket(
&self,
content: impl Into<HashAndFormat>,
) -> Result<BlobTicket>
pub async fn ticket( &self, content: impl Into<HashAndFormat>, ) -> Result<BlobTicket>
Create a ticket for content on this node.
Note that this does not check whether the content is partially or fully available. It is just a convenience method to create a ticket from content and the address of this node.
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 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.
pub fn observe_with_opts(&self, options: ObserveOptions) -> ObserveProgress
pub fn export_with_opts(&self, options: ExportOptions) -> ExportProgress
pub fn export( &self, hash: impl Into<Hash>, target: impl AsRef<Path>, ) -> ExportProgress
pub fn list(&self) -> BlobsListProgress
pub async fn status(&self, hash: impl Into<Hash>) -> Result<BlobStatus>
pub async fn has(&self, hash: impl Into<Hash>) -> Result<bool>
Trait Implementations§
Source§impl Clone for BlobsProtocol
impl Clone for BlobsProtocol
Source§fn clone(&self) -> BlobsProtocol
fn clone(&self) -> BlobsProtocol
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BlobsProtocol
impl Debug for BlobsProtocol
Source§impl Deref for BlobsProtocol
impl Deref for BlobsProtocol
Auto Trait Implementations§
impl Freeze for BlobsProtocol
impl !RefUnwindSafe for BlobsProtocol
impl Send for BlobsProtocol
impl Sync for BlobsProtocol
impl Unpin for BlobsProtocol
impl !UnwindSafe for BlobsProtocol
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<P> DynProtocolHandler for Pwhere
P: ProtocolHandler,
impl<P> DynProtocolHandler for Pwhere
P: ProtocolHandler,
§fn accept(
&self,
connection: Connection,
) -> Pin<Box<dyn Future<Output = Result<(), AcceptError>> + Send + '_>>
fn accept( &self, connection: Connection, ) -> Pin<Box<dyn Future<Output = Result<(), AcceptError>> + Send + '_>>
See [
ProtocolHandler::accept
].