Documentation ¶
Overview ¶
Package raftredcon provides a raft transport using the Redis protocol.
Index ¶
- func Do(addr string, buf []byte, args ...[]byte) (resp []byte, nbuf []byte, err error)
- func ReadRawResponse(rd *bufio.Reader) (raw []byte, kind byte, err error)
- type RedconTransport
- func (t *RedconTransport) AppendEntries(target string, args *raft.AppendEntriesRequest, ...) error
- func (t *RedconTransport) AppendEntriesPipeline(target string) (raft.AppendPipeline, error)
- func (t *RedconTransport) Close() error
- func (t *RedconTransport) Consumer() <-chan raft.RPC
- func (t *RedconTransport) DecodePeer(peer []byte) string
- func (t *RedconTransport) EncodePeer(peer string) []byte
- func (t *RedconTransport) InstallSnapshot(target string, args *raft.InstallSnapshotRequest, ...) error
- func (t *RedconTransport) LocalAddr() string
- func (t *RedconTransport) RequestVote(target string, args *raft.RequestVoteRequest, resp *raft.RequestVoteResponse) error
- func (t *RedconTransport) SetHeartbeatHandler(cb func(rpc raft.RPC))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
Do is a helper function that makes a very simple remote request with the specified command. The addr param is the target server address. The buf param is an optional reusable buffer, this can be nil. The args are the command arguments such as "SET", "key", "value". Return response is a bulk, string, or an error. The nbuf is a reuseable buffer, this can be ignored.
Types ¶
type RedconTransport ¶
type RedconTransport struct {
// contains filtered or unexported fields
}
func NewRedconTransport ¶
func (*RedconTransport) AppendEntries ¶
func (t *RedconTransport) AppendEntries(target string, args *raft.AppendEntriesRequest, resp *raft.AppendEntriesResponse) error
AppendEntries implements the Transport interface.
func (*RedconTransport) AppendEntriesPipeline ¶
func (t *RedconTransport) AppendEntriesPipeline(target string) (raft.AppendPipeline, error)
AppendEntriesPipeline returns an interface that can be used to pipeline AppendEntries requests.
func (*RedconTransport) Close ¶
func (t *RedconTransport) Close() error
Close is used to permanently disable the transport
func (*RedconTransport) Consumer ¶
func (t *RedconTransport) Consumer() <-chan raft.RPC
Consumer implmenents the Transport interface.
func (*RedconTransport) DecodePeer ¶
func (t *RedconTransport) DecodePeer(peer []byte) string
DecodePeer implmenents the Transport interface.
func (*RedconTransport) EncodePeer ¶
func (t *RedconTransport) EncodePeer(peer string) []byte
EncodePeer implmenents the Transport interface.
func (*RedconTransport) InstallSnapshot ¶
func (t *RedconTransport) InstallSnapshot( target string, args *raft.InstallSnapshotRequest, resp *raft.InstallSnapshotResponse, data io.Reader, ) error
InstallSnapshot implmenents the Transport interface.
func (*RedconTransport) LocalAddr ¶
func (t *RedconTransport) LocalAddr() string
LocalAddr implmenents the Transport interface.
func (*RedconTransport) RequestVote ¶
func (t *RedconTransport) RequestVote(target string, args *raft.RequestVoteRequest, resp *raft.RequestVoteResponse) error
RequestVote implements the Transport interface.
func (*RedconTransport) SetHeartbeatHandler ¶
func (t *RedconTransport) SetHeartbeatHandler(cb func(rpc raft.RPC))
SetHeartbeatHandler implmenents the Transport interface.