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 database
    void delete​(byte[] key)
    Deletes a value from the database
    byte[] get​(byte[] key)
    reads the value associated with the key from the database
    DataIterator iterator()
    Returns a DataIterator whish iterates over all the entries in the dataStore
    void open()
    Opens the Database for IO operations
    void put​(byte[] key, byte[] value)
    writes a value into the database
  • Method Details

    • open

      void open() throws IOException
      Opens the Database for IO operations
      Throws:
      IOException - -
    • close

      void close() throws IOException
      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 value
      value - - 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