transport

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Message(context.Context, etcdraftpb.Message) error
	Join(context.Context, raftpb.Member) (*raftpb.JoinResponse, error)
	PromoteMember(ctx context.Context, m raftpb.Member) error
	Close() error
}

Client provides access to the exported methods of an object across a network.

type Config

type Config interface {
	Controller() Controller
	Logger() raftlog.Logger
	GroupID() uint64
}

Config define common configuration used by the dial and transport handler.

type Controller

type Controller interface {
	Push(context.Context, uint64, etcdraftpb.Message) error
	Join(context.Context, uint64, *raftpb.Member) (*raftpb.JoinResponse, error)
	PromoteMember(context.Context, uint64, raftpb.Member) error
	SnapshotWriter(uint64, uint64, uint64) (io.WriteCloser, error)
	SnapshotReader(uint64, uint64, uint64) (io.ReadCloser, error)
}

Controller implements operations defined by raft raftpb. and acts as a bridge between the RPC and raft daemon.

type Dial

type Dial func(context.Context, string) (Client, error)

Dial connects to an RPC server at the specified network address.

type Dialer

type Dialer func(Config) Dial

Dialer return's Dial from the given config.

type Handler

type Handler interface{}

Handler responds to an RPC request.

type NewHandler

type NewHandler func(Config) Handler

NewHandler returns a new Handler.

type Proto

type Proto uint

Proto is a portmanteau of protocol and represents the underlying RPC protocol.

const (
	// GRPC represents raft transportation using gRPC.
	GRPC Proto = iota + 1
	// HTTP represents raft transportation using http.
	HTTP
)

func (Proto) Available

func (c Proto) Available() bool

Available reports whether the given proto is linked into the binary.

func (Proto) Get

func (c Proto) Get() (NewHandler, Dialer)

Get returns proto server and client. Get panics if the proto function is not linked into the binary.

func (Proto) Register

func (c Proto) Register(nh NewHandler, dial Dialer)

Register registers a function that returns a proto server and client, of the given proto function. This is intended to be called from the init function, in packages that implement proto function.

func (Proto) String

func (c Proto) String() string

String returns string describes the proto function.

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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