Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/earthstar/src/replica/replica-types.ts>IReplicaDocDriver

Earthstar is a tool for private, undiscoverable, offline-first networks.
Go to Latest
interface IReplicaDocDriver
implements IReplicaConfig
import { type IReplicaDocDriver } from "https://deno.land/x/earthstar@v10.0.0-alpha.4/src/replica/replica-types.ts";

A document driver provides low-level access to a replica's documents. ReplicaDocDrivers are not meant to be used directly by users; let the Replica talk to it for you.

Methods

isClosed(): boolean

Returns if the doc driver 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(): Promise<number>

The max local index used so far.

queryDocs(query: Query<string[]>): Promise<DocBase<string>[]>

Returns an array of Docs given a Query.

upsert<N extends FormatName, DocType extends DocBase<N>>(doc: DocType): Promise<DocType>

Add or update a signed document.

eraseExpiredDocs(): Promise<DocBase<string>[]>

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