rafthttp

package
v2.0.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2015 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

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 NewHandler

func NewHandler(r Raft, cid types.ID) http.Handler

func NewPeer

func NewPeer(tr http.RoundTripper, u string, id types.ID, cid types.ID, r Raft, fs *stats.FollowerStats, errorc chan error) *peer

func NewStreamHandler

func NewStreamHandler(tr *transport, id, cid types.ID) http.Handler

NewStreamHandler returns a handler which initiates streamer when receiving stream request from follower.

Types

type Batcher

type Batcher struct {
	// contains filtered or unexported fields
}

func NewBatcher

func NewBatcher(n int, d time.Duration) *Batcher

func (*Batcher) Reset

func (b *Batcher) Reset(t time.Time)

func (*Batcher) ShouldBatch

func (b *Batcher) ShouldBatch(now time.Time) bool

type Pausable

type Pausable interface {
	Pause()
	Resume()
}

type ProposalBatcher

type ProposalBatcher struct {
	*Batcher
	raftpb.Message
}

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 Raft

type Raft interface {
	Process(ctx context.Context, m raftpb.Message) error
}

type Transporter

type Transporter interface {
	Handler() http.Handler
	Send(m []raftpb.Message)
	AddPeer(id types.ID, urls []string)
	RemovePeer(id types.ID)
	UpdatePeer(id types.ID, urls []string)
	Stop()
}

func NewTransporter

func NewTransporter(rt http.RoundTripper, id, cid types.ID, r Raft, errorc chan error, ss *stats.ServerStats, ls *stats.LeaderStats) Transporter

type WriteFlusher

type WriteFlusher interface {
	io.Writer
	http.Flusher
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL