public interface DataStreamApi extends Closeable
RaftGroup.
Clients may stream data to the nearest server and then the server will forward the data to the other servers.
Once all the servers have received all the data of a request,
the leader (may or may not be the nearest server) creates a log entry with a data ID generated by the state machine.
Then, the leader sends the log entry to the followers.
Since the followers already have received the data from the stream,
they may lookup the data from the ID.
Since this API allows clients to send data to the nearest server which is not necessarily the leader,
this API is more efficient for network-topology-aware clusters
than the other APIs that require clients to send data/messages to the leader.
Note that this API is different from MessageStreamApi in the sense that
this API streams data to all the servers in the RaftGroup
but MessageStreamApi streams messages only to the leader.| 限定符和类型 | 方法和说明 |
|---|---|
default DataStreamOutput |
stream()
Create a stream to write data.
|
DataStreamOutput |
stream(ByteBuffer headerMessage)
Create a stream by providing a customized header message.
|
DataStreamOutput |
stream(ByteBuffer headerMessage,
RoutingTable routingTable)
Create a stream by providing a customized header message and route table.
|
default DataStreamOutput stream()
DataStreamOutput stream(ByteBuffer headerMessage)
DataStreamOutput stream(ByteBuffer headerMessage, RoutingTable routingTable)
Copyright © 2017–2025 The Apache Software Foundation. All rights reserved.