import { Replica } from "https://deno.land/x/earthstar@v9.3.3/src/replica/replica.ts";
A replica of a share's data, used to read, write, and synchronise data to.
Should be closed using the close
method when no longer being used.
const myReplica = new Replica("+a.a123", Es4Validatior, new ReplicaDriverMemory());
Constructors
Properties
Methods
Closes the replica, preventing new documents from being ingested or events being emitted.
Any methods called after closing will return ReplicaIsClosedError
.
Returns all documents, including historical versions of documents by other identities.
Returns all versions of a document by different authors from a specific path.
Returns the most recently written version of a document at a path.
Overwrite every document from this author, including history versions, with an empty doc.
Returns an array of all unique authors of documents returned by a given query.
Returns an array of docs for a given query. ``` const myQuery = { filter: { pathEndsWith: ".txt" }, limit: 5, };
const firstFiveTextDocs = await myReplica.queryDocs(myQuery);
```
Returns an array of all unique paths of documents returned by a given query.
Adds a new document to the replica. If a document signed by the same identity exists at the same path, it will be overwritten.