types

package
v0.0.0-...-572c485 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitialTerm int64 = -1
)

Variables

View Source
var (
	ErrStopping = errors.New("streaming node is stopping")
	ErrNotAlive = errors.New("streaming node is not alive")
)

Functions

func NewProtoFromPChannelInfo

func NewProtoFromPChannelInfo(pchannel PChannelInfo) *streamingpb.PChannelInfo

NewProtoFromPChannelInfo converts PChannelInfo to protobuf PChannelInfo

func NewProtoFromStreamingNodeInfo

func NewProtoFromStreamingNodeInfo(info StreamingNodeInfo) *streamingpb.StreamingNodeInfo

NewProtoFromStreamingNodeInfo creates a proto from StreamingNodeInfo.

Types

type AssignmentDiscoverWatcher

type AssignmentDiscoverWatcher interface {
	// AssignmentDiscover watches the assignment discovery.
	// The callback will be called when the discovery is changed.
	// The final error will be returned when the watcher is closed or broken.
	AssignmentDiscover(ctx context.Context, cb func(*VersionedStreamingNodeAssignments) error) error

	AssignmentRebalanceTrigger
}

AssignmentDiscoverWatcher is the interface for watching the assignment discovery.

type AssignmentRebalanceTrigger

type AssignmentRebalanceTrigger interface {
	// ReportStreamingError is used to report the streaming error.
	// Trigger a re-balance of the pchannel.
	ReportAssignmentError(ctx context.Context, pchannel PChannelInfo, err error) error
}

AssignmentRebalanceTrigger is the interface for triggering the re-balance of the pchannel.

type PChannelInfo

type PChannelInfo struct {
	Name string // name of pchannel.
	Term int64  // term of pchannel.
}

PChannelInfo is the struct for pchannel info.

func NewPChannelInfoFromProto

func NewPChannelInfoFromProto(pchannel *streamingpb.PChannelInfo) PChannelInfo

NewPChannelInfoFromProto converts protobuf PChannelInfo to PChannelInfo

func (*PChannelInfo) String

func (c *PChannelInfo) String() string

type PChannelInfoAssigned

type PChannelInfoAssigned struct {
	Channel PChannelInfo
	Node    StreamingNodeInfo
}

type StreamingNodeAssignment

type StreamingNodeAssignment struct {
	NodeInfo StreamingNodeInfo
	Channels map[string]PChannelInfo
}

StreamingNodeAssignment is the relation between server and channels.

type StreamingNodeInfo

type StreamingNodeInfo struct {
	ServerID int64
	Address  string
}

StreamingNodeInfo is the relation between server and channels.

func NewStreamingNodeInfoFromProto

func NewStreamingNodeInfoFromProto(proto *streamingpb.StreamingNodeInfo) StreamingNodeInfo

NewStreamingNodeInfoFromProto creates a StreamingNodeInfo from proto.

type StreamingNodeStatus

type StreamingNodeStatus struct {
	StreamingNodeInfo
	// TODO: balance attributes should added here in future.
	Err error
}

StreamingNodeStatus is the information of a streaming node.

func (*StreamingNodeStatus) ErrorOfNode

func (n *StreamingNodeStatus) ErrorOfNode() error

ErrorOfNode returns the error of the streaming node.

func (*StreamingNodeStatus) IsHealthy

func (n *StreamingNodeStatus) IsHealthy() bool

IsHealthy returns whether the streaming node is healthy.

type VersionedStreamingNodeAssignments

type VersionedStreamingNodeAssignments struct {
	Version     typeutil.VersionInt64Pair
	Assignments map[int64]StreamingNodeAssignment
}

VersionedStreamingNodeAssignments is the relation between server and channels with version.

Jump to

Keyboard shortcuts

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