Skip to content

TypeDBLiteReplicator

Defined in: libs/runtime/src/typedblite-replicator.ts:86

Replicates a local change log against a remote hub over HTTP.

replicateOnce drains in both directions and returns; replicateContinuously holds an SSE subscription open and pushes local work as it appears.

Constructors

Name Description
new TypeDBLiteReplicator() Creates a replicator for one store and one hub.

Methods

Name Description
replicateContinuously() Replicates continuously, until the session is canceled: holds a subscription to the hub open and pushes local changes as they appear.
replicateOnce() Replicates once in the requested direction, then returns.

new TypeDBLiteReplicator(log, hubUrl, pushIntervalMs?, headers?): TypeDBLiteReplicator

Defined in: libs/runtime/src/typedblite-replicator.ts:97

Creates a replicator for one store and one hub.

ChangeLog

The local store’s change log (db.changeLog).

string

The hub’s base URL.

number = 100

How often a continuous replication pushes local changes. Default 100.

() => Record<string, string> | Promise<Record<string, string>>

Headers for every request, called per request: a bearer token, for a hub that wants one.

TypeDBLiteReplicator

replicateContinuously(options, events?): ReplicationSession

Defined in: libs/runtime/src/typedblite-replicator.ts:182

Replicates continuously, until the session is canceled: holds a subscription to the hub open and pushes local changes as they appear. Being caught up reports ready and keeps the subscription running.

ReplicationOptions

ReplicationEvents = {}

ReplicationSession


replicateOnce(options): Promise<{ applied: number; conflicts: number; cursor: SyncCursor; }>

Defined in: libs/runtime/src/typedblite-replicator.ts:112

Replicates once in the requested direction, then returns. Resume from the returned cursor.

ReplicationOptions

Promise<{ applied: number; conflicts: number; cursor: SyncCursor; }>

if the hub does not answer within options.timeoutMs, or the request fails.

TypeDBLite is an independent open-source project, built on TypeDB with thanks. It is not affiliated with, sponsored by, or endorsed by TypeDB Ltd. Released under the MPL-2.0 license.