Class: OrientdbBinary::Protocols::RecordLoadAnswer

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/orientdb_binary/protocols/record_load.rb

Instance Method Summary collapse

Instance Method Details

#process(options) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/orientdb_binary/protocols/record_load.rb', line 40

def process(options)
  colls = self.collection.map do |record|
    opts = {
      :@rid => "##{options[:cluster_id]}:#{options[:cluster_position]}",
      :@version => record[:version],
      :@type => record[:record_type]
    }
    OrientdbBinary::Parser::Deserializer.new().deserialize(record[:content], opts)
  end

  prefetched = self.prefetched_records.map do |record|
    if record[:payload_status] > 0
      opts = {
        :@rid => "##{record[:cluster_id]}:#{record[:position]}",
        :@version => record[:version],
        :@type => record[:record_type]
      }
      OrientdbBinary::Parser::Deserializer.new().deserialize(record[:content], opts)
    end
  end

  {collection: colls, prefetched_records: prefetched.delete_if {|rec| !rec}}
end