Package io.sockit.gameserver
Interface DataStore
- All Known Implementing Classes:
LevelDbStore
public interface DataStore
A DataStore is a representation of the Game Database as a Key Value data store. An instance of this interface can be registered as the Game Engine's database. This is so that the Game developer is not locked down to the Default Database that comes with this Game Engine.
-
Method Summary
Modifier and Type Method Description void
close()
Closes the databasevoid
delete(byte[] key)
Deletes a value from the databasebyte[]
get(byte[] key)
reads the value associated with the key from the databaseDataIterator
iterator()
Returns a DataIterator whish iterates over all the entries in the dataStorevoid
open()
Opens the Database for IO operationsvoid
put(byte[] key, byte[] value)
writes a value into the database
-
Method Details
-
open
Opens the Database for IO operations- Throws:
IOException
- -
-
close
Closes the database- Throws:
IOException
- -
-
get
byte[] get(byte[] key)reads the value associated with the key from the database- Parameters:
key
- - the key whose value is to be read- Returns:
- - the value associated with the key
-
put
void put(byte[] key, byte[] value)writes a value into the database- Parameters:
key
- - the key associated with the valuevalue
- - the value to be written to the database
-
delete
void delete(byte[] key)Deletes a value from the database- Parameters:
key
- - the key whose value is to be deleted
-
iterator
DataIterator iterator()Returns a DataIterator whish iterates over all the entries in the dataStore- Returns:
- DataIterator - an iterator which iterates through entries in this Data Store
-