Options
All
  • Public
  • Public/Protected
  • All
Menu

A m-ld clone represents domain data to an app. This is the abstract interface implemented by a clone engine. It adheres to the m-ld data concurrency contract.

This abstract definition will be realised differently depending on the capabilities and idioms of the engine platform. It may offer additional data features, such as data persistence between re-starts; and API features such as language-specific convenience methods. Refer to the clone engine documentation to begin using it.

Hierarchy

  • MeldClone

Index

Properties

Methods

Properties

Readonly status

status: Observable<MeldStatus> & LiveStatus

The current and future status of a clone. This stream is hot and continuous, terminating when the clone closes (and can therefore be used to detect closure).

Methods

follow

  • follow(after?: undefined | number): Observable<MeldUpdate>
  • Follow updates from the domain. All data changes are signalled through the returned stream, strictly ordered according to the clone's logical clock. The updates can therefore be correctly used to maintain some other view of data, for example in a user interface or separate database.

    Parameters

    • Optional after: undefined | number

      updates will be emitted to the returned stream after (not including) the given tick count for the clone's logical clock. This tick count can be in the past or future. If the clone is unable to recall updates from a too-distant past, the stream will fail with Updates unavailable.

    Returns Observable<MeldUpdate>

    an observable stream of updates from the domain.

read

  • read(request: Read): Observable<Subject>
  • Actively reads data from the domain.

    An engine can legitimately offer a limited subset of the full json-rql syntax for the request parameter, and reject patterns that it does not support with an Unsupported pattern error.

    see

    Read

    see

    Subject

    Parameters

    • request: Read

      the declarative read description

    Returns Observable<Subject>

    an observable stream of subjects.

write

  • write(request: Subject | Group | Update): Promise<unknown>
  • Actively writes data to the domain. A write can be:

    • A Subject (any JSON object not a Read, Group or Update). Interpreted as data to be inserted.
    • A Group containing only a @graph key. Interpreted as containing the data to be inserted.
    • An Update with either an @insert, @delete, or both.

    An engine can legitimately offer a limited subset of the full json-rql syntax for the request parameter, and reject patterns that it does not support with an Unsupported pattern error.

    Parameters

    • request: Subject | Group | Update

      the declarative transaction description

    Returns Promise<unknown>

    final completion or error of the transaction.

Legend

  • Property
  • Method

Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld-spec - v0.6.3 Source code licensed MIT. Privacy policy