Module: Oplogjam

Defined in:
lib/oplogjam.rb,
lib/oplogjam/noop.rb,
lib/oplogjam/oplog.rb,
lib/oplogjam/delete.rb,
lib/oplogjam/insert.rb,
lib/oplogjam/schema.rb,
lib/oplogjam/update.rb,
lib/oplogjam/command.rb,
lib/oplogjam/apply_ops.rb,
lib/oplogjam/operation.rb,
lib/oplogjam/sanitizer.rb,
lib/oplogjam/operators/set.rb,
lib/oplogjam/operators/unset.rb,
lib/oplogjam/operators/assignment.rb,
lib/oplogjam/operators/unset_field.rb,
lib/oplogjam/operators/unset_index.rb,
lib/oplogjam/operators/intermediate.rb,
lib/oplogjam/operators/field_assignment.rb,
lib/oplogjam/operators/index_assignment.rb,
lib/oplogjam/operators/intermediate_field.rb,
lib/oplogjam/operators/intermediate_index.rb

Defined Under Namespace

Modules: Operators, Sanitizer Classes: ApplyOps, Command, Delete, Insert, Noop, Operation, Oplog, Schema, Update

Constant Summary collapse

APPLY_OPS =

Operation types

'applyOps'.freeze
C =
'c'.freeze
D =
'd'.freeze
U =
'u'.freeze
I =
'i'.freeze
N =
'n'.freeze
UNKNOWN =
'unknown'.freeze
H =

Operation fields

'h'.freeze
MSG =
'msg'.freeze
NS =
'ns'.freeze
O =
'o'.freeze
O2 =
'o2'.freeze
OP =
'op'.freeze
TS =
'ts'.freeze
ID =

BSON fields

'_id'.freeze
SET =
'$set'.freeze
UNSET =
'$unset'.freeze
FIELD_SEPARATOR =
'.'.freeze
NUMERIC_INDEX =
/\A\d+\z/
ARRAY_TYPE =

SQL

'array'.freeze
EMPTY_OBJECT =
Sequel.pg_jsonb({}.freeze)
NULL =
'null'.freeze
TABLE =
'table'.freeze
SCHEMA =
'schema'.freeze
PUBLIC =
'public'.freeze
UPDATE_COLUMN =

Recursive updates

proc { |column, node| node.update(column) }
LOCAL =

Database & collection names

'local'.freeze
OPLOG =
'oplog.rs'.freeze
InvalidNoop =
Class.new(ArgumentError)
InvalidDelete =
Class.new(ArgumentError)
InvalidInsert =
Class.new(ArgumentError)
InvalidUpdate =
Class.new(ArgumentError)
InvalidCommand =
Class.new(ArgumentError)
InvalidApplyOps =
Class.new(ArgumentError)
InvalidOperation =
Class.new(ArgumentError)

Class Method Summary collapse

Class Method Details

.Document(document) ⇒ Object

Raises:

  • (TypeError)


59
60
61
62
63
# File 'lib/oplogjam.rb', line 59

def self.Document(document)
  raise TypeError, "#{document} is not a BSON Document" unless document.is_a?(BSON::Document)

  document
end

.Timestamp(ts) ⇒ Object

Strict type coercion for BSON types

Raises:

  • (TypeError)


53
54
55
56
57
# File 'lib/oplogjam.rb', line 53

def self.Timestamp(ts)
  raise TypeError, "#{ts} is not a BSON Timestamp" unless ts.is_a?(BSON::Timestamp)

  ts
end