API reference / @docmentis/udoc-server / DirectoryDocumentStore
Class: DirectoryDocumentStore
A DocumentStore over a directory: one directory per document, named by its id, holding its original, its checkpoints and its edit log.
Implements
Constructors
Constructor
new DirectoryDocumentStore(directory): DirectoryDocumentStore;Parameters
| Parameter | Type |
|---|---|
directory | string |
Methods
put()
put(id, document): Promise<void>;Keep a new document as id. Refused when id is already kept.
Parameters
| Parameter | Type |
|---|---|
id | string |
document | KeptDocument |
Implementation of
getOriginal()
getOriginal(id): Promise<Original | undefined>;Document id's original, or undefined when nothing is kept.
Parameters
| Parameter | Type |
|---|---|
id | string |
Implementation of
getCheckpoint()
getCheckpoint(id): Promise<Uint8Array<ArrayBufferLike> | undefined>;Document id's latest checkpoint, or undefined when nothing is kept.
Parameters
| Parameter | Type |
|---|---|
id | string |
Implementation of
putCheckpoint()
putCheckpoint(
id,
version,
checkpoint
): Promise<void>;Keep checkpoint, the udoc package of document id's checkpoint version, beside the earlier ones, as its latest; then forget each opaque part and blob kept beside them that it holds. Refused when no checkpoint is kept as id, or version is kept already.
Parameters
| Parameter | Type |
|---|---|
id | string |
version | number |
checkpoint | Uint8Array |
Implementation of
getDescription()
getDescription(id): Promise<PackageDescription | undefined>;Document id's package description, from its latest checkpoint, or undefined when it has none.
Parameters
| Parameter | Type |
|---|---|
id | string |
Implementation of
getPart()
getPart(
id,
kinds,
partId
): Promise<Uint8Array<ArrayBufferLike> | undefined>;One part of document id, as its JSON deflated — raw DEFLATE (RFC 1951) — by its route: kinds, its kind in kebab-case and plural, and partId, its id's key. Its latest checkpoint's, or an opaque part an edit brought, kept beside the checkpoints, or, held by neither, the newest earlier checkpoint's. undefined when there is no such part, or no checkpoint.
Parameters
| Parameter | Type |
|---|---|
id | string |
kinds | string |
partId | string |
Implementation of
getBlob()
getBlob(id, key): Promise<Uint8Array<ArrayBufferLike> | undefined>;One blob of document id, deflated, by its key — found as a part is — or undefined when it has none.
Parameters
| Parameter | Type |
|---|---|
id | string |
key | string |
Implementation of
putOpaqueParts()
putOpaqueParts(id, parts): Promise<void>;Keep every part and blob of parts — a client's opaque parts, a zip in a package's own layout — beside document id's checkpoints, by route. What is kept already stays as it was. Refused when nothing is kept as id.
Parameters
| Parameter | Type |
|---|---|
id | string |
parts | Uint8Array |
Implementation of
getLog()
getLog(id): Promise<Uint8Array<ArrayBufferLike> | undefined>;Document id's edit log, or undefined when it has none: the one kept, or, for a document checkpointed before any edit was kept, its latest checkpoint's own.
Parameters
| Parameter | Type |
|---|---|
id | string |
Implementation of
putLog()
putLog(id, log): Promise<void>;Keep log as document id's edit log, in place of the one kept — whole or not at all. Refused when nothing is kept as id.
Parameters
| Parameter | Type |
|---|---|
id | string |
log | Uint8Array |
Implementation of
delete()
delete(id): Promise<boolean>;Forget document id; answers whether anything was kept.
Parameters
| Parameter | Type |
|---|---|
id | string |