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()
staticcreate(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
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
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
done
PluginEventCallbackResult<never>
Callback with an optional error.
Returns
void
Implementation of
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
The bulk operations event containing schema, parent, and changes.
done
PluginEventCallbackPartialResult<BulkPersistResult>
Callback with the result or error.
Returns
void