[]
| Name | Type |
|---|---|
S |
unknown |
T |
unknown |
Db<S, T>
↳ MemoryDb
• new MemoryDb<S, T>()
| Name | Type |
|---|---|
S |
unknown |
T |
unknown |
▸ close(): Promise<void>
Closes the database connection.
Promise<void>
A promise that resolves when the database is closed.
▸ commitOp(id, op, document): Promise<boolean>
Commits an operation to the database.
| Name | Type |
|---|---|
id |
string |
op |
IOp<T> |
document |
IDocument |
Promise<boolean>
A promise resolving to true if the operation was committed, false otherwise.
▸ commitSnapshot(roomId, snapshot): Promise<boolean>
Commits a snapshot to the database.
| Name | Type |
|---|---|
roomId |
string |
snapshot |
ICommitSnapshot<S> |
Promise<boolean>
A promise resolving to true if the snapshot was committed, false otherwise.
▸ 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>
▸ getDocument(roomId): Promise<undefined | IDocument>
Retrieves document information by ID.
| Name | Type |
|---|---|
roomId |
string |
Promise<undefined | IDocument>
A promise resolving to the document info or undefined/null if not found.
▸ getFragment(roomId, fragmentId): Promise<undefined | S>
Retrieves a specific fragment of a document by ID.
| Name | Type |
|---|---|
roomId |
string |
fragmentId |
string |
Promise<undefined | S>
A promise resolving to the fragment data or undefined/null if not found.
▸ getFragments(roomId): Promise<{ [key: string]: S; }>
Retrieves multiple fragments of a document by ID.
| Name | Type |
|---|---|
roomId |
string |
Promise<{ [key: string]: S; }>
} A promise resolving to an object mapping fragment IDs to their data.
▸ getOps(roomId, fromVersion, toVersion?): Promise<IOp<T>[]>
Retrieves operations between two versions (inclusive of 'from', exclusive of 'to').
| Name | Type |
|---|---|
roomId |
string |
fromVersion |
number |
toVersion? |
number |
Promise<IOp<T>[]>
A promise resolving to an array of operations.
▸ getSnapshot(roomId): Promise<undefined | ISnapshot<S>>
Retrieves the snapshot of a document by ID.
| Name | Type |
|---|---|
roomId |
string |
Promise<undefined | ISnapshot<S>>
A promise resolving to the snapshot or undefined/null if not found.