public interface Depot extends PartitionedObject
RamaClusterManager
on a real cluster or
InProcessCluster
in a test environment.
declareDepot
.Modifier and Type | Interface and Description |
---|---|
static interface |
Depot.Declaration
Builder-style object to specify options when declaring a depot in a module
|
static interface |
Depot.Partitioning<T>
Interface for implementing custom depot partitioners
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
append(java.lang.Object data)
Append data to depot using
AckLevel.ACK . |
java.util.Map<java.lang.String,java.lang.Object> |
append(java.lang.Object data,
AckLevel ackLevel)
Append data to depot using specified
AckLevel . |
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> |
appendAsync(java.lang.Object data)
Append data to depot using
AckLevel.ACK . |
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> |
appendAsync(java.lang.Object data,
AckLevel ackLevel)
Append data to depot using specified
AckLevel . |
static com.rpl.rama.impl.NativeDepotPartitioning |
disallow()
Disallows depot clients from appending to this depot.
|
DepotPartitionInfo |
getPartitionInfo(long partitionIndex)
Retrieves the start and end offsets of the log for the specified partition index of the depot.
|
java.util.concurrent.CompletableFuture<DepotPartitionInfo> |
getPartitionInfoAsync(long partitionIndex)
Retrieves the start and end offsets of the log for the specified partition index of the depot.
|
static <T extends RamaFunction1> |
hashBy(java.lang.Class<T> keyExtractorClass)
Depot partitioning based on hashing a value from the data being appended.
|
static com.rpl.rama.impl.NativeDepotPartitioning |
hashBy(com.rpl.rama.impl.NativeRamaFunction1 keyExtractor)
Depot partitioning based on hashing a value from the data being appended.
|
static <T extends RamaFunction1> |
hashBy(java.lang.String key)
Depot partitioning based on hashing a value from the data being appended.
|
static com.rpl.rama.impl.NativeDepotPartitioning |
random()
Depot partitioning where each append goes to a random partition
|
java.util.List<java.lang.Object> |
read(long partitionIndex,
long startOffset,
long endOffset)
Reads records from the log for the specified partition index of the depot, between the given start and end offsets.
|
java.util.concurrent.CompletableFuture<java.util.List<java.lang.Object>> |
readAsync(long partitionIndex,
long startOffset,
long endOffset)
Reads records from the log for the specified partition index of the depot, between the given start and end offsets.
|
getObjectInfo
static com.rpl.rama.impl.NativeDepotPartitioning random()
static com.rpl.rama.impl.NativeDepotPartitioning hashBy(com.rpl.rama.impl.NativeRamaFunction1 keyExtractor)
Depot.hashBy(Ops.FIRST)
hashes based on first value in appended datakeyExtractor
- Built-in function to extract hashing value from appended datastatic <T extends RamaFunction1> com.rpl.rama.impl.NativeDepotPartitioning hashBy(java.lang.Class<T> keyExtractorClass)
keyExtractorClass
- Class implementing function to extract hashing value from appended datahashBy(NativeRamaFunction1)
static <T extends RamaFunction1> com.rpl.rama.impl.NativeDepotPartitioning hashBy(java.lang.String key)
Map
interface.key
- Key to use to extract the hashing value from the depot recordstatic com.rpl.rama.impl.NativeDepotPartitioning disallow()
depotPartitionAppend
. Useful
for publishing an event stream from a module.java.util.Map<java.lang.String,java.lang.Object> append(java.lang.Object data)
AckLevel.ACK
. Blocks until completion.data
- Data to appendjava.util.Map<java.lang.String,java.lang.Object> append(java.lang.Object data, AckLevel ackLevel)
AckLevel
. Blocks until completion.data
- Data to appendackLevel
- Ack level to useAckLevel.ACK
is set. Otherwise returns empty map.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> appendAsync(java.lang.Object data)
AckLevel.ACK
. Non-blocking.data
- Data to appendjava.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> appendAsync(java.lang.Object data, AckLevel ackLevel)
AckLevel
. Non-blocking.data
- Data to appendackLevel
- Ack level to useAckLevel
is met. If AckLevel.ACK
is set, delivered with map from topology name to streaming ack return for colocated stream topologies. Otherwise, delivered map is empty.DepotPartitionInfo getPartitionInfo(long partitionIndex)
partitionIndex
- The partition index for which to retrieve offset information.DepotPartitionInfo
object that provides methods to access the offsets.java.util.concurrent.CompletableFuture<DepotPartitionInfo> getPartitionInfoAsync(long partitionIndex)
partitionIndex
- The partition index for which to retrieve offset information.DepotPartitionInfo
object providing methods to access the offsets.java.util.List<java.lang.Object> read(long partitionIndex, long startOffset, long endOffset)
partitionIndex
- The partition index from which to read records.startOffset
- The starting offset (inclusive) from which to fetch records.endOffset
- The ending offset (exclusive) up to which records will be fetched.java.util.concurrent.CompletableFuture<java.util.List<java.lang.Object>> readAsync(long partitionIndex, long startOffset, long endOffset)
partitionIndex
- The partition index from which to read records.startOffset
- The starting offset (inclusive) from which to fetch records.endOffset
- The ending offset (exclusive) up to which records will be fetched.