lance_io::object_store

Struct ObjectStore

Source
pub struct ObjectStore {
    pub inner: Arc<dyn OSObjectStore>,
    pub use_constant_size_upload_parts: bool,
    pub list_is_lexically_ordered: bool,
    /* private fields */
}
Expand description

Fields§

§inner: Arc<dyn OSObjectStore>§use_constant_size_upload_parts: bool

Whether to use constant size upload parts for multipart uploads. This is only necessary for Cloudflare R2.

§list_is_lexically_ordered: bool

Whether we can assume that the list of files is lexically ordered. This is true for object stores, but not for local filesystems.

Implementations§

Source§

impl ObjectStore

Source

pub async fn from_uri(uri: &str) -> Result<(Self, Path)>

Parse from a string URI.

Returns the ObjectStore instance and the absolute path to the object.

Source

pub async fn from_uri_and_params( registry: Arc<ObjectStoreRegistry>, uri: &str, params: &ObjectStoreParams, ) -> Result<(Self, Path)>

Parse from a string URI.

Returns the ObjectStore instance and the absolute path to the object.

Source

pub fn from_path_with_scheme( str_path: &str, scheme: &str, ) -> Result<(Self, Path)>

Source

pub fn from_path(str_path: &str) -> Result<(Self, Path)>

Source

pub fn local() -> Self

Local object store.

Source

pub fn memory() -> Self

Create a in-memory object store directly for testing.

Source

pub fn is_local(&self) -> bool

Returns true if the object store pointed to a local file system.

Source

pub fn is_cloud(&self) -> bool

Source

pub fn block_size(&self) -> usize

Source

pub fn set_block_size(&mut self, new_size: usize)

Source

pub fn set_io_parallelism(&mut self, io_parallelism: usize)

Source

pub fn io_parallelism(&self) -> usize

Source

pub async fn open(&self, path: &Path) -> Result<Box<dyn Reader>>

Open a file for path.

Parameters

  • path: Absolute path to the file.
Source

pub async fn open_with_size( &self, path: &Path, known_size: usize, ) -> Result<Box<dyn Reader>>

Open a reader for a file with known size.

This size may either have been retrieved from a list operation or cached metadata. By passing in the known size, we can skip a HEAD / metadata call.

Source

pub async fn create_local_writer(path: &Path) -> Result<ObjectWriter>

Create an ObjectWriter from local std::path::Path

Source

pub async fn open_local(path: &Path) -> Result<Box<dyn Reader>>

Open an Reader from local std::path::Path

Source

pub async fn create(&self, path: &Path) -> Result<ObjectWriter>

Create a new file.

Source

pub async fn put(&self, path: &Path, content: &[u8]) -> Result<()>

A helper function to create a file and write content to it.

Source

pub async fn delete(&self, path: &Path) -> Result<()>

Source

pub async fn copy(&self, from: &Path, to: &Path) -> Result<()>

Source

pub async fn read_dir(&self, dir_path: impl Into<Path>) -> Result<Vec<String>>

Read a directory (start from base directory) and returns all sub-paths in the directory.

Source

pub async fn read_dir_all( &self, dir_path: impl Into<&Path> + Send, unmodified_since: Option<DateTime<Utc>>, ) -> Result<BoxStream<'_, Result<ObjectMeta>>>

Read all files (start from base directory) recursively

unmodified_since can be specified to only return files that have not been modified since the given time.

Source

pub async fn remove_dir_all(&self, dir_path: impl Into<Path>) -> Result<()>

Remove a directory recursively.

Source

pub fn remove_stream<'a>( &'a self, locations: BoxStream<'a, Result<Path>>, ) -> BoxStream<'a, Result<Path>>

Source

pub async fn exists(&self, path: &Path) -> Result<bool>

Check a file exists.

Source

pub async fn size(&self, path: &Path) -> Result<usize>

Get file size.

Source

pub async fn read_one_all(&self, path: &Path) -> Result<Bytes>

Convenience function to open a reader and read all the bytes

Source

pub async fn read_one_range( &self, path: &Path, range: Range<usize>, ) -> Result<Bytes>

Convenience function open a reader and make a single request

If you will be making multiple requests to the path it is more efficient to call Self::open and then call Reader::get_range multiple times.

Source§

impl ObjectStore

Source

pub fn new( store: Arc<DynObjectStore>, location: Url, block_size: Option<usize>, wrapper: Option<Arc<dyn WrappingObjectStore>>, use_constant_size_upload_parts: bool, list_is_lexically_ordered: bool, io_parallelism: usize, download_retry_count: usize, ) -> Self

Trait Implementations§

Source§

impl Clone for ObjectStore

Source§

fn clone(&self) -> ObjectStore

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 ObjectStore

Source§

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

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

impl DeepSizeOf for ObjectStore

Source§

fn deep_size_of_children(&self, context: &mut Context) -> usize

Returns an estimation of the heap-managed storage of this object. This does not include the size of the object itself. Read more
Source§

fn deep_size_of(&self) -> usize

Returns an estimation of a total size of memory owned by the object, including heap-managed storage. Read more
Source§

impl Display for ObjectStore

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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, 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<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T