Module: RR::Replicators
- Defined in:
- lib/rubyrep/replicators/replicators.rb,
lib/rubyrep/replicators/two_way_replicator.rb
Overview
Replicators are classes that implement the replication policies. This module provides functionality to register replicators and access the list of registered replicators. Each Replicator must register itself with Replicators#register. Each Replicator must implement the following methods:
# Creates a new replicator (A replicator is used for one replication run only)
# * sync_helper: a SyncHelper object providing necessary information and functionalities
def initialize(sync_helper)
# Called to sync the provided difference.
# +difference+ is an instance of +ReplicationDifference+
def replicate_difference(difference)
# Provides default option for the replicator. Optional.
# Returns a hash with :key => value pairs.
def self.
Defined Under Namespace
Classes: TwoWayReplicator
Class Method Summary collapse
-
.configured_replicator(options) ⇒ Object
Returns the correct replicator class as per provided options hash.
-
.register(replicator_hash) ⇒ Object
Registers one or multiple replicators.
-
.replicators ⇒ Object
Returns a Hash of currently registered replicators.
Class Method Details
.configured_replicator(options) ⇒ Object
Returns the correct replicator class as per provided options hash
28 29 30 |
# File 'lib/rubyrep/replicators/replicators.rb', line 28 def self.configured_replicator() replicators[[:replicator]] end |
.register(replicator_hash) ⇒ Object
Registers one or multiple replicators. syncer_hash is a Hash with
key:: The adapter symbol as used to reference the replicator
value:: The class implementing the replicator
36 37 38 39 |
# File 'lib/rubyrep/replicators/replicators.rb', line 36 def self.register(replicator_hash) @replicators ||= {} @replicators.merge! replicator_hash end |
.replicators ⇒ Object
Returns a Hash of currently registered replicators. (Empty Hash if no replicators were defined.)
22 23 24 25 |
# File 'lib/rubyrep/replicators/replicators.rb', line 22 def self.replicators @replicators ||= {} @replicators end |