Documentation ¶
Index ¶
- Constants
- Variables
- func NewHandler(p Processor, cid types.ID) http.Handler
- func NewSender(tr http.RoundTripper, u string, id types.ID, cid types.ID, p Processor, ...) *sender
- func NewStreamHandler(finder SenderFinder, id, cid types.ID) http.Handler
- type Batcher
- type Processor
- type ProposalBatcher
- type Sender
- type SenderFinder
- type WriteFlusher
Constants ¶
View Source
const ( ConnReadTimeout = 5 * time.Second ConnWriteTimeout = 5 * time.Second )
View Source
const (
ConnReadLimitByte = 64 * 1024
)
Variables ¶
View Source
var ( RaftPrefix = "/raft" RaftStreamPrefix = path.Join(RaftPrefix, "stream") )
Functions ¶
func NewSender ¶
func NewSender(tr http.RoundTripper, u string, id types.ID, cid types.ID, p Processor, fs *stats.FollowerStats, shouldstop chan struct{}) *sender
func NewStreamHandler ¶
func NewStreamHandler(finder SenderFinder, id, cid types.ID) http.Handler
NewStreamHandler returns a handler which initiates streamer when receiving stream request from follower.
Types ¶
type ProposalBatcher ¶
func NewProposalBatcher ¶
func NewProposalBatcher(n int, d time.Duration) *ProposalBatcher
func (*ProposalBatcher) Batch ¶
func (b *ProposalBatcher) Batch(m raftpb.Message)
func (*ProposalBatcher) IsEmpty ¶
func (b *ProposalBatcher) IsEmpty() bool
func (*ProposalBatcher) Reset ¶
func (b *ProposalBatcher) Reset(t time.Time)
type Sender ¶
type Sender interface { // StartStreaming enables streaming in the sender using the given writer, // which provides a fast and efficient way to send appendEntry messages. StartStreaming(w WriteFlusher, to types.ID, term uint64) (done <-chan struct{}, err error) Update(u string) // Send sends the data to the remote node. It is always non-blocking. // It may be fail to send data if it returns nil error. Send(m raftpb.Message) error // Stop performs any necessary finalization and terminates the Sender // elegantly. Stop() // Pause pauses the sender. The sender will simply drops all incoming // messages without retruning an error. Pause() // Resume resumes a paused sender. Resume() }
type SenderFinder ¶
Click to show internal directories.
Click to hide internal directories.