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

x/earthstar/src/replica/doc_drivers/memory.ts>DocDriverMemory

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

An in-memory replica driver. Its contents will be lost when it is closed. Works everywhere.

Constructors

new
DocDriverMemory(share: ShareAddress)

Properties

_configKv: Record<string, string>
_isClosed: boolean
_maxLocalIndex: LocalIndex
docByPathAndAuthor: Map<string, DocBase<string>>
docsByPathNewestFirst: Map<Path, DocBase<string>[]>
latestDocsByPath: Map<string, DocBase<string>>

Methods

_getAllDocs(): Promise<DocBase<string>[]>
_getLatestDocs(): Promise<DocBase<string>[]>
close(erase: boolean)
deleteConfig(key: string): Promise<boolean>
getConfig(key: string): Promise<string | undefined>
isClosed(): boolean
listConfigKeys(): Promise<string[]>
queryDocs(queryToClean: Query<string[]>): Promise<DocBase<string>[]>
setConfig(key: string, value: string): Promise<void>
upsert<DocType extends DocBase<string>>(doc: DocType): Promise<DocType>