Help us shape the future of Go! Take the 2026 Go Developer Survey

transport

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed indicates that the connection has been closed.
	ErrClosed = errors.New("connection closed")
	// ErrFailedToConnect indicates that connecting to the remote failed.
	ErrFailedToConnect = errors.New("failed to connect")
)

Functions

func NewChanTransport

func NewChanTransport(nhConfig config.NodeHostConfig,
	requestHandler raftio.MessageHandler,
	chunkHandler raftio.ChunkHandler) raftio.ITransport

NewChanTransport creates a new channel based test transport module.

Types

type ChanConnection

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

ChanConnection is a channel based connection.

func (*ChanConnection) Close

func (cc *ChanConnection) Close()

Close ...

func (*ChanConnection) SendMessageBatch

func (cc *ChanConnection) SendMessageBatch(batch pb.MessageBatch, bitset uint64) error

实现了一个基于通道的传输模块(ChanTransport),主要用于测试目的。 它模拟了网络传输的行为,使用Go的通道(channel)来代替实际的网络通信。 这个模块支持普通消息和快照数据的传输。以下是关键组件和功能的详细解析: SendMessageBatch ...

type ChanSSConnection

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

ChanSSConnection is a channel based snapshot connection.

func (*ChanSSConnection) Close

func (csc *ChanSSConnection) Close()

Close ...

func (*ChanSSConnection) SendChunk

func (csc *ChanSSConnection) SendChunk(chunk pb.Chunk) error

SendChunk ...

type ChanTransport

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

ChanTransport is a channel based transport module used for testing purposes.

func (*ChanTransport) Close

func (ct *ChanTransport) Close() error

Close ...

func (*ChanTransport) GetConnection

func (ct *ChanTransport) GetConnection(ctx context.Context,
	target string) (raftio.IConnection, error)

GetConnection ...

func (*ChanTransport) GetSnapshotConnection

func (ct *ChanTransport) GetSnapshotConnection(ctx context.Context,
	target string) (raftio.ISnapshotConnection, error)

GetSnapshotConnection ...

func (*ChanTransport) Name

func (ct *ChanTransport) Name() string

Name ...

func (*ChanTransport) Start

func (ct *ChanTransport) Start() error

Start ...

type ChanTransportFactory

type ChanTransportFactory struct{}

ChanTransportFactory is a channel based module used for testing purposes.

func (*ChanTransportFactory) Create

Create creates a channel based transport instance.

func (*ChanTransportFactory) Validate

func (ctm *ChanTransportFactory) Validate(addr string) bool

Validate returns a boolean value indicating whether the specified address is valid.

Jump to

Keyboard shortcuts

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