2 * Sixth Data. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public License
6 * or later as published by the Free Software Foundation.
9 package eu.svjatoslav.sixth.data.store;
11 import java.io.IOException;
14 * Data store acts as a numerical ID to corresponding record map.
16 * Record is basically an array of bytes of arbitrary length, identifiable by ID
17 * that is assigned to record during record creation.
19 * Records can be updated with alternative content and length. Data store takes
20 * care of data fragmentation.
22 public interface DataStore {
27 void close() throws IOException;
30 * Create new record and set its initial contents.
32 int createRecord(byte[] value) throws IOException;
35 * Delete record identified by given ID. DataStore will mark given ID as
36 * unused, and could reuse this ID later for another newly created record.
38 void deleteRecord(int id) throws IOException;
41 * Read entire record into byte array.
43 byte[] readRecord(int id) throws IOException;
46 * Update record with new value.
48 void updateRecord(int id, byte[] value) throws IOException;