|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.rawstore.AbstractRawStore
com.bigdata.rawstore.AbstractRawWormStore
com.bigdata.rawstore.SimpleMemoryRawStore
public class SimpleMemoryRawStore
A purely transient append-only implementation useful when data need to be
buffered in memory. The writes are stored in an 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.| Field Summary | |
|---|---|
protected int |
nextOffset
The #of bytes written so far. |
protected ArrayList<byte[]> |
records
The buffered records in the order written. |
| Fields inherited from class com.bigdata.rawstore.AbstractRawWormStore |
|---|
am |
| Fields inherited from interface com.bigdata.rawstore.IAddressManager |
|---|
NULL |
| Constructor Summary | |
|---|---|
SimpleMemoryRawStore()
Uses an initial capacity of 1000 records. |
|
SimpleMemoryRawStore(int capacity)
|
|
| Method Summary | |
|---|---|
void |
close()
Close the store immediately, but does not clear any records for the store from the IGlobalLRU. |
void |
deleteResources()
Deletes the backing file(s) (if any) and clears any records for the store from the IGlobalLRU. |
void |
destroy()
Closes the store immediately (if open), deletes its persistent resources, and clears any records for the store from the IGlobalLRU. |
void |
force(boolean metadata)
Force the data to stable storage. |
CounterSet |
getCounters()
Return performance counters. |
File |
getFile()
This always returns null. |
IResourceMetadata |
getResourceMetadata()
A description of this store in support of the scale-out architecture. |
UUID |
getUUID()
Return the UUID which identifies this IRawStore. |
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). |
| Methods inherited from class com.bigdata.rawstore.AbstractRawWormStore |
|---|
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toString |
| Methods inherited from class com.bigdata.rawstore.AbstractRawStore |
|---|
abortContext, delete, delete, detachContext, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected 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
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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()
IRawStore
public boolean isFullyBuffered()
IRawStoreNote: This does not guarantee that the OS will not swap the buffer onto disk.
public UUID getUUID()
IRawStoreUUID which identifies this IRawStore. This
supports both IRawStore.getResourceMetadata() and the LRUNexus.
public IResourceMetadata getResourceMetadata()
IRawStore
public File getFile()
null.
public void close()
IRawStoreIGlobalLRU.
public void deleteResources()
IRawStoreIGlobalLRU.
public void destroy()
IRawStoreIGlobalLRU. Does
NOT throw an IllegalStateException if the store is already
closed, but still deletes the backing resources.
IRawStore.deleteResources()public ByteBuffer read(long addr)
IRawStore
addr - 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)
IRawStore
data - 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)
IRawStore
metadata - If true, then force both the file contents and the file
metadata to disk.public long size()
IRawStore
public CounterSet getCounters()
ICounterSetAccess
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||