DataStoreTransport
A store-scoped transport. Every published document is immutable except device acknowledgements and append-only journal segments, which only their own device rewrites and only by extending them.
Import:
import { DataStoreTransport } from '@mnaoumov/obsidian-lib/data-stores/data-store-transport';Signature:
export class DataStoreTransportConstructor
new DataStoreTransport(params: DataStoreTransportConstructorParams)Creates a bounded vault transport.
Properties
| Property | Type | Description |
|---|---|---|
| adapter | DataAdapter | Vault adapter used by this transport. |
| extension | string | File extension for new documents. |
| maxFileBytes | number | Maximum encoded bytes per document. |
| root | string | Full vault-relative store root. |
Methods
| Method | Returns | Description |
|---|---|---|
| copyHistoryTo(target) | Promise<void> | Copies history byte for byte, preserving source files and refusing conflicting immutable destinations. Acknowledgements are local to each location and are not copied. |
| fits(value) | boolean | Tests the complete encoded size without writing. |
| list() | Promise<string[]> | Lists the store's files recursively, never leaving its folder. |
| measure(value) | number | Measures the complete encoded size of a new document without writing. |
| read(path) | Promise<unknown> | Reads complete fenced Markdown JSON or a version-one JSON envelope. Partial documents remain pending. |
| readSnapshot(path) | Promise<unknown> | Reads a snapshot only after every numbered chunk arrives and passes its SHA-256 check. |
| remove(path) | Promise<void> | Removes a document owned by the caller's device. |
| write(path, value) | Promise<void> | Writes a complete document, refusing an oversized write before adapter mutation. |
| writeAppendOnly(path, values) | Promise<void> | Publishes an append-only document: an occupied path is rewritten only when the new list strictly extends the stored one. A reader that sees an older copy sees a prefix, so it applies fewer entries and never a different one. |
| writeImmutable(path, value) | Promise<void> | Publishes an immutable document, accepting only byte-identical retries at an occupied path. |
| writeSnapshot(params) | Promise<void> | Publishes bounded immutable chunks before their manifest. Readers verify delivery completeness. |
Links to this page: