public class JournalBinaryStore extends Object implements BinaryStore.KeySetAware, Journal.JournalConsumer
| Modifier and Type | Class and Description |
|---|---|
protected static class |
JournalBinaryStore.ClearListener
The ClearListener is used to ensure that entries are removed from the journal when the corresponding keys are
cleared from the ticket tree. |
BinaryStore.KeySetAware, BinaryStore.SizeAware| Modifier and Type | Field and Description |
|---|---|
protected MultiBinaryLongMap |
f_mblm
The MultiBinaryLongMap.
|
protected BinaryLongMap |
m_blmTickets
Mapping from Binary keys to journal "tickets".
|
protected AtomicLong |
m_cbTotal
Number of bytes in the Journal currently "owned" by this BinaryStore.
|
protected long |
m_cEvacuations
The number of evacuations occurred on this
Journal.JournalConsumer. |
protected Journal |
m_journal
The journal manager for this BinaryStore.
|
| Constructor and Description |
|---|
JournalBinaryStore(Journal journal)
Construct a JournalBinaryStore.
|
JournalBinaryStore(Journal journal, MultiBinaryLongMap mblm)
Construct a JournalBinaryStore.
|
| Modifier and Type | Method and Description |
|---|---|
protected BinaryLongMap |
configureTicketTree()
Configure and return the BinaryLongMap to be used to store journal tickets.
|
boolean |
containsKey(Binary binKey)
Return true iff this BinaryStore contains a mapping for the specified key.
|
void |
dedupe(byte[][] aab)
This method may be invoked by the Journal implementation to request that any immutable byte arrays managed by the consumer be de-duplicated.
|
void |
dispose()
Invoked when all resources owned by the implementer can safely be released.
|
void |
erase(Binary binKey)
Remove the specified key from the underlying store if present.
|
void |
eraseAll()
Remove all data from the underlying store.
|
void |
evacuate(long lTicketMask, long lTicketValue)
This method may be invoked by the Journal implementation to request that the consumer evacuate a particular journal file.
|
long |
getByteCount()
Calculate the total amount of data currently stored in the journal by this BinaryStore.
|
String |
getDescription()
Format a String description of the Consumer.
|
Journal |
getJournal()
Obtain the underlying journaling system used by this BinaryStore.
|
int |
getKeyCount()
Determine the number of keys currently stored in the journal by this BinaryStore.
|
MultiBinaryLongMap |
getMultiBinaryLongMap()
Return the
MultiBinaryLongMap used to store the underlying keys in this KeySetAware BinaryStore. |
protected BinaryLongMap |
getTicketTree()
An internal accessor for the "tree of tickets"; this accessor is used only by client threads, and has a built-in check for if the journal has already been disposed of (which could occur on a different thread).
|
Iterator |
keys()
Iterate all keys in the underlying store.
|
Binary |
load(Binary binKey)
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
|
int |
size()
Determine the number of keys in the BinaryStore.
|
void |
store(Binary binKey, Binary binValue)
Store the specified value under the specific key in the underlying store.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcloseprotected volatile long m_cEvacuations
Journal.JournalConsumer.protected Journal m_journal
protected BinaryLongMap m_blmTickets
protected final MultiBinaryLongMap f_mblm
protected final AtomicLong m_cbTotal
public JournalBinaryStore(Journal journal)
journal - the Journal to write to and read frompublic JournalBinaryStore(Journal journal, MultiBinaryLongMap mblm)
journal - the Journal to write to and read frommblm - the MultiBinaryLongMap used to store the keys and ticketspublic Binary load(Binary binKey)
load in interface BinaryStorebinKey - key whose associated value is to be returnedpublic void store(Binary binKey, Binary binValue)
store in interface BinaryStorebinKey - key to store the value underbinValue - value to be storedpublic void erase(Binary binKey)
erase in interface BinaryStorebinKey - key whose mapping is to be removed from the mappublic void eraseAll()
eraseAll in interface BinaryStorepublic Iterator keys()
keys in interface BinaryStorepublic int size()
size in interface BinaryStore.SizeAwarepublic boolean containsKey(Binary binKey)
containsKey in interface BinaryStore.KeySetAwarebinKey - key whose presence in the BinaryStore is to be testedpublic MultiBinaryLongMap getMultiBinaryLongMap()
MultiBinaryLongMap used to store the underlying keys in this KeySetAware BinaryStore.getMultiBinaryLongMap in interface BinaryStore.KeySetAware
public void evacuate(long lTicketMask,
long lTicketValue)
evacuate in interface Journal.JournalConsumerlTicketMask - indicates which bits of the tickets to checklTicketValue - indicates what bit pattern needs to be matched on the tickets in order to select them for evacuationpublic void dedupe(byte[][] aab)
dedupe in interface Journal.JournalConsumeraab - an array of byte[] objects for intern-ing byte[] referencespublic String getDescription()
getDescription in interface Journal.JournalConsumerpublic void dispose()
Once disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
dispose in interface Disposablepublic Journal getJournal()
public int getKeyCount()
public long getByteCount()
protected BinaryLongMap getTicketTree()
protected BinaryLongMap configureTicketTree()