Class: MapDB::DB
- Inherits:
-
Object
- Object
- MapDB::DB
- Defined in:
- lib/sekka/jruby_mapdb.rb
Instance Attribute Summary collapse
-
#mapdb ⇒ Object
readonly
Returns the value of attribute mapdb.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #close ⇒ Object
- #getTree ⇒ Object
-
#initialize(dbname = nil, treename = nil) ⇒ DB
constructor
A new instance of DB.
Constructor Details
#initialize(dbname = nil, treename = nil) ⇒ DB
Returns a new instance of DB.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/sekka/jruby_mapdb.rb', line 79 def initialize(dbname=nil,treename=nil) @tree = nil if dbname.nil? @type = :MemoryDB @mapdb = OrgMapdb::DBMaker. memoryDB(). closeOnJvmShutdown(). make() else @type = :FileDB @mapdb = OrgMapdb::DBMaker. fileDB(Java::JavaIo::File.new("#{dbname}")). fileMmapEnableIfSupported(). closeOnJvmShutdown(). make() end if treename.nil? raise ArgumentError("require treename.") end tree = @mapdb.treeMap("#{treename}"). keySerializer(OrgMapdb::Serializer.STRING). valueSerializer(OrgMapdb::Serializer.STRING). createOrOpen() @tree = MapDB::Tree.new(tree) end |
Instance Attribute Details
#mapdb ⇒ Object (readonly)
Returns the value of attribute mapdb.
78 79 80 |
# File 'lib/sekka/jruby_mapdb.rb', line 78 def mapdb @mapdb end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
78 79 80 |
# File 'lib/sekka/jruby_mapdb.rb', line 78 def type @type end |
Instance Method Details
#close ⇒ Object
109 110 111 |
# File 'lib/sekka/jruby_mapdb.rb', line 109 def close @mapdb.close end |
#getTree ⇒ Object
105 106 107 |
# File 'lib/sekka/jruby_mapdb.rb', line 105 def getTree() return @tree end |