[]
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
>
A promise that resolves when the database is closed.
▸ 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
>
A promise resolving to true if the operation was committed, false otherwise.
▸ Abstract
commitSnapshot(id
, snapshot
, options?
): Promise
<boolean
>
Commits a snapshot to the database.
Name | Type |
---|---|
id |
string |
snapshot |
ICommitSnapshot <S > |
options? |
unknown |
Promise
<boolean
>
A promise resolving to true if the snapshot was committed, false otherwise.
IDatabaseAdapter.commitSnapshot
▸ getCommittedOpVersion(id
, to
, op
): Promise
<undefined
| number
>
Retrieves the committed version of an operation if it exists.
Name | Type |
---|---|
id |
string |
to |
number |
op |
IOp <object > |
Promise
<undefined
| number
>
IDatabaseAdapter.getCommittedOpVersion
▸ Abstract
getDocument(id
, options?
): Promise
<undefined
| null
| IDocument
>
Retrieves document information by ID.
Name | Type |
---|---|
id |
string |
options? |
unknown |
Promise
<undefined
| null
| IDocument
>
A promise resolving to the document info or undefined/null if not found.
▸ Abstract
getFragment(id
, fragmentId
, options?
): Promise
<undefined
| null
| S
>
Retrieves a specific fragment of a document by ID.
Name | Type |
---|---|
id |
string |
fragmentId |
string |
options? |
unknown |
Promise
<undefined
| null
| S
>
A promise resolving to the fragment data or undefined/null if not found.
▸ Abstract
getFragments(id
, fragmentIds?
, options?
): Promise
<{ [id: string]
: S
; }>
Retrieves multiple fragments of a document by ID.
Name | Type |
---|---|
id |
string |
fragmentIds? |
string [] |
options? |
unknown |
Promise
<{ [id: string]
: S
; }>
} A promise resolving to an object mapping fragment IDs to their data.
▸ 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
>[]>
A promise resolving to an array of operations.
▸ Abstract
getSnapshot(id
, options?
): Promise
<undefined
| null
| ISnapshot
<S
>>
Retrieves the snapshot of a document by ID.
Name | Type |
---|---|
id |
string |
options? |
unknown |
Promise
<undefined
| null
| ISnapshot
<S
>>
A promise resolving to the snapshot or undefined/null if not found.