public class SimpleMemoryRawStore extends AbstractRawWormStore
ArrayList.
Note: it is safe to NOT call close() on this implementation. The
implementation does not contain things like ExecutorServices that
would hang around unless explicitly shutdown.
TemporaryRawStore}, which provides a more scalable solution for
temporary data.| Modifier and Type | Field and Description |
|---|---|
protected int |
nextOffset
The #of bytes written so far.
|
protected ArrayList<byte[]> |
records
The buffered records in the order written.
|
amNULL| Constructor and Description |
|---|
SimpleMemoryRawStore()
Uses an initial capacity of 1000 records.
|
SimpleMemoryRawStore(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the store immediately.
|
void |
deleteResources()
Deletes the backing file(s) (if any).
|
void |
destroy()
Closes the store immediately (if open) and deletes its persistent
resources.
|
void |
force(boolean metadata)
Force the data to stable storage.
|
CounterSet |
getCounters()
Return performance counters.
|
File |
getFile()
The backing file -or-
null if there is no backing file
for the store. |
IResourceMetadata |
getResourceMetadata()
A description of this store in support of the scale-out architecture.
|
UUID |
getUUID()
|
boolean |
isFullyBuffered()
True iff the store is fully buffered (all reads are against memory).
|
boolean |
isOpen()
true iff the store is open. |
boolean |
isReadOnly()
true iff the store does not allow writes. |
boolean |
isStable()
True iff backed by stable storage.
|
ByteBuffer |
read(long addr)
Read the data (unisolated).
|
long |
size()
The #of application data bytes written on the store (does not count any
headers or root blocks that may exist for the store).
|
long |
write(ByteBuffer data)
Write the data (unisolated).
|
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toStringdelete, getInputStream, getOutputStreamprotected int nextOffset
write(ByteBuffer). This is necessary in order for
this implementation to assign addresses in the same manner as they would
be assigned by an implementation using an append only byte[] or file.protected final ArrayList<byte[]> records
public SimpleMemoryRawStore()
public SimpleMemoryRawStore(int capacity)
capacity - The #of records that you expect to store (non-negative). If
the capacity is exceeded then the internal ArrayList
will be grown as necessary.public boolean isOpen()
IRawStoretrue iff the store is open.true iff the store is open.public boolean isReadOnly()
IRawStoretrue iff the store does not allow writes.public boolean isStable()
IRawStorepublic boolean isFullyBuffered()
IRawStoreNote: This does not guarantee that the OS will not swap the buffer onto disk.
public IResourceMetadata getResourceMetadata()
IRawStorepublic File getFile()
null if there is no backing file
for the store.
This always returns null.
public void close()
IRawStorepublic void deleteResources()
IRawStorepublic void destroy()
IRawStoreIllegalStateException if the store
is already closed, but still deletes the backing resources.IRawStore.deleteResources()public ByteBuffer read(long addr)
IRawStoreaddr - A long integer that encodes both the offset from which the
data will be read and the #of bytes to be read. See
IAddressManager.toAddr(int, long).public long write(ByteBuffer data)
IRawStoredata - The data. The bytes from the current
Buffer.position() to the
Buffer.limit() will be written and the
Buffer.position() will be advanced to the
Buffer.limit() . The caller may subsequently
modify the contents of the buffer without changing the state
of the store (i.e., the data are copied into the store).IAddressManager.public void force(boolean metadata)
IRawStoremetadata - If true, then force both the file contents and the file
metadata to disk.public long size()
IRawStorepublic CounterSet getCounters()
ICounterSetAccessCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.