class Oplogjam::Command

Attributes

command[R]
h[R]
id[R]
namespace[R]
ns[R]
o[R]
ts[R]

Public Class Methods

from(bson) click to toggle source
# File lib/oplogjam/command.rb, line 7
def self.from(bson)
  h = bson.fetch(H)
  ts = bson.fetch(TS)
  ns = bson.fetch(NS)
  o = bson.fetch(O)

  new(h, ts, ns, o)
rescue KeyError => e
  raise InvalidCommand, "missing field: #{e}"
end
new(h, ts, ns, o) click to toggle source
# File lib/oplogjam/command.rb, line 18
def initialize(h, ts, ns, o)
  @h = Integer(h)
  @ts = Oplogjam::Timestamp(ts)
  @ns = String(ns)
  @o = Oplogjam::Document(o)
end

Public Instance Methods

==(other) click to toggle source
# File lib/oplogjam/command.rb, line 33
def ==(other)
  return false unless other.is_a?(Command)

  id == other.id
end
apply(_mapping) click to toggle source
# File lib/oplogjam/command.rb, line 39
def apply(_mapping); end
timestamp() click to toggle source
# File lib/oplogjam/command.rb, line 29
def timestamp
  Time.at(ts.seconds, ts.increment)
end