Class: XRBP::SHAMap::Node
- Inherits:
-
Object
- Object
- XRBP::SHAMap::Node
- Extended by:
- NodeFactory
- Defined in:
- lib/xrbp/nodestore/shamap/node.rb
Overview
Base Node class, all entries stored in tree structures in nodestore DB inherit from this class
Constant Summary collapse
- TYPES =
{ :error => 0, :infer => 1, :transaction_nm => 2, :transaction_md => 3, :account_state => 4 }
- LEAF_TYPES =
[ :transaction_nm, :transaction_md, :account_state ]
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Node
constructor
A new instance of Node.
- #inner? ⇒ Boolean
- #leaf? ⇒ Boolean
- #tree_node? ⇒ Boolean
- #update_hash ⇒ Object
Methods included from NodeFactory
Constructor Details
#initialize(args = {}) ⇒ Node
Returns a new instance of Node.
26 27 28 29 30 |
# File 'lib/xrbp/nodestore/shamap/node.rb', line 26 def initialize(args={}) @hash = args[:hash] @type = args[:type] @seq = args[:seq] end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
10 11 12 |
# File 'lib/xrbp/nodestore/shamap/node.rb', line 10 def hash @hash end |
Instance Method Details
#inner? ⇒ Boolean
36 37 38 |
# File 'lib/xrbp/nodestore/shamap/node.rb', line 36 def inner? false end |
#leaf? ⇒ Boolean
32 33 34 |
# File 'lib/xrbp/nodestore/shamap/node.rb', line 32 def leaf? LEAF_TYPES.include?(@type) end |
#tree_node? ⇒ Boolean
40 41 42 |
# File 'lib/xrbp/nodestore/shamap/node.rb', line 40 def tree_node? false end |
#update_hash ⇒ Object
44 45 46 |
# File 'lib/xrbp/nodestore/shamap/node.rb', line 44 def update_hash raise "abstract: must be called on a subclass" end |