Skip to main content

LocalClient

Struct LocalClient 

Source
pub struct LocalClient { /* private fields */ }

Implementations§

Source§

impl LocalClient

Source

pub async fn temporary(ctx: XetContext) -> Result<Arc<Self>>

Create a local client hosted in a temporary directory for testing. This is an async function to allow use with current-thread tokio runtime.

Source

pub async fn new(ctx: XetContext, path: impl AsRef<Path>) -> Result<Arc<Self>>

Create a local client hosted in a directory. Effectively, this directory is the CAS endpoint and persists across instances of LocalClient.

Source

pub fn set_lifecycle_tag_deletion(&self, on: bool)

Toggle lifecycle-tag deletion mode (see Self::lifecycle_tag_deletion).

Source§

impl LocalClient

Source

pub async fn get_reconstruction_v1( &self, file_id: &MerkleHash, bytes_range: Option<FileRange>, ) -> Result<Option<QueryReconstructionResponse>>

V1 reconstruction: returns per-range presigned URLs.

Source

pub async fn get_reconstruction_v2( &self, file_id: &MerkleHash, bytes_range: Option<FileRange>, ) -> Result<Option<QueryReconstructionResponseV2>>

V2 reconstruction: returns per-xorb multi-range fetch descriptors.

Trait Implementations§

Source§

impl Client for LocalClient

Source§

fn get_file_reconstruction_info<'life0, 'life1, 'async_trait>( &'life0 self, file_hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<Option<(MDBFileInfo, Option<MerkleHash>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn query_for_global_dedup_shard<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _prefix: &'life1 str, chunk_hash: &'life2 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn acquire_upload_permit<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConnectionPermit>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Acquire an upload permit.
Source§

fn upload_shard<'life0, 'async_trait>( &'life0 self, shard_data: Bytes, _permit: ConnectionPermit, progress_callback: Option<ShardUploadProgressCallback>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Upload a new shard. The optional callback receives v2 NDJSON progress events.
Source§

fn upload_xorb<'life0, 'life1, 'async_trait>( &'life0 self, _prefix: &'life1 str, serialized_xorb_object: SerializedXorbObject, progress_callback: Option<ProgressCallback>, _permit: ConnectionPermit, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upload a new xorb. Optional progress callback receives (delta, completed, total) in transfer bytes.
Source§

fn get_reconstruction<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, bytes_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponseV2>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns reconstruction info always in V2 format. Implementations may try V2 first and fall back to V1 + convert.
Source§

fn batch_get_reconstruction<'life0, 'life1, 'async_trait>( &'life0 self, file_ids: &'life1 [MerkleHash], ) -> Pin<Box<dyn Future<Output = Result<BatchQueryReconstructionResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn acquire_download_permit<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConnectionPermit>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_file_term_data<'life0, 'async_trait>( &'life0 self, url_info: Box<dyn URLProvider>, _download_permit: ConnectionPermit, progress_callback: Option<ProgressCallback>, uncompressed_size_if_known: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<(Bytes, Vec<u32>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optional progress callback receives (delta, completed, total) in transfer bytes. When [uncompressed_size_if_known] is Some, the returned Bytes must have len() equal to that value.
Source§

fn get_file_chunk_hashes<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, dirty_ranges: Vec<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<FileChunkHashesResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Compute chunk-aligned dirty windows + opaque gap [MerkleHashSubtree] summaries for the given file, narrowed to dirty_ranges. Read more
Source§

impl DeletionControlableClient for LocalClient

Source§

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

Verifies referential integrity of all shards on disk:

  1. For each XORB entry listed in any shard, the corresponding XORB file must exist on disk.
  2. For each file entry in any shard, every referenced XORB must exist on disk. (Global-dedup allows file entries to reference XORBs described in a different shard, so we do a cross-shard check against disk rather than a within-shard check.)
Source§

fn list_shard_entries<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<MerkleHash>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns all shard hashes from shard files on disk.
Source§

fn get_shard_bytes<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a shard’s raw bytes by its hash.
Source§

fn delete_shard_entry<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes a shard file by its hash.
Source§

fn list_file_shard_entries<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(MerkleHash, MerkleHash)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns (file_hash, shard_hash) tuples for all files across all shards.
Source§

fn delete_file_entry<'life0, 'life1, 'async_trait>( &'life0 self, file_hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft-deletes a file entry by hash. The file is hidden from reconstruction and listing paths without rewriting shard files.
Source§

fn remove_shard_dedup_entries<'life0, 'life1, 'async_trait>( &'life0 self, shard_hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Removes all global-dedup table entries contributed by the given shard. Called by GC Stage 4 before replacing or discarding a shard.
Source§

fn delete_xorb<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes a XORB by hash.
Source§

fn list_xorbs_and_tags<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(MerkleHash, ObjectTag)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns all XORB hashes with their associated object tags.
Source§

fn delete_xorb_if_tag_matches<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, tag: &'life2 ObjectTag, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes a XORB only if its current tag matches the provided tag. Returns Ok(true) if deleted, Ok(false) if the tag did not match.
Source§

fn list_shards_with_tags<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(MerkleHash, ObjectTag)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns all shard hashes with their associated object tags.
Source§

fn delete_shard_if_tag_matches<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, tag: &'life2 ObjectTag, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes a shard only if its current tag matches the provided tag. Returns Ok(true) if deleted, Ok(false) if the tag did not match.
Source§

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

Verifies referential integrity of all shards on disk.
Source§

impl DirectAccessClient for LocalClient

Source§

fn set_fetch_term_url_expiration(&self, expiration: Duration)

Sets the expiration duration for fetch term URLs.
Source§

fn set_global_dedup_shard_expiration(&self, expiration: Option<Duration>)

Sets the expiration duration for global dedup shards. Read more
Source§

fn set_max_ranges_per_fetch(&self, max_ranges: usize)

Sets the maximum number of byte ranges per XorbMultiRangeFetch entry in V2 reconstruction responses. Read more
Source§

fn disable_v2_endpoints(&self, status_code: u16)

Disables V2 endpoints (reconstruction and shard upload) with the given HTTP status code. When disabled, /v2/* handlers return this status, forcing clients to fall back to V1. Pass 0 to re-enable.
Source§

fn v2_disabled_status_code(&self) -> u16

Returns the HTTP status code V2 endpoints should return when disabled, or 0 if V2 is enabled.
Source§

fn get_reconstruction_v1<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, bytes_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

V1 reconstruction: returns per-range presigned URLs.
Source§

fn get_reconstruction_v2<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, bytes_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponseV2>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

V2 reconstruction: returns per-xorb multi-range fetch descriptors.
Source§

fn set_api_delay_range(&self, delay_range: Option<Range<Duration>>)

Sets a random delay range for all Client API calls. Read more
Source§

fn apply_api_delay<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Applies the configured API delay if set. Read more
Source§

fn list_xorbs<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<MerkleHash>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns all XORB hashes stored in this client.
Source§

fn get_full_xorb<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all uncompressed bytes from a XORB.
Source§

fn get_xorb_ranges<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, chunk_ranges: Vec<(u32, u32)>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get uncompressed bytes from a XORB within chunk ranges. Each tuple represents a chunk index range [start, end).
Source§

fn xorb_length<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the length of the uncompressed XORB data.
Source§

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

Check if a XORB exists.
Get the XorbObject footer/metadata for a XORB.
Source§

fn get_file_size<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the file size for a given file hash.
Source§

fn get_file_data<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, byte_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get file data, optionally within a byte range.
Source§

fn get_xorb_raw_bytes<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, byte_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get raw (serialized) bytes from a XORB, optionally within a byte range. Read more
Source§

fn xorb_raw_length<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the total length of the raw (serialized) XORB data.
Source§

fn fetch_term_data<'life0, 'async_trait>( &'life0 self, hash: MerkleHash, fetch_term: XorbReconstructionFetchInfo, ) -> Pin<Box<dyn Future<Output = Result<(Bytes, Vec<u32>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches term data for a given hash and fetch term. Returns (data bytes, chunk byte indices) matching Client::get_file_term_data.
Source§

impl Drop for LocalClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> ClientTestingUtils for T
where T: Client + Send + Sync + ?Sized,

Source§

fn upload_random_file<'life0, 'life1, 'async_trait>( &'life0 self, term_spec: &'life1 [(u64, (u64, u64))], chunk_size: usize, ) -> Pin<Box<dyn Future<Output = Result<RandomFileContents>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert a random file into the local CAS. Read more
Source§

impl<T> DropFlavorWrapper<T> for T

Source§

type Flavor = MayDrop

The DropFlavor that wraps T into Self
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> 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
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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, 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.
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