pub struct Docs { /* private fields */ }
Expand description
Docs protocol.
Implementations§
Methods from Deref<Target = DocsApi>§
Sourcepub fn listen(&self, endpoint: Endpoint) -> Result<AbortOnDropHandle<()>>
pub fn listen(&self, endpoint: Endpoint) -> Result<AbortOnDropHandle<()>>
Listen for incoming RPC connections
Creates a new document author.
You likely want to save the returned AuthorId
somewhere so that you can use this author
again.
If you need only a single author, use Self::author_default
.
Returns the default document author of this node.
On persistent nodes, the author is created on first start and its public key is saved in the data directory.
The default author can be set with Self::author_set_default
.
Sets the node-wide default author.
If the author does not exist, an error is returned.
On a persistent node, the author id will be saved to a file in the data directory and reloaded after a restart.
Lists document authors for which we have a secret key.
It’s only possible to create writes from authors that we have the secret key of.
Exports the given author.
Warning: The Author
struct contains sensitive data.
Imports the given author.
Warning: The Author
struct contains sensitive data.
Deletes the given author by id.
Warning: This permanently removes this author.
Returns an error if attempting to delete the default author.
Sourcepub async fn drop_doc(&self, doc_id: NamespaceId) -> Result<()>
pub async fn drop_doc(&self, doc_id: NamespaceId) -> Result<()>
Deletes a document from the local node.
This is a destructive operation. Both the document secret key and all entries in the document will be permanently deleted from the node’s storage. Content blobs will be deleted through garbage collection unless they are referenced from another document or tag.
Sourcepub async fn import_namespace(&self, capability: Capability) -> Result<Doc>
pub async fn import_namespace(&self, capability: Capability) -> Result<Doc>
Imports a document from a namespace capability.
This does not start sync automatically. Use Doc::start_sync
to start sync.
Sourcepub async fn import(&self, ticket: DocTicket) -> Result<Doc>
pub async fn import(&self, ticket: DocTicket) -> Result<Doc>
Imports a document from a ticket and joins all peers in the ticket.
Sourcepub async fn import_and_subscribe(
&self,
ticket: DocTicket,
) -> Result<(Doc, impl Stream<Item = Result<LiveEvent>>)>
pub async fn import_and_subscribe( &self, ticket: DocTicket, ) -> Result<(Doc, impl Stream<Item = Result<LiveEvent>>)>
Imports a document from a ticket, creates a subscription stream and joins all peers in the ticket.
Returns the Doc
and a [Stream
] of LiveEvent
s.
The subscription stream is created before the sync is started, so the first call to this method after starting the node is guaranteed to not miss any sync events.
Sourcepub async fn list(
&self,
) -> Result<impl Stream<Item = Result<(NamespaceId, CapabilityKind)>> + Unpin + Send + 'static>
pub async fn list( &self, ) -> Result<impl Stream<Item = Result<(NamespaceId, CapabilityKind)>> + Unpin + Send + 'static>
Lists all documents.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Docs
impl !RefUnwindSafe for Docs
impl Send for Docs
impl Sync for Docs
impl Unpin for Docs
impl !UnwindSafe for Docs
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<P> DynProtocolHandler for Pwhere
P: ProtocolHandler,
impl<P> DynProtocolHandler for Pwhere
P: ProtocolHandler,
§fn accept(
&self,
connection: Connection,
) -> Pin<Box<dyn Future<Output = Result<(), AcceptError>> + Send + '_>>
fn accept( &self, connection: Connection, ) -> Pin<Box<dyn Future<Output = Result<(), AcceptError>> + Send + '_>>
ProtocolHandler::accept
].