/** * Adds the specified object to the store. * * @param id * The identifier allowing the object to be retrieved. * @param data * The object to be added. */ public void add(long id, T data) { long objectOffset; // Write the object to the object store. objectOffset = objectStore.add(data); // Write the object offset keyed by the id to the index store. indexStore.write(new LongLongIndexElement(id, objectOffset)); }
/** * Adds the specified object to the store. * * @param data * The object to be added. */ public void add(T data) { objectStore.add(data); chunkObjectCount++; if (!chunkInProgress) { // Write the file index of the new chunk. indexStore.write(new LongLongIndexElement((chunkCount * 2), newChunkFilePosition)); chunkInProgress = true; } }
/** * Adds the specified object to the store. * * @param data * The object to be added. */ public void add(T data) { objectStore.add(data); chunkObjectCount++; if (!chunkInProgress) { // Write the file index of the new chunk. indexStore.write(new LongLongIndexElement((chunkCount * 2), newChunkFilePosition)); chunkInProgress = true; } }
/** * Adds the specified object to the store. * * @param id * The identifier allowing the object to be retrieved. * @param data * The object to be added. */ public void add(long id, T data) { long objectOffset; // Write the object to the object store. objectOffset = objectStore.add(data); // Write the object offset keyed by the id to the index store. indexStore.write(new LongLongIndexElement(id, objectOffset)); }
/** * Stops the current writing operation and begins a new one saving the * current position against a new interval index. */ public void closeChunk() { // We can only close a chunk if one is in progress. if (chunkInProgress) { // Create an interval in the underlying object store and note the // current position. newChunkFilePosition = objectStore.closeChunk(); // Flag that no chunk is in progress so that the next add will store // the start file index. chunkInProgress = false; // Write then reset the object count of the current chunk. indexStore.write(new LongLongIndexElement((chunkCount * 2) + 1, chunkObjectCount)); chunkObjectCount = 0; // Increment the chunk count. chunkCount++; } }
/** * Stops the current writing operation and begins a new one saving the * current position against a new interval index. */ public void closeChunk() { // We can only close a chunk if one is in progress. if (chunkInProgress) { // Create an interval in the underlying object store and note the // current position. newChunkFilePosition = objectStore.closeChunk(); // Flag that no chunk is in progress so that the next add will store // the start file index. chunkInProgress = false; // Write then reset the object count of the current chunk. indexStore.write(new LongLongIndexElement((chunkCount * 2) + 1, chunkObjectCount)); chunkObjectCount = 0; // Increment the chunk count. chunkCount++; } }