transport

package
v0.0.0-...-1d14c1d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransport

func NewTransport(
	ctx context.Context, changefeed model.ChangeFeedID, role Role,
	server *p2p.MessageServer, router p2p.MessageRouter,
) (*p2pTransport, error)

NewTransport returns a new transport.

Types

type MockTrans

type MockTrans struct {
	SendBuffer []*schedulepb.Message
	RecvBuffer []*schedulepb.Message

	KeepRecvBuffer bool
}

MockTrans mocks transport, used in tests.

func NewMockTrans

func NewMockTrans() *MockTrans

NewMockTrans returns a new mock transport.

func (*MockTrans) Close

func (m *MockTrans) Close() error

Close mock transport.

func (*MockTrans) Recv

func (m *MockTrans) Recv(ctx context.Context) ([]*schedulepb.Message, error)

Recv receives messages.

func (*MockTrans) Send

func (m *MockTrans) Send(ctx context.Context, msgs []*schedulepb.Message) error

Send sends messages.

type Role

type Role string

Role of the transport user.

const (
	// AgentRole is the role of agent.
	AgentRole Role = "agent"
	// SchedulerRole is the role of scheduler.
	SchedulerRole Role = "scheduler"
)

type Transport

type Transport interface {
	Send(ctx context.Context, msgs []*schedulepb.Message) error
	Recv(ctx context.Context) ([]*schedulepb.Message, error)
	Close() error
}

Transport is an interface of message channel between scheduler and agent.

Jump to

Keyboard shortcuts

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