routier-collection


routier-collection / core/src / OptimisticReplicationDbPlugin

Class: OptimisticReplicationDbPlugin

Defined in: core/src/plugins/replication/OptimisticReplicationDbPlugin.ts:30

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

Implements

Constructors

constructor()

new OptimisticReplicationDbPlugin(plugins): OptimisticReplicationDbPlugin

Defined in: core/src/plugins/replication/OptimisticReplicationDbPlugin.ts:39

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

Parameters

plugins

OptimisticReplicationPluginOptions

Configuration object containing the source, read, and replica database plugins

  • plugins.source - The primary database plugin that will receive all operations first
  • plugins.read - The read-optimized plugin (typically a memory plugin) used for fast queries
  • plugins.replicas - Additional database plugins that will replicate operations from the source

Returns

OptimisticReplicationDbPlugin

A new OptimisticReplicationDbPlugin instance that manages the source-replica relationship

Methods

query()

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

Defined in: core/src/plugins/replication/OptimisticReplicationDbPlugin.ts:52

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/OptimisticReplicationDbPlugin.ts:151

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/OptimisticReplicationDbPlugin.ts:176

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


This site uses Just the Docs, a documentation theme for Jekyll.