[]
Abstract base class implementing the database adapter interface.
| Name | Description |
|---|---|
S |
The type of snapshot data. |
T |
The type of operation data. |
Db
↳ MemoryDb
IDatabaseAdapter<S, T>• new Db<S, T>()
| Name |
|---|
S |
T |
▸ Abstract close(): Promise<void>
Closes the database connection.
Promise<void>
▸ Abstract commitOp(id, op, document, options?): Promise<boolean>
Commits an operation to the database.
| Name | Type |
|---|---|
id |
string |
op |
IOp<T> |
document |
IDocument |
options? |
unknown |
Promise<boolean>
▸ Abstract commitSnapshot(id, snapshot, options?): Promise<boolean>
Commits a snapshot to the database.
| Name | Type |
|---|---|
id |
string |
snapshot |
ICommitSnapshot<S> |
options? |
unknown |
Promise<boolean>
IDatabaseAdapter.commitSnapshot
▸ getCommittedOpVersion(id, to, op): Promise<null | number>
Retrieves the committed version of an operation if it exists.
| Name | Type |
|---|---|
id |
string |
to |
number |
op |
IOp<object> |
Promise<null | number>
IDatabaseAdapter.getCommittedOpVersion
▸ Abstract getDocument(id, options?): Promise<null | IDocument>
Retrieves document information by ID.
| Name | Type |
|---|---|
id |
string |
options? |
unknown |
Promise<null | IDocument>
▸ Abstract getFragment(id, fragmentId, options?): Promise<null | { data: null | S ; version: number }>
Retrieves a specific fragment of a document by ID.
| Name | Type |
|---|---|
id |
string |
fragmentId |
string |
options? |
unknown |
Promise<null | { data: null | S ; version: number }>
▸ Abstract getOps(id, from, to?, options?): Promise<IOp<T>[]>
Retrieves operations between two versions (inclusive of 'from', exclusive of 'to').
| Name | Type |
|---|---|
id |
string |
from |
number |
to? |
number |
options? |
unknown |
Promise<IOp<T>[]>
▸ Abstract getSnapshot(id, options?): Promise<null | ISnapshot<S>>
Retrieves the snapshot of a document by ID.
| Name | Type |
|---|---|
id |
string |
options? |
unknown |
Promise<null | ISnapshot<S>>