Interface PartitionChunk<T>
-
- All Superinterfaces:
Comparable<PartitionChunk<T>>
- All Known Implementing Classes:
IntegerPartitionChunk
,LinearPartitionChunk
,NumberedOverwritingPartitionChunk
,NumberedPartitionChunk
,SingleElementPartitionChunk
,StringPartitionChunk
,TombstonePartitionedChunk
public interface PartitionChunk<T> extends Comparable<PartitionChunk<T>>
A PartitionChunk represents a chunk of a partitioned(sharded) space. It has knowledge of whether it is the start of the domain of partitions, the end of the domain, if it abuts another partition and where it stands inside of a sorted collection of partitions. The ordering of PartitionChunks is based entirely upon the partition boundaries defined inside the concrete PartitionChunk class. That is, the payload (the object returned by getObject()) should *not* be involved in comparisons between PartitionChunk objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
abuts(PartitionChunk<T> chunk)
Determines if this PartitionChunk abuts another PartitionChunk.int
getChunkNumber()
Returns the partition chunk number of this PartitionChunk.T
getObject()
Returns the payload, generally an object that can be used to perform some action against the shard.boolean
isEnd()
Returns true if this chunk is the end of the partition.boolean
isStart()
Returns true if this chunk is the beginning of the partition.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
getObject
T getObject()
Returns the payload, generally an object that can be used to perform some action against the shard.- Returns:
- the payload
-
abuts
boolean abuts(PartitionChunk<T> chunk)
Determines if this PartitionChunk abuts another PartitionChunk. A sequence of abutting PartitionChunks should start with an object where isStart() == true and eventually end with an object where isEnd() == true.- Parameters:
chunk
- input chunk- Returns:
- true if this chunk abuts the input chunk
-
isStart
boolean isStart()
Returns true if this chunk is the beginning of the partition. Most commonly, that means it represents the range [-infinity, X) for some concrete X.- Returns:
- true if the chunk is the beginning of the partition
-
isEnd
boolean isEnd()
Returns true if this chunk is the end of the partition. Most commonly, that means it represents the range [X, infinity] for some concrete X.- Returns:
- true if the chunk is the end of the partition
-
getChunkNumber
int getChunkNumber()
Returns the partition chunk number of this PartitionChunk. I.e. if there are 4 partitions in total and this is the 3rd partition, it will return 2- Returns:
- the sequential numerical id of this partition chunk
-
-