transport

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerResolver

type ContainerResolver func(id uint64) (metadata.Container, error)

ContainerResolver container resolver func

type MessageHandler

type MessageHandler func(msg interface{})

MessageHandler message handler

type Option

type Option func(*options)

Option transport option

func WithErrorHandler

func WithErrorHandler(value func(*bhraftpb.RaftMessage, error)) Option

WithErrorHandler set error handler

func WithMaxBodyBytes

func WithMaxBodyBytes(value int) Option

WithMaxBodyBytes set max body bytes for decode message

func WithSendBatch

func WithSendBatch(value int64) Option

WithSendBatch set batch size for sending messages

func WithTimeout

func WithTimeout(read, write time.Duration) Option

WithTimeout set read and write timeout for rpc

func WithWorkerCount

func WithWorkerCount(raft, snap uint64) Option

WithWorkerCount set worker count for send raft messages

type Transport

type Transport interface {
	// Start start the transport, receiving and sending messages
	Start()
	// Stop stop the transport
	Stop()
	// Send send the raft message to other node
	Send(*bhraftpb.RaftMessage)
	// SendingSnapshotCount returns the count of sending snapshots
	SendingSnapshotCount() uint64
}

Transport raft transport

func NewDefaultTransport

func NewDefaultTransport(
	storeID uint64,
	addr string,
	snapMgr snapshot.SnapshotManager,
	handler MessageHandler,
	resolver ContainerResolver,
	opts ...Option) Transport

NewDefaultTransport create default transport

Jump to

Keyboard shortcuts

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