|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.crankuptheamps.client.HybridPublishStore
public class HybridPublishStore
PublishStore that stores first in memory, and swaps excess out to disk.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.crankuptheamps.client.Store |
---|
Store.StoreReplayer |
Field Summary | |
---|---|
protected int |
_cap
|
protected PublishStore |
_fileStore
|
protected long |
_lowestIndexInTheFile
|
protected int |
_lowWatermark
|
protected MemoryPublishStore |
_memoryStore
|
protected String |
_path
|
Fields inherited from interface com.crankuptheamps.client.Store |
---|
SOWDeleteByData, SOWDeleteByFilter, SOWDeleteByKeys |
Constructor Summary | |
---|---|
HybridPublishStore(String path,
int cap)
|
Method Summary | |
---|---|
void |
discardUpTo(long index)
Discard all operations up to the index provided. |
void |
flush()
Wait for the store to discard everything that has been stored up to the point in time when flush is called, then return. |
void |
flush(long timeout)
Wait for the store to discard everything that has been stored up to the point in time when flush is called, then return. |
long |
getLowestUnpersisted()
Return the oldest index in the store. |
void |
replay(Store.StoreReplayer replayer)
Replay all operations in the store using the provided StoreReplayer. |
void |
replaySingle(Store.StoreReplayer replayer,
long index)
Replay the operation at the specified index. |
void |
setLowWatermark(int lowWatermark_)
Sets the low watermark; once we start swapping out to disk, we keep going until the number of entries in memory is lower than this. |
void |
setResizeHandler(PublishStoreResizeHandler handler)
Set the resize handler for the publish store. |
void |
store(long index,
int operation,
byte[] topic,
long topicOffset,
long topicLength,
byte[] data,
long dataOffset,
long dataLength,
byte[] corId,
long corIdOff,
long corIdLen)
Store the provided operation. |
void |
store(long index,
int operation,
byte[] topic,
long topicOffset,
long topicLength,
byte[] data,
long dataOffset,
long dataLength,
byte[] corId,
long corIdOff,
long corIdLen,
int expiration)
Store the provided operation. |
void |
store(long index,
int operation,
byte[] topic,
long topicOffset,
long topicLength,
byte[] data,
long dataOffset,
long dataLength,
int expiration,
CommandId cmdId)
Store the provided operation. |
long |
unpersistedCount()
Return the number of operations in the store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PublishStore _fileStore
protected MemoryPublishStore _memoryStore
protected int _cap
protected String _path
protected int _lowWatermark
protected long _lowestIndexInTheFile
Constructor Detail |
---|
public HybridPublishStore(String path, int cap) throws IOException, StoreException
IOException
StoreException
Method Detail |
---|
public void setLowWatermark(int lowWatermark_)
lowWatermark_
- The number of entries to serve as a low watermark.public long getLowestUnpersisted()
Store
getLowestUnpersisted
in interface Store
public void discardUpTo(long index) throws StoreException
Store
discardUpTo
in interface Store
index
- the index number to keep -- all previous index numbers will be discarded
StoreException
public void replay(Store.StoreReplayer replayer) throws StoreException, DisconnectedException
Store
replay
in interface Store
replayer
- the StoreReplayer to use to replay the operations
StoreException
DisconnectedException
public long unpersistedCount()
Store
unpersistedCount
in interface Store
public void replaySingle(Store.StoreReplayer replayer, long index) throws StoreException, DisconnectedException
Store
replaySingle
in interface Store
StoreException
DisconnectedException
public void store(long index, int operation, byte[] topic, long topicOffset, long topicLength, byte[] data, long dataOffset, long dataLength, byte[] corId, long corIdOff, long corIdLen) throws StoreException
Store
store
in interface Store
index
- an index that identifies this operationoperation
- the operation to storetopic
- a byte array containing the name of the topic for this operationtopicOffset
- the offset in the topic array where the topic name beginstopicLength
- the length of the topic namedata
- a byte array containing the data for this operationdataOffset
- the offset into the data array where the data beginsdataLength
- the length of the datacorId
- the correlation ID for this messagecorIdOff
- the offset into the correlation ID array where the correlation ID beginscorIdLen
- the length of the correlation ID
StoreException
public void store(long index, int operation, byte[] topic, long topicOffset, long topicLength, byte[] data, long dataOffset, long dataLength, byte[] corId, long corIdOff, long corIdLen, int expiration) throws StoreException
Store
store
in interface Store
index
- an index that identifies this operationoperation
- the operation to storetopic
- a byte array containing the name of the topic for this operationtopicOffset
- the offset in the topic array where the topic name beginstopicLength
- the length of the topic namedata
- a byte array containing the data for this operationdataOffset
- the offset into the data array where the data beginsdataLength
- the length of the datacorId
- the correlation ID for this messagecorIdOff
- the offset into the correlation ID array where the correlation ID beginscorIdLen
- the length of the correlation IDexpiration
- the expiration to set on the operation
StoreException
public void store(long index, int operation, byte[] topic, long topicOffset, long topicLength, byte[] data, long dataOffset, long dataLength, int expiration, CommandId cmdId) throws StoreException
Store
store
in interface Store
index
- an index that identifies this operationoperation
- the operation to storetopic
- a byte array containing the name of the topic for this operationtopicOffset
- the offset in the topic array where the topic name beginstopicLength
- the length of the topic namedata
- a byte array containing the data for this operationdataOffset
- the offset into the data array where the data beginsdataLength
- the length of the dataexpiration
- the expiration to set on the operationcmdId
- the commandId to set on the operation
StoreException
public void flush() throws TimedOutException
Store
flush
in interface Store
TimedOutException
public void flush(long timeout) throws TimedOutException
Store
flush
in interface Store
timeout
- the number of milliseconds to wait for the flush
TimedOutException
public void setResizeHandler(PublishStoreResizeHandler handler)
Store
setResizeHandler
in interface Store
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |