Class: Tem::Mr::Search::MapReduceJob::JobPart

Inherits:
Object
  • Object
show all
Defined in:
lib/tem_mr_search/map_reduce_job.rb

Overview

Base class for the Map-Reduce SECpack wrappers.

Direct Known Subclasses

Finalizer, Mapper, Reducer

Instance Method Summary collapse

Constructor Details

#initialize(secpack, job) ⇒ JobPart

Returns a new instance of JobPart.



65
66
67
68
69
70
71
# File 'lib/tem_mr_search/map_reduce_job.rb', line 65

def initialize(secpack, job)
  unless secpack.nil? or secpack.kind_of? Tem::SecPack
    secpack = Tem::SecPack.new_from_array secpack
  end
  @job = job
  @secpack = secpack
end

Instance Method Details

#bind(tem_pubek) ⇒ Object

Binds the wrapped SECpack to the given key.



74
75
76
# File 'lib/tem_mr_search/map_reduce_job.rb', line 74

def bind(tem_pubek)
  @secpack.bind tem_pubek, :_secret, :_plain if @secpack
end

#migrate(target_ecert, tem) ⇒ Object

Creates a copy of the job part by migrating the wrapped SECpack.

Args:

target_ecert:: the Endorsement Certificate of the target TEM
tem:: session to the TEM to be used for migration


83
84
85
86
# File 'lib/tem_mr_search/map_reduce_job.rb', line 83

def migrate(target_ecert, tem)
  migrated_secpack = tem.migrate @secpack, target_ecert
  self.class.new migrated_secpack, @job
end

#to_plain_objectObject



88
89
90
91
# File 'lib/tem_mr_search/map_reduce_job.rb', line 88

def to_plain_object
  return nil if @secpack.nil?
  @secpack.to_array
end