public interface PrimitiveProxy extends PrimitiveProxyExecutor
| Modifier and Type | Interface and Description |
|---|---|
static class |
PrimitiveProxy.State
Indicates the state of the client's communication with the Raft cluster.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(EventType eventType,
Consumer<byte[]> listener)
Adds a session event listener.
|
<T> void |
addEventListener(EventType eventType,
Function<byte[],T> decoder,
Consumer<T> listener)
Adds an event listener.
|
void |
addEventListener(EventType eventType,
Runnable listener)
Adds an empty session event listener.
|
CompletableFuture<Void> |
close()
Closes the primitive proxy.
|
CompletableFuture<PrimitiveProxy> |
connect()
Connects the primitive proxy.
|
PrimitiveProxy.State |
getState()
Returns the session state.
|
default CompletableFuture<Void> |
invoke(OperationId operationId)
Submits an empty operation to the Raft cluster, awaiting a void result.
|
default <R> CompletableFuture<R> |
invoke(OperationId operationId,
Function<byte[],R> decoder)
Submits an empty operation to the Raft cluster.
|
default <T> CompletableFuture<Void> |
invoke(OperationId operationId,
Function<T,byte[]> encoder,
T operation)
Submits an operation to the Raft cluster.
|
default <T,R> CompletableFuture<R> |
invoke(OperationId operationId,
Function<T,byte[]> encoder,
T operation,
Function<byte[],R> decoder)
Submits an operation to the Raft cluster.
|
String |
name()
Returns the client proxy name.
|
void |
removeEventListener(EventType eventType,
Consumer listener)
Removes a session event listener.
|
void |
removeEventListener(EventType eventType,
Runnable listener)
Removes an empty session event listener.
|
PrimitiveType |
serviceType()
Returns the client proxy type.
|
SessionId |
sessionId()
Returns the proxy session identifier.
|
addEventListener, addStateChangeListener, execute, execute, execute, removeEventListener, removeStateChangeListenerSessionId sessionId()
String name()
PrimitiveType serviceType()
PrimitiveProxy.State getState()
default CompletableFuture<Void> invoke(OperationId operationId)
operationId - the operation identifierPrimitiveOperation submission futures that preceded it. The future will always be completed on theNullPointerException - if operation is nulldefault <R> CompletableFuture<R> invoke(OperationId operationId, Function<byte[],R> decoder)
R - the operation result typeoperationId - the operation identifierdecoder - the operation result decoderPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault <T> CompletableFuture<Void> invoke(OperationId operationId, Function<T,byte[]> encoder, T operation)
T - the operation typeoperationId - the operation identifierencoder - the operation encoderPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is nulldefault <T,R> CompletableFuture<R> invoke(OperationId operationId, Function<T,byte[]> encoder, T operation, Function<byte[],R> decoder)
T - the operation typeR - the operation result typeoperationId - the operation identifierencoder - the operation encoderoperation - the operation to submitdecoder - the operation result decoderPrimitiveOperation submission futures that preceded it.NullPointerException - if operation is null<T> void addEventListener(EventType eventType, Function<byte[],T> decoder, Consumer<T> listener)
T - the event value type.eventType - the event type identifier.decoder - the event decoder.listener - the event listener.void addEventListener(EventType eventType, Runnable listener)
eventType - the event typelistener - the event listener to addvoid addEventListener(EventType eventType, Consumer<byte[]> listener)
eventType - the event type identifierlistener - the event listener to addvoid removeEventListener(EventType eventType, Runnable listener)
eventType - the event typelistener - the event listener to addvoid removeEventListener(EventType eventType, Consumer listener)
eventType - the event type identifierlistener - the event listener to removeCompletableFuture<PrimitiveProxy> connect()
CompletableFuture<Void> close()
Copyright © 2013–2018. All rights reserved.