Struct agde_io::Options

source ·
pub struct Options<P: Platform> { /* private fields */ }

Implementations§

source§

impl<P: Platform> Options<P>

source

pub fn new( read: ReadFn, write: WriteFn, delete: DeleteFn, rough_resource_diff: DiffFn, metadata: Arc<Mutex<Metadata>>, offline_metadata: Arc<Mutex<Metadata>>, startup_timeout: Duration, sync_interval: Duration, force_pull: bool, verify_diffs: bool ) -> Self

source§

impl<P: Platform> Options<P>

source

pub fn arc(self) -> Arc<Self>

source

pub fn with_startup_duration(self, startup_timeout: Duration) -> Self

source

pub fn with_sync_interval(self, sync_interval: Duration) -> Self

source

pub fn with_periodic_interval(self, flush_interval: Duration) -> Self

source

pub async fn with_file_cache_max_size(self, max_size: usize) -> Self

source

pub fn with_no_public_storage(self) -> Self

source

pub fn sync_interval(&self) -> Duration

source

pub fn startup_timeout(&self) -> Duration

source

pub fn public_storage_disabled(&self) -> bool

source

pub fn metadata(&self) -> &Mutex<Metadata>

The metadata of both the public and current storage. Calling Metadata::changes on this.changes(offline_metadata) gets you the changes to get current storage the same as the public.

Can be thought as the metadata of the remote in git.

source

pub fn metadata_offline(&self) -> &Mutex<Metadata>

The metadata of the Storage::Current.

Can be thought as the metadata of our local state in git, that has not yet been committed (if it’s not clean).

source§

impl<P: Platform> Options<P>

source

pub async fn read( &self, resource: impl Into<String> + AsRef<str>, storage: Storage ) -> Result<Option<Arc<Vec<u8>>>, ApplicationError>

source

pub async fn write( &self, resource: impl Into<String> + AsRef<str>, storage: WriteStorage, data: Arc<Vec<u8>>, flush: bool ) -> Result<(), ApplicationError>

write_mtime and event_mtime only need to be actual values if storage is Storage::Public.

source

pub async fn delete( &self, resource: impl Into<String> + AsRef<str>, storage: Storage ) -> Result<(), ApplicationError>

source

pub async fn diff(&self) -> Result<Vec<MetadataChange>, ApplicationError>

The rough diff calculated by the difference between the metadata collections.

source

pub async fn sync_metadata( &self, storage: Storage ) -> Result<(), ApplicationError>

Sync the metadata to the disk.

Please take care and not keep the locks of Self::metadata or Self::metadata_offline when calling this.

Mappings:

source

pub async fn read_clean(&self) -> Result<Option<Arc<Vec<u8>>>, ApplicationError>

source

pub async fn write_clean( &self, data: impl Into<Vec<u8>>, flush: bool ) -> Result<(), ApplicationError>

source

pub async fn flush(&self) -> Result<(), ApplicationError>

source

pub async fn flush_out(&self) -> Result<(), ApplicationError>

Also clears the caches.

Auto Trait Implementations§

§

impl<P> !RefUnwindSafe for Options<P>

§

impl<P> Send for Options<P>

§

impl<P> Sync for Options<P>

§

impl<P> Unpin for Options<P>where P: Unpin,

§

impl<P> !UnwindSafe for Options<P>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V