Interface DataStore

  • All Known Implementing Classes:
    FileDataStore

    public interface DataStore
    Data store acts as a numerical ID to corresponding record map.

    Record is basically an array of bytes of arbitrary length, identifiable by ID that is assigned to record during record creation.

    Records can be updated with alternative content and length. Data store takes care of data fragmentation.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Close datastore.
      int createRecord​(byte[] value)
      Create new record and set its initial contents.
      void deleteRecord​(int id)
      Delete record identified by given ID.
      byte[] readRecord​(int id)
      Read entire record into byte array.
      void updateRecord​(int id, byte[] value)
      Update record with new value.
    • Method Detail

      • createRecord

        int createRecord​(byte[] value)
                  throws IOException
        Create new record and set its initial contents.
        Throws:
        IOException
      • deleteRecord

        void deleteRecord​(int id)
                   throws IOException
        Delete record identified by given ID. DataStore will mark given ID as unused, and could reuse this ID later for another newly created record.
        Throws:
        IOException
      • readRecord

        byte[] readRecord​(int id)
                   throws IOException
        Read entire record into byte array.
        Throws:
        IOException
      • updateRecord

        void updateRecord​(int id,
                          byte[] value)
                   throws IOException
        Update record with new value.
        Throws:
        IOException