public class MemStore extends AbstractRawStore implements IAllocationManagerStore
IRawStore backed by an IMemoryManager.NULL| Constructor and Description |
|---|
MemStore(DirectBufferPool pool)
Create a new instance.
|
MemStore(DirectBufferPool pool,
int bufferCapacity)
Create a new instance.
|
MemStore(IMemoryManager mmgr)
Wrap an existing
IMemoryManager. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the store immediately.
|
MemStore |
createAllocationContext()
Return a new view of the
MemStore backed by a child
IMemoryManager. |
void |
delete(long addr)
The default implementation is a NOP.
|
void |
delete(long addr,
IAllocationContext context)
Delete the data associated with the address within the allocation
context.
|
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)
NOP since the
MemStore is not backed by stable media. |
IAddressManager |
getAddressManager()
Return the delegate object that provides the
IAddressManager
implementation for this IRawStore. |
int |
getByteCount(long addr)
The length of the datum in bytes.
|
CounterSet |
getCounters()
Return performance counters.
|
File |
getFile()
This method always returns
null since there is no backing
file. |
InputStream |
getInputStream(long addr)
Return an input stream from which a previously written stream may be read
back.
|
IMemoryManager |
getMemoryManager()
Return the backing
IMemoryManager. |
long |
getOffset(long addr)
The offset on the store at which the datum is stored.
|
IPSOutputStream |
getOutputStream()
Return an output stream which can be used to write on the backing store.
|
IPSOutputStream |
getOutputStream(IAllocationContext context)
Return an output stream which can be used to write on the backing store
within the given allocation context.
|
long |
getPhysicalAddress(long addr)
Determine the unencoded physical address
|
IResourceMetadata |
getResourceMetadata()
A description of this store in support of the scale-out architecture.
|
MemStrategy |
getStrategy() |
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 |
toAddr(int nbytes,
long offset)
Converts a byte count and offset into a long integer.
|
String |
toString(long addr)
A human readable representation of the address.
|
long |
write(ByteBuffer data)
Write the data (unisolated).
|
long |
write(ByteBuffer data,
IAllocationContext context)
Write the data within the allocation context.
|
public MemStore(DirectBufferPool pool)
pool - The pool from which the backing direct ByteBuffers
will be allocated.public MemStore(DirectBufferPool pool, int bufferCapacity)
pool - The pool from which the backing direct ByteBuffers
will be allocated.bufferCapacity - The maximum #of buffers which may be allocated by this
MemStore from that pool. This may be
Integer.MAX_VALUE for an effectively unlimited
capacity.public MemStore(IMemoryManager mmgr)
IMemoryManager.mmgr - The IMemoryManager.public MemStrategy getStrategy()
public IMemoryManager getMemoryManager()
IMemoryManager.public MemStore createAllocationContext()
public ByteBuffer read(long addr)
IRawStoreread in interface 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)
IRawStorewrite in interface 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 long write(ByteBuffer data, IAllocationContext context)
IAllocationManagerStorewrite in interface IAllocationManagerStoredata - The data.context - The allocation context.public void delete(long addr)
AbstractRawStoredelete in interface IRawStoredelete in class AbstractRawStoreaddr - A long integer formed using Addr that encodes both the
offset at which the data was written and the #of bytes that
were written.public void delete(long addr,
IAllocationContext context)
IAllocationManagerStoredelete in interface IAllocationManagerStoreaddr - The address whose allocation is to be deleted.context - The allocation context.public CounterSet getCounters()
ICounterSetAccessgetCounters in interface ICounterSetAccesspublic boolean isOpen()
IRawStoretrue iff the store is open.public void close()
IRawStorepublic void deleteResources()
IRawStoredeleteResources in interface IRawStorepublic void destroy()
IRawStoreIllegalStateException if the store
is already closed, but still deletes the backing resources.destroy in interface IRawStoreIRawStore.deleteResources()public void force(boolean metadata)
MemStore is not backed by stable media.
Force the data to stable storage. While this is NOT sufficient to guarantee an atomic commit, the data must be forced to disk as part of an atomic commit protocol.
public File getFile()
null since there is no backing
file.
The backing file -or- null if there is no backing file
for the store.
public IResourceMetadata getResourceMetadata()
IRawStoregetResourceMetadata in interface IRawStorepublic boolean isFullyBuffered()
IRawStoreNote: This does not guarantee that the OS will not swap the buffer onto disk.
isFullyBuffered in interface IRawStorepublic boolean isReadOnly()
IRawStoretrue iff the store does not allow writes.isReadOnly in interface IRawStorepublic boolean isStable()
IRawStorepublic long size()
Overridden to return the #of bytes in the allocation slots rather than
the user bytes. This is because the MemoryManager, like the
RWStore, does not know the #of bytes of user data in each
allocation slot. Therefore it is not able to keep accurate track of the
user bytes as allocation slots are cycled.
public IAddressManager getAddressManager()
AbstractRawStoreIAddressManager
implementation for this IRawStore.
Note: LRUNexus depends on the delegation model to retain
references to the IAddressManager without causing the
IRawStore to be retained. It uses the IAddressManager to
decode the address in order to track the bytesOnDisk for the buffered
records.
getAddressManager in class AbstractRawStorepublic int getByteCount(long addr)
IAddressManagerIRawStore.getByteCount in interface IAddressManageraddr - The opaque identifier that is the within store locator for
some datum.public long getOffset(long addr)
IAddressManagergetOffset in interface IAddressManageraddr - The opaque identifier that is the within store locator for
some datum.public long getPhysicalAddress(long addr)
IAddressManagergetPhysicalAddress in interface IAddressManageraddr - The encoded addresspublic long toAddr(int nbytes,
long offset)
IAddressManagertoAddr in interface IAddressManagernbytes - The byte count.offset - The byte offset.public String toString(long addr)
IAddressManagertoString in interface IAddressManageraddr - The opaque identifier that is the within store locator for
some datum.public IPSOutputStream getOutputStream()
IStreamStoreIPSOutputStream.getOutputStream in interface IStreamStoregetOutputStream in class AbstractRawStorepublic IPSOutputStream getOutputStream(IAllocationContext context)
IPSOutputStream.getOutputStream in interface IAllocationManagerStorecontext - The context within which any allocations are made by the
returned IPSOutputStream.public InputStream getInputStream(long addr)
getInputStream in interface IStreamStoregetInputStream in class AbstractRawStoreaddr - The address at which the stream was written.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.