2 * Sixth Data. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
7 package eu.svjatoslav.sixth.data.store;
9 import java.io.IOException;
12 * Data store acts as a numerical ID to corresponding record map.
14 * Record is basically an array of bytes of arbitrary length, identifiable by ID
15 * that is assigned to record during record creation.
17 * Records can be updated with alternative content and length. Data store takes
18 * care of data fragmentation.
20 public interface DataStore {
25 void close() throws IOException;
28 * Create new record and set its initial contents.
30 int createRecord(byte[] value) throws IOException;
33 * Delete record identified by given ID. DataStore will mark given ID as
34 * unused, and could reuse this ID later for another newly created record.
36 void deleteRecord(int id) throws IOException;
39 * Read entire record into byte array.
41 byte[] readRecord(int id) throws IOException;
44 * Update record with new value.
46 void updateRecord(int id, byte[] value) throws IOException;