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

Fields§

§inner: Arc<dyn OSObjectStore>

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( 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(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 block_size(&self) -> usize

source

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

source

pub fn base_path(&self) -> &Path

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 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<'_, 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§

impl ObjectStore

source

pub fn new( store: Arc<DynObjectStore>, location: Url, block_size: Option<usize>, wrapper: Option<Arc<dyn WrappingObjectStore>> ) -> 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 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> 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.

§

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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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§

default 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>,

§

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

§

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

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