Skip to main content

LfsAdapter

Struct LfsAdapter 

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

The batch/transfer adapter — the storage-side surface the alkhttp lfs door consumes (ADR-022 §1–3, lfs.md §1–2 — the adapter/door split is the module doc). Construct over the object pool, the rows surface, the wired ownership provider (required — see the module doc), and the config knobs.

Implementations§

Source§

impl LfsAdapter

Source

pub fn new( store: Arc<BlobStore>, rows: Arc<dyn LfsRows>, ownership: Arc<dyn OwnershipProvider>, config: LfsAdapterConfig, ) -> Result<Self, OpenError>

Construct the adapter. The registry assembled here is the ops control plane the batch answers over (the POC-L DirectOps binding shape): blobs/stat through the OpsContext, the namespace ACL riding the wired provider — the one op this surface registers, so the ops fetch op’s own knobs (fetch_max_total_bytes and friends) stay at their defaults and are not this surface’s budget: downloads ride read_range directly under the resolved-span ceiling (LfsAdapterConfig::max_object_bytes, enforced adapter-side). Fallible on the config’s shape (the fallible-constructor posture).

Source

pub fn config(&self) -> &LfsAdapterConfig

The adapter’s config (the door reads the budget knobs).

Source

pub async fn check( &self, identity: Option<&Identity>, repo_id: &str, request: LfsBatchRequest, ) -> Result<LfsBatchResponse, LfsAdapterError>

The batch/checking answer (lfs.md §1): the formable-key existence over the ops control plane (blobs/stat through the context), the response objects’ shapes, and the row assertion at check time — every validated object’s (repo_id, oid, size) pair is asserted before the probes (the moment the server learns the pair; a malformed oid cannot form a row and its answer is the per-object 422). The batch’s own gates run first: no identity, or the wired provider not granting the operation’s action (write for upload batches, read for download batches), is the forbidden refusal; a declared hash_algo other than sha256 is the pinned 409.

Source

pub async fn upload<R>( &self, identity: Option<&Identity>, repo_id: &str, oid: &str, size: Option<u64>, body: R, ) -> Result<(), LfsAdapterError>
where R: AsyncRead + Unpin + Send,

The upload — the pre-keyed put (ADR-022 §2). The identity and the write grant are required (the wired provider; the door carries the Basic tolerance). The size is the put’s mandatory claim: None is the size-less refusal. The row is asserted first (the moment the upload learns the pair), then the put rides the put handler’s contract minus the channel: the one-read tee over a bounded pipe, the claim cross-check pre-EOF (a mislabeled body kills the put — zero residue), then the custody hand-over through the OpsContext verbs — mint and confirm (the fleet form mints and drops the guard; the non-fleet form mints custodial and confirms, the POC-L attach-reference pattern).

Source

pub async fn download( &self, identity: Option<&Identity>, repo_id: &str, oid: &str, range: Option<LfsRange>, ) -> Result<LfsDownload, LfsAdapterError>

The download — the ranged fetch (ADR-022 §2): the read grant is required (the wired provider), the entry’s existence rides stat, and the served stream verifies per-window slice digests mid-flight (the module doc’s byte-path section). The resolved span is budget-gated by LfsAdapterConfig::max_object_bytes — every form (the range-less whole serve, the open-ended resume, any resolved span) the adapter will actually produce counts against the ceiling; a past-EOF offset is the not-satisfiable refusal (the door’s 416). A whole-span download additionally verifies the served bytes’ sha256 against the oid end-to-end at EOF (the large tier’s reads carry no canonical re-derivation — the oid check is this path’s job); a partial span’s windows carry the length + store-interior slice checks only (the module doc’s verification statement).

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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, 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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