Class: StrokeDB::FixedLengthSkiplistVolume

Inherits:
SimpleSkiplist show all
Defined in:
lib/strokedb/volumes/fixed_length_skiplist_volume.rb

Constant Summary

Constants inherited from SimpleSkiplist

SimpleSkiplist::DEFAULT_MAXLEVEL, SimpleSkiplist::DEFAULT_PROBABILITY

Instance Attribute Summary

Attributes inherited from SimpleSkiplist

#maxlevel, #probability

Instance Method Summary collapse

Methods inherited from SimpleSkiplist

#each, #each_node, #empty?, #find, #find_nearest, #find_nearest_node, #find_with_update, #first_key, from_a, from_hash, #insert, #marshal_dump, #marshal_load, #to_a

Methods included from Enumerable

#each_consecutive_pair, #group_by, #map_with_index

Constructor Details

#initialize(options = {}) ⇒ FixedLengthSkiplistVolume

Returns a new instance of FixedLengthSkiplistVolume.



4
5
6
7
8
9
10
# File 'lib/strokedb/volumes/fixed_length_skiplist_volume.rb', line 4

def initialize(options = {})
  @options = options.stringify_keys
  @volume = MapVolume.new(:record_size => (@options['maxlevel']||DEFAULT_MAXLEVEL) * 4 + 1 +
  @options['key_length'] + @options['value_length'], :path => @options['path'])
  @nodes = {}
  super(nil,:maxlevel => @options['maxlevel'], :probability => @options['probability'])
end

Instance Method Details

#close!Object



24
25
26
# File 'lib/strokedb/volumes/fixed_length_skiplist_volume.rb', line 24

def close!
  @volume.close!
end

#inspectObject



28
29
30
# File 'lib/strokedb/volumes/fixed_length_skiplist_volume.rb', line 28

def inspect
  "#<StrokeDB::FixedLengthSkiplistVolume:0x#{object_id.to_s(16)} path: #{path} key_length: #{key_length} value_length: #{value_length}"
end

#key_lengthObject



12
13
14
# File 'lib/strokedb/volumes/fixed_length_skiplist_volume.rb', line 12

def key_length
  @options['key_length']
end

#pathObject



20
21
22
# File 'lib/strokedb/volumes/fixed_length_skiplist_volume.rb', line 20

def path
  @options['path']
end

#value_lengthObject



16
17
18
# File 'lib/strokedb/volumes/fixed_length_skiplist_volume.rb', line 16

def value_length
  @options['value_length']
end