Class: XRBP::NodeStore::DB

Inherits:
Object
  • Object
show all
Includes:
Enumerable, EventEmitter, Parser
Defined in:
lib/xrbp/nodestore/db.rb

Overview

Base NodeStore DB module, the client will use this class through specific DB-type subclass.

Subclasses should define the [ ] (index) method taking key to lookup, returning corresponding NodeStore value and each method, iterating over nodestore values (see existing subclasses for implementation details)

Direct Known Subclasses

Backends::NuDB, Backends::RocksDB

Instance Method Summary collapse

Instance Method Details

#account(hash) ⇒ Object

Return the NodeStore Account for the given lookup hash



40
41
42
# File 'lib/xrbp/nodestore/db.rb', line 40

def (hash)
  ledger_entry(hash)
end

#inner_node(hash) ⇒ Object

Return the NodeStore InnerNode for the given lookup hash



59
60
61
62
63
# File 'lib/xrbp/nodestore/db.rb', line 59

def inner_node(hash)
  val = self[hash]
  return nil if val.nil?
  parse_inner_node(val)
end

#ledger(hash) ⇒ Object

Return the NodeStore Ledger for the given lookup hash



33
34
35
36
37
# File 'lib/xrbp/nodestore/db.rb', line 33

def ledger(hash)
  val = self[hash]
  return nil if val.nil?
  parse_ledger(val)
end

#ledger_entry(hash) ⇒ Object

Return the NodeStore Ledger Entry for the given lookup hash



45
46
47
48
49
# File 'lib/xrbp/nodestore/db.rb', line 45

def ledger_entry(hash)
  val = self[hash]
  return nil if val.nil?
  parse_ledger_entry(val)
end

#tx(hash) ⇒ Object

Return the NodeStore Transaction for the given lookup hash



52
53
54
55
56
# File 'lib/xrbp/nodestore/db.rb', line 52

def tx(hash)
  val = self[hash]
  return nil if val.nil?
  parse_tx(val)
end