Class LevelDbStore

java.lang.Object
io.sockit.gameserver.LevelDbStore
All Implemented Interfaces:
DataStore

public class LevelDbStore
extends Object
implements DataStore
An implementation of the DataStore interface which uses LevelDB to save/persist the Game Engine data.
  • Constructor Details

    • LevelDbStore

      public LevelDbStore​(File dbFolder)
      Parameters:
      dbFolder - - the folder where the LevelDB data files are saved
    • LevelDbStore

      public LevelDbStore​(String dbFolder)
      Parameters:
      dbFolder - - the folder where the LevelDB data files are saved
  • Method Details

    • open

      public void open() throws IOException
      Opens the database
      Specified by:
      open in interface DataStore
      Throws:
      IOException - -
    • close

      public void close() throws IOException
      Closes the database
      Specified by:
      close in interface DataStore
      Throws:
      IOException - -
    • get

      public byte[] get​(byte[] key)
      reads the value associated with the key from the database
      Specified by:
      get in interface DataStore
      Parameters:
      key - - the key whose value is to be read
      Returns:
      - the value associated with the key
    • put

      public void put​(byte[] key, byte[] value)
      writes a value into the database
      Specified by:
      put in interface DataStore
      Parameters:
      key - - the key associated with the value
      value - - the value to be written to the database
    • delete

      public void delete​(byte[] key)
      Deletes a value from the database
      Specified by:
      delete in interface DataStore
      Parameters:
      key - - the key whose value is to be deleted
    • iterator

      public DataIterator iterator()
      Description copied from interface: DataStore
      Returns a DataIterator whish iterates over all the entries in the dataStore
      Specified by:
      iterator in interface DataStore
      Returns:
      DataIterator - an iterator which iterates through entries in this Data Store