Skip to main content

IrohBlobStore

Struct IrohBlobStore 

Source
pub struct IrohBlobStore { /* private fields */ }
Expand description

Content-addressed object store backed by iroh-blobs, keyed by canonical CIDs.

See the module docs for the CID → BLAKE3 locator model.

Implementations§

Source§

impl IrohBlobStore

Source

pub fn new_memory() -> Self

Create an ephemeral, in-memory store (tests, throwaway caches).

Source

pub async fn open_fs(root: impl AsRef<Path>) -> Result<Self>

Open (or create) a persistent store rooted at root.

Blob bytes live in the iroh-blobs FsStore under root; the CID→blake3 index is an append-only sidecar file next to it.

Source

pub async fn put_object(&self, data: Vec<u8>) -> Result<Sha256Hash>

Store an object, returning its SHA256 hash (the consumer-facing key).

The bytes are added to the iroh-blobs store (BLAKE3-addressed, tagged so garbage collection cannot reclaim them) and the Git CID→blake3 mapping is recorded.

Source

pub async fn put_verified_object( &self, expected_sha256: Sha256Hash, data: Vec<u8>, ) -> Result<Sha256Hash>

Store bytes under an expected SHA256 key after re-verifying them.

F2 uses this after a remote iroh-blobs transfer: provider hints are untrusted, so fetched bytes are accepted only when they match the consumer-facing SHA256 requested by the facade.

Source

pub async fn put_object_by_cid( &self, cid: ContentCid, data: Vec<u8>, ) -> Result<()>

Store bytes under an algorithm-preserving content CID.

Raw Git SHA-256 CIDs are re-verified against the bytes here. An XET Merkle CID addresses the reconstruction DAG rather than the raw file, so its binding is established by the XET clean operation and the LFS SHA-256 remains the end-to-end raw-file integrity check.

Source

pub async fn get_object(&self, hash: &Sha256Hash) -> Result<Option<Vec<u8>>>

Fetch an object by its SHA256 hash.

Returns Ok(None) when the hash is unknown. Returns an error if the index resolves but the retrieved bytes do not hash back to the requested SHA256 (poisoned/corrupt mapping — never served).

Source

pub async fn get_object_by_cid( &self, cid: &ContentCid, ) -> Result<Option<Vec<u8>>>

Fetch an object by its self-describing content CID.

Source

pub async fn blake3_of(&self, hash: &Sha256Hash) -> Option<Blake3Hash>

Resolve the BLAKE3 hash backing a SHA256 key, if known.

This is the seam F2 (#900) uses to announce/locate providers: the locator plane finds peers, iroh-blobs transfers by BLAKE3.

Source

pub async fn blake3_of_cid(&self, cid: &ContentCid) -> Option<Blake3Hash>

Resolve the raw-byte BLAKE3 hash backing a content CID, if known.

Source

pub async fn len(&self) -> usize

Number of CID-addressable objects.

Source

pub async fn is_empty(&self) -> bool

Whether the store has no CID-addressable objects.

Source

pub async fn shutdown(&self) -> Result<()>

Shut down the underlying iroh-blobs store, flushing pending writes.

Required before the same FsStore root can be reopened (the fs backend holds a database lock until its actor shuts down); dropping the store alone does not release it promptly.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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.

§

impl<T> Instrument for T

§

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

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

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 T
where 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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,