pub struct Client<C = BoxedConnector<RpcService>> { /* private fields */ }
rpc
only.Expand description
Iroh docs client.
Implementations§
Source§impl<C: Connector<RpcService>> Client<C>
impl<C: Connector<RpcService>> Client<C>
Sourcepub fn new(rpc: RpcClient<RpcService, C>) -> Self
pub fn new(rpc: RpcClient<RpcService, C>) -> Self
Creates a new docs client.
Returns an authors client.
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<C>>
pub async fn import_namespace(&self, capability: Capability) -> Result<Doc<C>>
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<C>>
pub async fn import(&self, ticket: DocTicket) -> Result<Doc<C>>
Imports a document from a ticket and joins all peers in the ticket.
Sourcepub async fn import_and_subscribe(
&self,
ticket: DocTicket,
) -> Result<(Doc<C>, impl Stream<Item = Result<LiveEvent>>)>
pub async fn import_and_subscribe( &self, ticket: DocTicket, ) -> Result<(Doc<C>, 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)>>>
pub async fn list( &self, ) -> Result<impl Stream<Item = Result<(NamespaceId, CapabilityKind)>>>
Lists all documents.