pub struct SyncwebFolder { /* private fields */ }Implementations§
Source§impl SyncwebFolder
impl SyncwebFolder
pub fn new( doc: Doc, author: AuthorId, blob_store: BlobStore, docs_engine: DocsEngine, sync_mode: SyncMode, ) -> Self
Sourcepub async fn create(
docs_engine: DocsEngine,
blob_store: BlobStore,
sync_mode: SyncMode,
) -> Result<Self>
pub async fn create( docs_engine: DocsEngine, blob_store: BlobStore, sync_mode: SyncMode, ) -> Result<Self>
Create a new folder by allocating a namespace in the docs engine.
§Errors
Returns an error if the namespace cannot be created or the default author cannot be retrieved.
Sourcepub async fn accept(
docs_engine: DocsEngine,
blob_store: BlobStore,
namespace_id: NamespaceId,
) -> Result<Self>
pub async fn accept( docs_engine: DocsEngine, blob_store: BlobStore, namespace_id: NamespaceId, ) -> Result<Self>
Accept a locally available folder by namespace ID.
§Errors
Returns an error if the namespace cannot be opened.
Sourcepub async fn drop_namespace(&self) -> Result<()>
pub async fn drop_namespace(&self) -> Result<()>
Drop this folder’s namespace from the docs engine.
§Errors
Returns an error if the namespace cannot be dropped.
pub const fn namespace_id(&self) -> NamespaceId
pub const fn mode(&self) -> SyncMode
pub const fn doc(&self) -> &Doc
pub const fn docs_engine(&self) -> &DocsEngine
pub async fn grant(&self, node_id: PublicKey, capability: Capability)
pub async fn capability(&self, node_id: PublicKey) -> Option<Capability>
pub async fn can_write_as(&self, node_id: PublicKey) -> bool
Sourcepub async fn has_local(&self, hash: Hash) -> Result<bool>
pub async fn has_local(&self, hash: Hash) -> Result<bool>
Check whether a blob is complete in this folder’s local store.
§Errors
Returns an error if the blob store cannot be queried.
Sourcepub async fn create_snapshot(
&self,
description: Option<String>,
) -> Result<Snapshot>
pub async fn create_snapshot( &self, description: Option<String>, ) -> Result<Snapshot>
Create a content-addressed snapshot of this folder.
§Errors
Returns an error if document entries cannot be read or referenced blobs are unavailable.
Sourcepub async fn restore_snapshot(&self, snapshot: &Snapshot) -> Result<()>
pub async fn restore_snapshot(&self, snapshot: &Snapshot) -> Result<()>
Restore this folder’s document entries from a snapshot.
§Errors
Returns an error if the snapshot belongs to another folder or content is unavailable.
Sourcepub async fn list_snapshots(&self) -> Result<Vec<Snapshot>>
pub async fn list_snapshots(&self) -> Result<Vec<Snapshot>>
List snapshots stored in the local blob store.
§Errors
Returns an error if snapshot manifests cannot be read.
Sourcepub async fn delete_snapshot(&self, snapshot_id: SnapshotId) -> Result<()>
pub async fn delete_snapshot(&self, snapshot_id: SnapshotId) -> Result<()>
Delete a snapshot and release its pins.
§Errors
Returns an error if the snapshot cannot be found or pins cannot be released.
Sourcepub fn diff_snapshots(
&self,
first: &Snapshot,
second: &Snapshot,
) -> Result<SnapshotDiff>
pub fn diff_snapshots( &self, first: &Snapshot, second: &Snapshot, ) -> Result<SnapshotDiff>
Sourcepub async fn set_blob(
&self,
key: impl AsRef<[u8]>,
value: impl AsRef<[u8]>,
) -> Result<Hash>
pub async fn set_blob( &self, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>, ) -> Result<Hash>
§Errors
Returns an error if the blob fails to be stored or set.
Sourcepub async fn set_blob_ref(
&self,
key: impl AsRef<[u8]>,
hash: Hash,
size: u64,
) -> Result<()>
pub async fn set_blob_ref( &self, key: impl AsRef<[u8]>, hash: Hash, size: u64, ) -> Result<()>
Store an existing blob reference in this folder.
§Errors
Returns an error if the folder is read-only, the blob is unavailable, or the document entry cannot be written.
Sourcepub async fn delete_entry(&self, key: impl AsRef<[u8]>) -> Result<()>
pub async fn delete_entry(&self, key: impl AsRef<[u8]>) -> Result<()>
Delete a folder entry.
§Errors
Returns an error if the folder is read-only or the document entry cannot be deleted.
Sourcepub async fn ticket(
&self,
endpoint: EndpointAddr,
writable: bool,
) -> Result<DocTicket>
pub async fn ticket( &self, endpoint: EndpointAddr, writable: bool, ) -> Result<DocTicket>
§Errors
Returns an error if the folder ticket cannot be created.
Sourcepub async fn publish_blob(
&self,
endpoint: EndpointAddr,
hash: Hash,
) -> Result<BlobTicket>
pub async fn publish_blob( &self, endpoint: EndpointAddr, hash: Hash, ) -> Result<BlobTicket>
Create an unauthenticated ticket for a blob in this folder and pin it while it is publicly shared.
§Errors
Returns an error if the blob is unavailable or cannot be pinned.
Trait Implementations§
Source§impl Clone for SyncwebFolder
impl Clone for SyncwebFolder
Source§fn clone(&self) -> SyncwebFolder
fn clone(&self) -> SyncwebFolder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl FolderLike for SyncwebFolder
impl FolderLike for SyncwebFolder
fn namespace_id(&self) -> String
fn label(&self) -> String
fn kind(&self) -> &'static str
fn path(&self) -> Option<&Path>
fn list_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<EntryLike>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for SyncwebFolder
impl !UnwindSafe for SyncwebFolder
impl Freeze for SyncwebFolder
impl Send for SyncwebFolder
impl Sync for SyncwebFolder
impl Unpin for SyncwebFolder
impl UnsafeUnpin for SyncwebFolder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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