Package io.atomix.primitive.log
Interface LogClient
public interface LogClient
Log client.
-
Method Summary
Modifier and Type Method Description void
addStateChangeListener(java.util.function.Consumer<PrimitiveState> listener)
Registers a session state change listener.CompletableFuture<Void>
close()
Closes the log client.CompletableFuture<LogClient>
connect()
Connects the log client.LogSession
getPartition(PartitionId partitionId)
Returns the partition with the given identifier.default LogSession
getPartition(String key)
Returns the partition 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<LogSession>
getPartitions()
Returns the collection of all partitions.LogProtocol
protocol()
Returns the client log protocol.void
removeStateChangeListener(java.util.function.Consumer<PrimitiveState> listener)
Removes a state change listener.PrimitiveState
state()
Returns the log client state.
-
Method Details
-
protocol
LogProtocol protocol()Returns the client log protocol.- Returns:
- the client log protocol
-
state
PrimitiveState state()Returns the log client state.- Returns:
- the log client state
-
getPartitions
Collection<LogSession> getPartitions()Returns the collection of all partitions.- Returns:
- the collection of all partitions
-
getPartitionIds
Collection<PartitionId> getPartitionIds()Returns the collection of all partition IDs.- Returns:
- the collection of all partition IDs
-
getPartition
Returns the partition with the given identifier.- Parameters:
partitionId
- the partition with the given identifier- Returns:
- the partition with the given identifier
-
getPartitionId
Returns the partition ID for the given key.- Parameters:
key
- the key for which to return the partition ID- Returns:
- the partition ID for the given key
-
getPartition
Returns the partition for the given key.- Parameters:
key
- the key for which to return the partition- Returns:
- the partition for the given key
-
addStateChangeListener
Registers a session state change listener.- Parameters:
listener
- The callback to call when the session state changes.
-
removeStateChangeListener
Removes a state change listener.- Parameters:
listener
- the state change listener to remove
-
connect
CompletableFuture<LogClient> connect()Connects the log client.- Returns:
- a future to be completed once the log client has been connected
-
close
CompletableFuture<Void> close()Closes the log client.- Returns:
- a future to be completed once the log client has been closed
-