2 * Sixth - System for data storage, computation, exploration and interaction.
3 * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 3 of the GNU Lesser General Public License
7 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.sixth.data.store;
12 import java.io.IOException;
15 * Data store acts as a numerical ID to corresponding record map.
17 * Record is basically an array of bytes of arbitrary length, identifiable by ID
18 * that is assigned to record during record creation.
20 * Records can be updated with alternative content and length. Data store takes
21 * care of data fragmentation.
23 public interface DataStore {
28 void close() throws IOException;
31 * Create new record and set its initial contents.
33 int createRecord(byte[] value) throws IOException;
36 * Delete record identified by given ID. DataStore will mark given ID as
37 * unused, and could reuse this ID later for another newly created record.
39 void deleteRecord(int id) throws IOException;
42 * Read entire record into byte array.
44 byte[] readRecord(int id) throws IOException;
47 * Update record with new value.
49 void updateRecord(int id, byte[] value) throws IOException;