Class: Alephant::Publisher::WriteOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/alephant/publisher/write_operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, opts) ⇒ WriteOperation

Returns a new instance of WriteOperation.



11
12
13
14
15
16
17
18
19
20
# File 'lib/alephant/publisher/write_operation.rb', line 11

def initialize(msg, opts)
  @msg                = msg
  @data               = Support::Parser.new(opts[:msg_vary_path]).parse(msg)
  @options            = @data[:options]
  @options_hash       = Crimp.signature(@options)
  @renderer_id        = opts[:renderer_id]
  @sequencer_opts     = opts[:sequencer_opts]
  @batch_sequencer    = sequencer_for(@renderer_id, @options)
  @version            = @batch_sequencer.sequence_id_from(msg)
end

Instance Attribute Details

#batch_sequencerObject (readonly)

Returns the value of attribute batch_sequencer.



9
10
11
# File 'lib/alephant/publisher/write_operation.rb', line 9

def batch_sequencer
  @batch_sequencer
end

#dataObject (readonly)

Returns the value of attribute data.



9
10
11
# File 'lib/alephant/publisher/write_operation.rb', line 9

def data
  @data
end

#msgObject (readonly)

Returns the value of attribute msg.



9
10
11
# File 'lib/alephant/publisher/write_operation.rb', line 9

def msg
  @msg
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/alephant/publisher/write_operation.rb', line 9

def options
  @options
end

#options_hashObject (readonly)

Returns the value of attribute options_hash.



9
10
11
# File 'lib/alephant/publisher/write_operation.rb', line 9

def options_hash
  @options_hash
end

#versionObject (readonly)

Returns the value of attribute version.



9
10
11
# File 'lib/alephant/publisher/write_operation.rb', line 9

def version
  @version
end

Instance Method Details

#sequencer_for(id, options) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/alephant/publisher/write_operation.rb', line 22

def sequencer_for(id, options)
  Sequencer.create(
    @sequencer_opts[:table_name],
    sequencer_id_from(id, options),
    @sequencer_opts[:id_path]
  )
end