Class: Flydata::Source::Sync
- Defined in:
- lib/flydata/source/sync.rb
Direct Known Subclasses
Flydata::SourceFile::Sync, Flydata::SourceMysql::Sync, Flydata::SourceOracle::Sync, Flydata::SourcePostgresql::Sync
Constant Summary collapse
- SOURCE_TABLE_LISTS_KEYS =
Public Interface: Table lists
Returns lists of tables in a hash. The following lists will be returned
"tables" : An array of tables currently in sync (valid tables append-only & valid tables full-sync) "new_tables" : An array of tables for which no generate_table_ddl has been run yet "invalid_tables" : An array of tables that had an issue starting sync "tables_append_only" : An array of tables whose sync type is append-only "invalid_tables_append_only" : An array of append-only tables that had an issue starting sync
%w( tables new_tables invalid_tables tables_append_only invalid_tables_append_only )
Class Method Summary collapse
-
.inherited(child_class) ⇒ Object
subclass has to define these constant variables SOURCE_PREFERENCE_NAME = 'xxxxx_data_entry_preference'.
Instance Method Summary collapse
-
#data_servers ⇒ Object
Public Interface: Data Servers.
-
#forwarder ⇒ Object
Public Interface: Forwarder.
-
#setup ⇒ Object
Public Interface: Set up data source.
-
#supported? ⇒ Boolean
Public Interface: Tells if the source support sync or not.
- #table_lists ⇒ Object
Methods inherited from Component
Constructor Details
This class inherits a constructor from Flydata::Source::Component
Class Method Details
Instance Method Details
#data_servers ⇒ Object
Public Interface: Data Servers
Returns a comma separated list of data servers to which the agent sends data
58 59 60 |
# File 'lib/flydata/source/sync.rb', line 58 def data_servers de[self.class::SOURCE_PREFERENCE_NAME]['data_servers'] end |
#forwarder ⇒ Object
Public Interface: Forwarder
Returns a forwarder type in string. Values are 'tcpforwarder' or 'sslforwarder'.
65 66 67 |
# File 'lib/flydata/source/sync.rb', line 65 def forwarder de[self.class::SOURCE_PREFERENCE_NAME]['forwarder'] end |
#setup ⇒ Object
Public Interface: Set up data source
Called right after the source instance is created. Perform one-time setup which is necessary to initialize the source for sync (and sync only)
Raises exception when the source does not support sync
23 24 25 26 27 |
# File 'lib/flydata/source/sync.rb', line 23 def setup prefs = de[self.class::SOURCE_PREFERENCE_NAME] setup_table_prefs(prefs) setup_pk_override_prefs(prefs) end |
#supported? ⇒ Boolean
Public Interface: Tells if the source support sync or not
Returns true if the source supports sync. No otherwise.
32 33 34 |
# File 'lib/flydata/source/sync.rb', line 32 def supported? raise UnsupportedSourceError, "subclass must implement" end |
#table_lists ⇒ Object
51 52 53 |
# File 'lib/flydata/source/sync.rb', line 51 def table_lists de[self.class::SOURCE_PREFERENCE_NAME].select {|key, value| SOURCE_TABLE_LISTS_KEYS.include?(key)} end |