pub struct Options<P: Platform> { /* private fields */ }
Implementations§
source§impl<P: Platform> Options<P>
impl<P: Platform> Options<P>
pub fn arc(self) -> Arc<Self>
pub fn with_startup_duration(self, startup_timeout: Duration) -> Self
pub fn with_sync_interval(self, sync_interval: Duration) -> Self
pub fn with_periodic_interval(self, flush_interval: Duration) -> Self
pub async fn with_file_cache_max_size(self, max_size: usize) -> Self
pub fn with_no_public_storage(self) -> Self
pub fn sync_interval(&self) -> Duration
pub fn startup_timeout(&self) -> Duration
pub fn public_storage_disabled(&self) -> bool
sourcepub fn metadata(&self) -> &Mutex<Metadata>
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.
sourcepub fn metadata_offline(&self) -> &Mutex<Metadata>
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>
impl<P: Platform> Options<P>
pub async fn read( &self, resource: impl Into<String> + AsRef<str>, storage: Storage ) -> Result<Option<Arc<Vec<u8>>>, ApplicationError>
sourcepub async fn write(
&self,
resource: impl Into<String> + AsRef<str>,
storage: WriteStorage,
data: Arc<Vec<u8>>,
flush: bool
) -> Result<(), ApplicationError>
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
.
pub async fn delete( &self, resource: impl Into<String> + AsRef<str>, storage: Storage ) -> Result<(), ApplicationError>
sourcepub async fn diff(&self) -> Result<Vec<MetadataChange>, ApplicationError>
pub async fn diff(&self) -> Result<Vec<MetadataChange>, ApplicationError>
The rough diff calculated by the difference between the metadata collections.
sourcepub async fn sync_metadata(
&self,
storage: Storage
) -> Result<(), ApplicationError>
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:
Storage::Public
syncsSelf::metadata
Storage::Current
syncsSelf::metadata_offline
Storage::Meta
returnsOk(())
without doing anything.
pub async fn read_clean(&self) -> Result<Option<Arc<Vec<u8>>>, ApplicationError>
pub async fn write_clean( &self, data: impl Into<Vec<u8>>, flush: bool ) -> Result<(), ApplicationError>
pub async fn flush(&self) -> Result<(), ApplicationError>
sourcepub async fn flush_out(&self) -> Result<(), ApplicationError>
pub async fn flush_out(&self) -> Result<(), ApplicationError>
Also clears the caches.