Skip to main content
Module

x/earthstar/mod.ts>IReplicaDriver

A specification and Javascript library for building online tools you can truly call your own.
Go to Latest
interface IReplicaDriver
implements IReplicaConfig
Re-export
import { type IReplicaDriver } from "https://deno.land/x/earthstar@v9.3.3/mod.ts";

A replica driver provides low-level access to actual replica and is used by IReplica to actually load and save data. ReplicaDrivers are not meant to be used directly by users; let the Replica talk to it for you.

Methods

isClosed(): boolean

Returns if the replica has been closed or not.

close(erase: boolean): Promise<void>

Close the replica Driver. The replica will call this. You cannot call close() if the replica is already closed (it will throw a ReplicaIsClosedError). If erase, actually delete and forget data locally. Erase defaults to false if not provided.

getMaxLocalIndex(): number

The max local index used so far.

queryDocs(query: Query): Promise<Doc[]>

Returns an array of Docs given a Query.

upsert(doc: Doc): Promise<Doc>

Add or update a signed document.

eraseExpiredDocs(): Promise<Path[]>

Erase all expired docs from the replica permanently, leaving no trace of the documents. Returns the paths of the expired documents.