public abstract class RocksDbQueue extends Object implements IQueue, Closeable, AutoCloseable
| Constructor and Description |
|---|
RocksDbQueue() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected abstract IQueueMessage |
deserialize(byte[] msgData)
Deserilizes a queue message.
|
void |
destroy()
Destroy method.
|
int |
ephemeralSize()
Gets ephemeral-storage's number of items.
|
void |
finish(IQueueMessage msg)
Called when finish processing the message to cleanup ephemeral storage.
|
protected org.rocksdb.ColumnFamilyHandle |
getCfEphemeral() |
protected org.rocksdb.ColumnFamilyHandle |
getCfMetadata() |
String |
getCfNameEphemeral()
Name of the ColumnFamily to store ephemeral messages.
|
String |
getCfNameMetadata()
Name of the ColumnFamily to store metadata.
|
String |
getCfNameQueue()
Name of the ColumnFamily to store queue messages.
|
protected org.rocksdb.ColumnFamilyHandle |
getCfQueue() |
boolean |
getEphemeralDisabled()
Is ephemeral storage disabled?
|
Collection<IQueueMessage> |
getOrphanMessages(long thresholdTimestampMs)
Gets all orphan messages (messages that were left in ephemeral storage
for a long time).
|
protected org.rocksdb.ReadOptions |
getReadOptions() |
protected org.rocksdb.RocksDB |
getRocksDb() |
String |
getStorageDir()
RocksDB's storage directory.
|
protected org.rocksdb.WriteOptions |
getWriteOptions() |
RocksDbQueue |
init()
Init method.
|
boolean |
isEphemeralDisabled()
Is ephemeral storage disabled?
|
boolean |
moveFromEphemeralToQueueStorage(IQueueMessage msg)
Moves a message from ephemeral back to queue storage.
|
protected boolean |
putToQueue(IQueueMessage msg,
boolean removeFromEphemeral) |
boolean |
queue(IQueueMessage _msg)
Queues a message.
|
int |
queueSize()
Gets queue's number of items.
|
boolean |
requeue(IQueueMessage _msg)
Re-queues a message.
|
boolean |
requeueSilent(IQueueMessage msg)
Silently re-queues a message.
|
protected abstract byte[] |
serialize(IQueueMessage msg)
Serializes a queue message to byte[].
|
RocksDbQueue |
setCfNameEphemeral(String cfNameEphemeral)
Sets name of the ColumnFamily to store ephemeral messages.
|
RocksDbQueue |
setCfNameMetadata(String cfNameMetadata)
Sets name of the ColumnFamily to store metadata.
|
RocksDbQueue |
setCfNameQueue(String cfNameQueue)
Sets name of the ColumnFamily to store queue messages.
|
RocksDbQueue |
setEphemeralDisabled(boolean ephemeralDisabled)
Disables/Enables ephemeral storage.
|
RocksDbQueue |
setStorageDir(String storageDir)
Sets RocksDB's storage directory.
|
IQueueMessage |
take()
Takes a message out of queue.
|
protected org.rocksdb.RocksDB getRocksDb()
protected org.rocksdb.ColumnFamilyHandle getCfQueue()
protected org.rocksdb.ColumnFamilyHandle getCfMetadata()
protected org.rocksdb.ColumnFamilyHandle getCfEphemeral()
protected org.rocksdb.ReadOptions getReadOptions()
protected org.rocksdb.WriteOptions getWriteOptions()
public boolean getEphemeralDisabled()
public boolean isEphemeralDisabled()
public RocksDbQueue setEphemeralDisabled(boolean ephemeralDisabled)
ephemeralDisabled - true to disable ephemeral storage, false
otherwise.public String getStorageDir()
public RocksDbQueue setStorageDir(String storageDir)
storageDir - public String getCfNameQueue()
public RocksDbQueue setCfNameQueue(String cfNameQueue)
cfNameQueue - public String getCfNameMetadata()
public RocksDbQueue setCfNameMetadata(String cfNameMetadata)
cfNameMetadata - public String getCfNameEphemeral()
public RocksDbQueue setCfNameEphemeral(String cfNameEphemeral)
cfNameEphemeral - public RocksDbQueue init()
public void destroy()
public void close()
close in interface Closeableclose in interface AutoCloseableprotected abstract byte[] serialize(IQueueMessage msg)
msg - protected abstract IQueueMessage deserialize(byte[] msgData)
msgData - protected boolean putToQueue(IQueueMessage msg, boolean removeFromEphemeral)
public boolean queue(IQueueMessage _msg)
Implementation flow:
public boolean requeue(IQueueMessage _msg)
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
public boolean requeueSilent(IQueueMessage msg)
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
requeueSilent in interface IQueuepublic void finish(IQueueMessage msg)
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
public IQueueMessage take()
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
public Collection<IQueueMessage> getOrphanMessages(long thresholdTimestampMs)
getOrphanMessages in interface IQueuethresholdTimestampMs - public boolean moveFromEphemeralToQueueStorage(IQueueMessage msg)
Implementation flow:
moveFromEphemeralToQueueStorage in interface IQueuetrue if a move has been made, false otherwise
(e.g. the message didn't exist in ephemeral storage)public int queueSize()
public int ephemeralSize()
Note: ephemeral storage implementation is optional, depends on implementation.
ephemeralSize in interface IQueueCopyright © 2016 DDTH. All rights reserved.