routier-collection


routier-collection / core/src / ReplicationDbPlugin

Class: ReplicationDbPlugin

Defined in: core/src/plugins/replication/ReplicationDbPlugin.ts:7

Interface for a database plugin, which provides query, destroy, and bulk operations.

Implements

Properties

plugins

plugins: ReplicationPluginOptions

Defined in: core/src/plugins/replication/ReplicationDbPlugin.ts:9

Methods

create()

static create(plugins): ReplicationDbPlugin

Defined in: core/src/plugins/replication/ReplicationDbPlugin.ts:22

Creates a new DbPluginReplicator that coordinates operations between a source database and its replicas.

Parameters

plugins

ReplicationPluginOptions

Returns

ReplicationDbPlugin

A new DbPluginReplicator instance that manages the source-replica relationship


query()

query<TEntity, TShape>(event, done): void

Defined in: core/src/plugins/replication/ReplicationDbPlugin.ts:29

Will query the read plugin if there is one, otherwise the source plugin will be queried

Type Parameters

TEntity

TEntity extends object

TShape

TShape extends unknown = TEntity

Parameters

event

DbPluginQueryEvent<TEntity, TShape>

done

PluginEventCallbackResult<ITranslatedValue<TShape>>

Callback with the result or error. The result must be wrapped in an ITranslatedValue to allow the datastore to iterate over results (for grouped queries) and determine if change tracking should be enabled.

Returns

void

Implementation of

IDbPlugin.query


destroy()

destroy(event, done): void

Defined in: core/src/plugins/replication/ReplicationDbPlugin.ts:40

Destroys or cleans up the plugin, closing connections or freeing resources.

Parameters

event

DbPluginEvent

done

PluginEventCallbackResult<never>

Callback with an optional error.

Returns

void

Implementation of

IDbPlugin.destroy


bulkPersist()

bulkPersist(event, done): void

Defined in: core/src/plugins/replication/ReplicationDbPlugin.ts:66

Executes bulk operations (add, update, remove) on the database.

Parameters

event

DbPluginBulkPersistEvent

The bulk operations event containing schema, parent, and changes.

done

PluginEventCallbackPartialResult<BulkPersistResult>

Callback with the result or error.

Returns

void

Implementation of

IDbPlugin.bulkPersist