public interface ProxyClient<S>
| Modifier and Type | Method and Description |
|---|---|
default CompletableFuture<Void> |
acceptAll(Consumer<S> operation)
Submits an empty operation to all partitions.
|
default CompletableFuture<Void> |
acceptBy(String key,
Consumer<S> operation)
Submits an empty operation to the owning partition for the given key.
|
default CompletableFuture<Void> |
acceptOn(PartitionId partitionId,
Consumer<S> operation)
Submits an empty operation to the given partition.
|
void |
addStateChangeListener(Consumer<PrimitiveState> listener)
Registers a session state change listener.
|
default <R> CompletableFuture<Stream<R>> |
applyAll(Function<S,R> operation)
Submits an empty operation to all partitions.
|
default <R> CompletableFuture<R> |
applyBy(Object key,
Function<S,R> operation)
Submits an empty operation to the owning partition for the given key.
|
default <R> CompletableFuture<R> |
applyBy(String key,
Function<S,R> operation)
Submits an empty operation to the owning partition for the given key.
|
default <R> CompletableFuture<R> |
applyOn(PartitionId partitionId,
Function<S,R> operation)
Submits an empty operation to the given partition.
|
CompletableFuture<Void> |
close()
Closes the proxy client.
|
CompletableFuture<ProxyClient<S>> |
connect()
Connects the proxy client.
|
default ProxySession<S> |
getPartition(Object key)
Returns the partition proxy for the given key.
|
ProxySession<S> |
getPartition(PartitionId partitionId)
Returns the proxy with the given identifier.
|
default ProxySession<S> |
getPartition(String key)
Returns the partition proxy for the given key.
|
PartitionId |
getPartitionId(Object key)
Returns the partition ID for the given key.
|
PartitionId |
getPartitionId(String key)
Returns the partition ID for the given key.
|
Collection<PartitionId> |
getPartitionIds()
Returns the collection of all partition IDs.
|
Collection<ProxySession<S>> |
getPartitions()
Returns the collection of all partition proxies.
|
PrimitiveState |
getState()
Returns the session state.
|
String |
name()
Returns the primitive name.
|
PrimitiveProtocol |
protocol()
Returns the client proxy protocol.
|
default void |
register(Object client)
Registers a client proxy.
|
void |
removeStateChangeListener(Consumer<PrimitiveState> listener)
Removes a state change listener.
|
PrimitiveType |
type()
Returns the client proxy type.
|
String name()
PrimitiveType type()
PrimitiveProtocol protocol()
PrimitiveState getState()
Collection<ProxySession<S>> getPartitions()
Collection<PartitionId> getPartitionIds()
ProxySession<S> getPartition(PartitionId partitionId)
partitionId - the partition with the given identifierPartitionId getPartitionId(String key)
key - the key for which to return the partition IDPartitionId getPartitionId(Object key)
key - the key for which to return the partition IDdefault ProxySession<S> getPartition(String key)
key - the key for which to return the partition proxydefault ProxySession<S> getPartition(Object key)
key - the key for which to return the partition proxydefault void register(Object client)
client - the client proxy to registerdefault CompletableFuture<Void> acceptAll(Consumer<S> operation)
operation - the operation identifierPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault <R> CompletableFuture<Stream<R>> applyAll(Function<S,R> operation)
R - the operation result typeoperation - the operation identifierPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault CompletableFuture<Void> acceptOn(PartitionId partitionId, Consumer<S> operation)
partitionId - the partition in which to execute the operationoperation - the operation identifierPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault <R> CompletableFuture<R> applyOn(PartitionId partitionId, Function<S,R> operation)
R - the operation result typepartitionId - the partition in which to execute the operationoperation - the operation identifierPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault CompletableFuture<Void> acceptBy(String key, Consumer<S> operation)
key - the key for which to submit the operationoperation - the operationPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault <R> CompletableFuture<R> applyBy(String key, Function<S,R> operation)
R - the operation result typekey - the key for which to submit the operationoperation - the operationPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault <R> CompletableFuture<R> applyBy(Object key, Function<S,R> operation)
R - the operation result typekey - the key for which to submit the operationoperation - the operationPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nullvoid addStateChangeListener(Consumer<PrimitiveState> listener)
listener - The callback to call when the session state changes.void removeStateChangeListener(Consumer<PrimitiveState> listener)
listener - the state change listener to removeCompletableFuture<ProxyClient<S>> connect()
CompletableFuture<Void> close()
Copyright © 2013–2018. All rights reserved.