Class: StrokeDB::Skiplist::Node
- Defined in:
- lib/strokedb/data_structures/skiplist.rb
Instance Attribute Summary collapse
-
#_serialized_index ⇒ Object
Returns the value of attribute _serialized_index.
-
#forward ⇒ Object
Returns the value of attribute forward.
-
#key ⇒ Object
Returns the value of attribute key.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #<(key) ⇒ Object
- #<=(key) ⇒ Object
-
#free(list) ⇒ Object
this is called when node is thrown out of the list note, that node.value is called immediately after node.free.
-
#initialize(level, key, value, timestamp = nil) ⇒ Node
constructor
A new instance of Node.
-
#level ⇒ Object
do nothing.
- #next ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#_serialized_index ⇒ Object
Returns the value of attribute _serialized_index.
243 244 245 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 243 def _serialized_index @_serialized_index end |
#forward ⇒ Object
Returns the value of attribute forward.
242 243 244 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 242 def forward @forward end |
#key ⇒ Object
Returns the value of attribute key.
242 243 244 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 242 def key @key end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
242 243 244 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 242 def @timestamp end |
#value ⇒ Object
Returns the value of attribute value.
242 243 244 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 242 def value @value end |
Instance Method Details
#<(key) ⇒ Object
256 257 258 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 256 def <(key) @key < key end |
#<=(key) ⇒ Object
259 260 261 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 259 def <=(key) @key <= key end |
#free(list) ⇒ Object
this is called when node is thrown out of the list note, that node.value is called immediately after node.free
250 251 252 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 250 def free(list) # do nothing end |
#level ⇒ Object
do nothing
253 254 255 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 253 def level @forward.size end |
#next ⇒ Object
262 263 264 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 262 def next forward[0] end |
#to_s ⇒ Object
265 266 267 |
# File 'lib/strokedb/data_structures/skiplist.rb', line 265 def to_s "[#{level}]#{@key}: #{@value}" end |