Class: GameMachine::DataStores::Mapdb
- Inherits:
-
Object
- Object
- GameMachine::DataStores::Mapdb
- Extended by:
- Forwardable
- Defined in:
- lib/game_machine/data_stores/mapdb.rb
Instance Method Summary collapse
- #connect ⇒ Object
- #dbfile ⇒ Object
- #dump(path, format = :yaml) ⇒ Object
- #keys ⇒ Object
- #load(path, format = :yaml) ⇒ Object
- #set(key, value) ⇒ Object
- #shutdown ⇒ Object
Instance Method Details
#connect ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/game_machine/data_stores/mapdb.rb', line 36 def connect unless @client @db = DataStores::DBMaker.newFileDB(java.io.File.new(dbfile)). closeOnJvmShutdown. make @client = @db.getTreeMap("entities") end @client end |
#dbfile ⇒ Object
32 33 34 |
# File 'lib/game_machine/data_stores/mapdb.rb', line 32 def dbfile File.join(GameMachine.app_root,'db','mapdb.db') end |
#dump(path, format = :yaml) ⇒ Object
19 20 21 |
# File 'lib/game_machine/data_stores/mapdb.rb', line 19 def dump(path,format=:yaml) raise NotImplementedError end |
#keys ⇒ Object
15 16 17 |
# File 'lib/game_machine/data_stores/mapdb.rb', line 15 def keys @client.keys end |
#load(path, format = :yaml) ⇒ Object
23 24 25 |
# File 'lib/game_machine/data_stores/mapdb.rb', line 23 def load(path,format=:yaml) raise NotImplementedError end |
#set(key, value) ⇒ Object
27 28 29 30 |
# File 'lib/game_machine/data_stores/mapdb.rb', line 27 def set(key,value) @client.put(key,value) @db.commit end |
#shutdown ⇒ Object
11 12 13 |
# File 'lib/game_machine/data_stores/mapdb.rb', line 11 def shutdown @client.close end |