Documentation ¶
Index ¶
- Variables
- type ChannelManager
- func (cm *ChannelManager) AssignPChannels(ctx context.Context, ...) (map[string]*PChannelMeta, error)
- func (cm *ChannelManager) AssignPChannelsDone(ctx context.Context, pChannels []string) error
- func (cm *ChannelManager) CurrentPChannelsView() map[string]*PChannelMeta
- func (cm *ChannelManager) MarkAsUnavailable(ctx context.Context, pChannels []types.PChannelInfo) error
- func (cm *ChannelManager) WatchAssignmentResult(ctx context.Context, ...) error
- type PChannelMeta
- func (c *PChannelMeta) AssignHistories() []types.PChannelInfoAssigned
- func (c *PChannelMeta) ChannelInfo() types.PChannelInfo
- func (c *PChannelMeta) CopyForWrite() *mutablePChannel
- func (c *PChannelMeta) CurrentAssignment() types.PChannelInfoAssigned
- func (c *PChannelMeta) CurrentServerID() int64
- func (c *PChannelMeta) CurrentTerm() int64
- func (c *PChannelMeta) IsAssigned() bool
- func (c *PChannelMeta) Name() string
- func (c *PChannelMeta) State() streamingpb.PChannelMetaState
Constants ¶
This section is empty.
Variables ¶
var ErrChannelNotExist = errors.New("channel not exist")
Functions ¶
This section is empty.
Types ¶
type ChannelManager ¶
type ChannelManager struct {
// contains filtered or unexported fields
}
ChannelManager manages the channels. ChannelManager is the `wal` of channel assignment and unassignment. Every operation applied to the streaming node should be recorded in ChannelManager first.
func RecoverChannelManager ¶
func RecoverChannelManager(ctx context.Context, incomingChannel ...string) (*ChannelManager, error)
RecoverChannelManager creates a new channel manager.
func (*ChannelManager) AssignPChannels ¶
func (cm *ChannelManager) AssignPChannels(ctx context.Context, pChannelToStreamingNode map[string]types.StreamingNodeInfo) (map[string]*PChannelMeta, error)
AssignPChannels update the pchannels to servers and return the modified pchannels. When the balancer want to assign a pchannel into a new server. It should always call this function to update the pchannel assignment first. Otherwise, the pchannel assignment tracing is lost at meta.
func (*ChannelManager) AssignPChannelsDone ¶
func (cm *ChannelManager) AssignPChannelsDone(ctx context.Context, pChannels []string) error
AssignPChannelsDone clear up the history data of the pchannels and transfer the state into assigned. When the balancer want to cleanup the history data of a pchannel. It should always remove the pchannel on the server first. Otherwise, the pchannel assignment tracing is lost at meta.
func (*ChannelManager) CurrentPChannelsView ¶
func (cm *ChannelManager) CurrentPChannelsView() map[string]*PChannelMeta
CurrentPChannelsView returns the current view of pchannels.
func (*ChannelManager) MarkAsUnavailable ¶
func (cm *ChannelManager) MarkAsUnavailable(ctx context.Context, pChannels []types.PChannelInfo) error
MarkAsUnavailable mark the pchannels as unavailable.
func (*ChannelManager) WatchAssignmentResult ¶
func (cm *ChannelManager) WatchAssignmentResult(ctx context.Context, cb func(version typeutil.VersionInt64Pair, assignments []types.PChannelInfoAssigned) error) error
type PChannelMeta ¶
type PChannelMeta struct {
// contains filtered or unexported fields
}
PChannelMeta is the read only version of PChannelInfo, to be used in balancer, If you need to update PChannelMeta, please use CopyForWrite to get mutablePChannel.
func (*PChannelMeta) AssignHistories ¶
func (c *PChannelMeta) AssignHistories() []types.PChannelInfoAssigned
AssignHistories returns the history of the channel assignment.
func (*PChannelMeta) ChannelInfo ¶
func (c *PChannelMeta) ChannelInfo() types.PChannelInfo
ChannelInfo returns the channel info.
func (*PChannelMeta) CopyForWrite ¶
func (c *PChannelMeta) CopyForWrite() *mutablePChannel
CopyForWrite returns mutablePChannel to modify pchannel but didn't affect other replicas.
func (*PChannelMeta) CurrentAssignment ¶
func (c *PChannelMeta) CurrentAssignment() types.PChannelInfoAssigned
CurrentAssignment returns the current assignment of the channel.
func (*PChannelMeta) CurrentServerID ¶
func (c *PChannelMeta) CurrentServerID() int64
CurrentServerID returns the server id of the channel. If the channel is not assigned to any server, return -1.
func (*PChannelMeta) CurrentTerm ¶
func (c *PChannelMeta) CurrentTerm() int64
Term returns the current term of the channel.
func (*PChannelMeta) IsAssigned ¶
func (c *PChannelMeta) IsAssigned() bool
IsAssigned returns if the channel is assigned to a server.
func (*PChannelMeta) Name ¶
func (c *PChannelMeta) Name() string
Name returns the name of the channel.
func (*PChannelMeta) State ¶
func (c *PChannelMeta) State() streamingpb.PChannelMetaState
State returns the state of the channel.