Class: DistributedTrie::KvsTc

Inherits:
KvsBase show all
Defined in:
lib/distributedtrie/kvs/tokyocabinet.rb

Overview

Tokyo Cabinet implementation

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from KvsBase

#enabled?, #get, #put!

Methods inherited from KvsIf

#_getInternal, #delete, #get, #put!

Constructor Details

#initialize(dbFilename) ⇒ KvsTc

Returns a new instance of KvsTc.



41
42
43
44
45
46
47
# File 'lib/distributedtrie/kvs/tokyocabinet.rb', line 41

def initialize( dbFilename )
  if not dbFilename.match( /[.]tch$/ )
    raise ArgumentError, "Info KvsTc.new() method get only '*.tch' suffix"
  end
  @db = TokyoCabinet::HDB.new( )
  @db.open( dbFilename, TokyoCabinet::HDB::OWRITER | TokyoCabinet::HDB::OCREAT )
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



49
50
51
# File 'lib/distributedtrie/kvs/tokyocabinet.rb', line 49

def db
  @db
end