Class RR::Session
In: lib/rubyrep/session.rb
Parent: Object

This class represents a rubyrep session. Creates and holds expensive objects like e. g. database connections.

Methods

Attributes

configuration  [RW]  The Configuration object provided to the initializer
proxies  [RW]  Hash to hold under either :left or :right the according Drb / direct DatabaseProxy

Public Class methods

Creates a new rubyrep session with the provided Configuration

Public Instance methods

Returns an array of table pairs of the configured tables. Refer to TableSpecResolver#resolve for a detailed description of the return value. If included_table_specs is provided (that is: not an empty array), it will be used instead of the configured table specs.

Set up the (proxied or direct) database connections to the specified database.

  • database: the target database (either :left or :right)

Returns the corresponding table in the other database.

  • db_arm: database of the given table (either :left or :right)
  • table: name of the table

If no corresponding table can be found, return the given table. Rationale: Support the case where a table was dropped from the configuration but there were still some unreplicated changes left.

Returns true if the specified database connection is not alive.

  • database: target database (either +:left+ or :right)

Disconnnects the specified database

  • database: the target database (either :left or :right)

Disconnects both database connections

Returns the "left" ActiveRecord / proxy database connection

Stores the "left" ActiveRecord /proxy database connection

Creates a hash of manual primary key names as can be specified with the Configuration options :primary_key_names or :auto_key_limit.

Returns the identified manual primary keys. This is a hash with

  • key: table_name
  • value: array of primary key names

Returns true if proxy connections are used

Refreshes both database connections

  • options: A options hash with the following settings
    • :forced: if true, always establish a new database connection

Refreshes the specified database connection. (I. e. reestablish if not active anymore.)

  • database: target database (either :left or :right)
  • options: A options hash with the following settings
    • :forced: if true, always establish a new database connection

Returns the "right" ActiveRecord / proxy database connection

Stores the "right" ActiveRecord / proxy database connection

Orders the array of table pairs as per primary key / foreign key relations of the tables. Returns the result. Only sorts if the configuration has set option :table_ordering. Refer to TableSpecResolver#resolve for a detailed description of the parameter and return value.

[Validate]