|
|
@ -19,7 +19,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Object containing details about Stream
|
|
|
|
* Object containing details about Stream
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Nikita Koksharov
|
|
|
|
* @author Nikita Koksharov
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param <K> key type
|
|
|
|
* @param <K> key type
|
|
|
@ -28,18 +28,18 @@ import java.util.Map;
|
|
|
|
public class StreamInfo<K, V> {
|
|
|
|
public class StreamInfo<K, V> {
|
|
|
|
|
|
|
|
|
|
|
|
public static class Entry<K, V> {
|
|
|
|
public static class Entry<K, V> {
|
|
|
|
|
|
|
|
|
|
|
|
final StreamMessageId id;
|
|
|
|
final StreamMessageId id;
|
|
|
|
final Map<K, V> data;
|
|
|
|
final Map<K, V> data;
|
|
|
|
|
|
|
|
|
|
|
|
public Entry(StreamMessageId id, Map<K, V> data) {
|
|
|
|
public Entry(StreamMessageId id, Map<K, V> data) {
|
|
|
|
this.id = id;
|
|
|
|
this.id = id;
|
|
|
|
this.data = data;
|
|
|
|
this.data = data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns StreamMessageId of this stream entry.
|
|
|
|
* Returns StreamMessageId of this stream entry.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return StreamMessageId object
|
|
|
|
* @return StreamMessageId object
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public StreamMessageId getId() {
|
|
|
|
public StreamMessageId getId() {
|
|
|
@ -48,15 +48,15 @@ public class StreamInfo<K, V> {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns data stored in this stream entry
|
|
|
|
* Returns data stored in this stream entry
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return Map object
|
|
|
|
* @return Map object
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Map<K, V> getData() {
|
|
|
|
public Map<K, V> getData() {
|
|
|
|
return data;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int length;
|
|
|
|
int length;
|
|
|
|
int radixTreeKeys;
|
|
|
|
int radixTreeKeys;
|
|
|
|
int radixTreeNodes;
|
|
|
|
int radixTreeNodes;
|
|
|
@ -64,10 +64,13 @@ public class StreamInfo<K, V> {
|
|
|
|
StreamMessageId lastGeneratedId;
|
|
|
|
StreamMessageId lastGeneratedId;
|
|
|
|
Entry<K, V> firstEntry;
|
|
|
|
Entry<K, V> firstEntry;
|
|
|
|
Entry<K, V> lastEntry;
|
|
|
|
Entry<K, V> lastEntry;
|
|
|
|
|
|
|
|
StreamMessageId maxDeletedEntryId;
|
|
|
|
|
|
|
|
int entriesAdded;
|
|
|
|
|
|
|
|
StreamMessageId recordedFirstEntryId;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns length of the stream
|
|
|
|
* Returns length of the stream
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return length of the stream
|
|
|
|
* @return length of the stream
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public int getLength() {
|
|
|
|
public int getLength() {
|
|
|
@ -76,10 +79,10 @@ public class StreamInfo<K, V> {
|
|
|
|
public void setLength(int length) {
|
|
|
|
public void setLength(int length) {
|
|
|
|
this.length = length;
|
|
|
|
this.length = length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns amount of keys allocated by Radix tree of the stream.
|
|
|
|
* Returns amount of keys allocated by Radix tree of the stream.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return amount of keys
|
|
|
|
* @return amount of keys
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public int getRadixTreeKeys() {
|
|
|
|
public int getRadixTreeKeys() {
|
|
|
@ -88,10 +91,10 @@ public class StreamInfo<K, V> {
|
|
|
|
public void setRadixTreeKeys(int radixTreeKeys) {
|
|
|
|
public void setRadixTreeKeys(int radixTreeKeys) {
|
|
|
|
this.radixTreeKeys = radixTreeKeys;
|
|
|
|
this.radixTreeKeys = radixTreeKeys;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns amount of nodes allocated by Radix tree of the stream.
|
|
|
|
* Returns amount of nodes allocated by Radix tree of the stream.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return amount of nodes
|
|
|
|
* @return amount of nodes
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public int getRadixTreeNodes() {
|
|
|
|
public int getRadixTreeNodes() {
|
|
|
@ -100,10 +103,10 @@ public class StreamInfo<K, V> {
|
|
|
|
public void setRadixTreeNodes(int radixTreeNodes) {
|
|
|
|
public void setRadixTreeNodes(int radixTreeNodes) {
|
|
|
|
this.radixTreeNodes = radixTreeNodes;
|
|
|
|
this.radixTreeNodes = radixTreeNodes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns amount of groups belonging to the stream
|
|
|
|
* Returns amount of groups belonging to the stream
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return amount of groups
|
|
|
|
* @return amount of groups
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public int getGroups() {
|
|
|
|
public int getGroups() {
|
|
|
@ -112,10 +115,10 @@ public class StreamInfo<K, V> {
|
|
|
|
public void setGroups(int groups) {
|
|
|
|
public void setGroups(int groups) {
|
|
|
|
this.groups = groups;
|
|
|
|
this.groups = groups;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns last StreamMessageId used by the stream
|
|
|
|
* Returns last StreamMessageId used by the stream
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return StreamMessageId object
|
|
|
|
* @return StreamMessageId object
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public StreamMessageId getLastGeneratedId() {
|
|
|
|
public StreamMessageId getLastGeneratedId() {
|
|
|
@ -124,10 +127,10 @@ public class StreamInfo<K, V> {
|
|
|
|
public void setLastGeneratedId(StreamMessageId lastGeneratedId) {
|
|
|
|
public void setLastGeneratedId(StreamMessageId lastGeneratedId) {
|
|
|
|
this.lastGeneratedId = lastGeneratedId;
|
|
|
|
this.lastGeneratedId = lastGeneratedId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns first stream entry
|
|
|
|
* Returns first stream entry
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return stream entry
|
|
|
|
* @return stream entry
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Entry<K, V> getFirstEntry() {
|
|
|
|
public Entry<K, V> getFirstEntry() {
|
|
|
@ -139,7 +142,7 @@ public class StreamInfo<K, V> {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns last stream entry
|
|
|
|
* Returns last stream entry
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return stream entry
|
|
|
|
* @return stream entry
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Entry<K, V> getLastEntry() {
|
|
|
|
public Entry<K, V> getLastEntry() {
|
|
|
@ -148,5 +151,43 @@ public class StreamInfo<K, V> {
|
|
|
|
public void setLastEntry(Entry<K, V> lastEntry) {
|
|
|
|
public void setLastEntry(Entry<K, V> lastEntry) {
|
|
|
|
this.lastEntry = lastEntry;
|
|
|
|
this.lastEntry = lastEntry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Returns the maximal entry ID that was deleted from the stream
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return StreamMessageId object
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public StreamMessageId getMaxDeletedEntryId() {
|
|
|
|
|
|
|
|
return maxDeletedEntryId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public StreamInfo<K, V> setMaxDeletedEntryId(StreamMessageId maxDeletedEntryId) {
|
|
|
|
|
|
|
|
this.maxDeletedEntryId = maxDeletedEntryId;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Returns the count of all entries added to the stream during its lifetime
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return entries count
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public int getEntriesAdded() {
|
|
|
|
|
|
|
|
return entriesAdded;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public StreamInfo<K, V> setEntriesAdded(int entriesAdded) {
|
|
|
|
|
|
|
|
this.entriesAdded = entriesAdded;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Returns the first ID what was added to the stream
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return StreamMessageId object
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public StreamMessageId getRecordedFirstEntryId() {
|
|
|
|
|
|
|
|
return recordedFirstEntryId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public StreamInfo<K, V> setRecordedFirstEntryId(StreamMessageId recordedFirstEntryId) {
|
|
|
|
|
|
|
|
this.recordedFirstEntryId = recordedFirstEntryId;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|