session

package
v0.0.0-...-34e0b2d Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NormalStateName   = "Normal"
	StoppingStateName = "Stopping"
	SuspendStateName  = "Suspend"
)

Variables

View Source
var ErrNodeNotFound = errors.New("NodeNotFound")

Functions

func DefaultQueryNodeCreator

func DefaultQueryNodeCreator(ctx context.Context, addr string, nodeID int64) (types.QueryNodeClient, error)

func WrapErrNodeNotFound

func WrapErrNodeNotFound(nodeID int64) error

Types

type Cluster

type Cluster interface {
	WatchDmChannels(ctx context.Context, nodeID int64, req *querypb.WatchDmChannelsRequest) (*commonpb.Status, error)
	UnsubDmChannel(ctx context.Context, nodeID int64, req *querypb.UnsubDmChannelRequest) (*commonpb.Status, error)
	LoadSegments(ctx context.Context, nodeID int64, req *querypb.LoadSegmentsRequest) (*commonpb.Status, error)
	ReleaseSegments(ctx context.Context, nodeID int64, req *querypb.ReleaseSegmentsRequest) (*commonpb.Status, error)
	LoadPartitions(ctx context.Context, nodeID int64, req *querypb.LoadPartitionsRequest) (*commonpb.Status, error)
	ReleasePartitions(ctx context.Context, nodeID int64, req *querypb.ReleasePartitionsRequest) (*commonpb.Status, error)
	GetDataDistribution(ctx context.Context, nodeID int64, req *querypb.GetDataDistributionRequest) (*querypb.GetDataDistributionResponse, error)
	GetMetrics(ctx context.Context, nodeID int64, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error)
	SyncDistribution(ctx context.Context, nodeID int64, req *querypb.SyncDistributionRequest) (*commonpb.Status, error)
	GetComponentStates(ctx context.Context, nodeID int64) (*milvuspb.ComponentStates, error)
	Start()
	Stop()
}

type ImmutableNodeInfo

type ImmutableNodeInfo struct {
	NodeID   int64
	Address  string
	Hostname string
	Version  semver.Version
}

type Manager

type Manager interface {
	Add(node *NodeInfo)
	Stopping(nodeID int64)
	Remove(nodeID int64)
	Get(nodeID int64) *NodeInfo
	GetAll() []*NodeInfo

	Suspend(nodeID int64) error
	Resume(nodeID int64) error
}

type MockCluster

type MockCluster struct {
	mock.Mock
}

MockCluster is an autogenerated mock type for the Cluster type

func NewMockCluster

func NewMockCluster(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCluster

NewMockCluster creates a new instance of MockCluster. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCluster) EXPECT

func (_m *MockCluster) EXPECT() *MockCluster_Expecter

func (*MockCluster) GetComponentStates

func (_m *MockCluster) GetComponentStates(ctx context.Context, nodeID int64) (*milvuspb.ComponentStates, error)

GetComponentStates provides a mock function with given fields: ctx, nodeID

func (*MockCluster) GetDataDistribution

GetDataDistribution provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) GetMetrics

GetMetrics provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) LoadPartitions

func (_m *MockCluster) LoadPartitions(ctx context.Context, nodeID int64, req *querypb.LoadPartitionsRequest) (*commonpb.Status, error)

LoadPartitions provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) LoadSegments

func (_m *MockCluster) LoadSegments(ctx context.Context, nodeID int64, req *querypb.LoadSegmentsRequest) (*commonpb.Status, error)

LoadSegments provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) ReleasePartitions

func (_m *MockCluster) ReleasePartitions(ctx context.Context, nodeID int64, req *querypb.ReleasePartitionsRequest) (*commonpb.Status, error)

ReleasePartitions provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) ReleaseSegments

func (_m *MockCluster) ReleaseSegments(ctx context.Context, nodeID int64, req *querypb.ReleaseSegmentsRequest) (*commonpb.Status, error)

ReleaseSegments provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) Start

func (_m *MockCluster) Start()

Start provides a mock function with given fields:

func (*MockCluster) Stop

func (_m *MockCluster) Stop()

Stop provides a mock function with given fields:

func (*MockCluster) SyncDistribution

func (_m *MockCluster) SyncDistribution(ctx context.Context, nodeID int64, req *querypb.SyncDistributionRequest) (*commonpb.Status, error)

SyncDistribution provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) UnsubDmChannel

func (_m *MockCluster) UnsubDmChannel(ctx context.Context, nodeID int64, req *querypb.UnsubDmChannelRequest) (*commonpb.Status, error)

UnsubDmChannel provides a mock function with given fields: ctx, nodeID, req

func (*MockCluster) WatchDmChannels

func (_m *MockCluster) WatchDmChannels(ctx context.Context, nodeID int64, req *querypb.WatchDmChannelsRequest) (*commonpb.Status, error)

WatchDmChannels provides a mock function with given fields: ctx, nodeID, req

type MockCluster_Expecter

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

func (*MockCluster_Expecter) GetComponentStates

func (_e *MockCluster_Expecter) GetComponentStates(ctx interface{}, nodeID interface{}) *MockCluster_GetComponentStates_Call

GetComponentStates is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64

func (*MockCluster_Expecter) GetDataDistribution

func (_e *MockCluster_Expecter) GetDataDistribution(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_GetDataDistribution_Call

GetDataDistribution is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.GetDataDistributionRequest

func (*MockCluster_Expecter) GetMetrics

func (_e *MockCluster_Expecter) GetMetrics(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_GetMetrics_Call

GetMetrics is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *milvuspb.GetMetricsRequest

func (*MockCluster_Expecter) LoadPartitions

func (_e *MockCluster_Expecter) LoadPartitions(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_LoadPartitions_Call

LoadPartitions is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.LoadPartitionsRequest

func (*MockCluster_Expecter) LoadSegments

func (_e *MockCluster_Expecter) LoadSegments(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_LoadSegments_Call

LoadSegments is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.LoadSegmentsRequest

func (*MockCluster_Expecter) ReleasePartitions

func (_e *MockCluster_Expecter) ReleasePartitions(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_ReleasePartitions_Call

ReleasePartitions is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.ReleasePartitionsRequest

func (*MockCluster_Expecter) ReleaseSegments

func (_e *MockCluster_Expecter) ReleaseSegments(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_ReleaseSegments_Call

ReleaseSegments is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.ReleaseSegmentsRequest

func (*MockCluster_Expecter) Start

Start is a helper method to define mock.On call

func (*MockCluster_Expecter) Stop

Stop is a helper method to define mock.On call

func (*MockCluster_Expecter) SyncDistribution

func (_e *MockCluster_Expecter) SyncDistribution(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_SyncDistribution_Call

SyncDistribution is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.SyncDistributionRequest

func (*MockCluster_Expecter) UnsubDmChannel

func (_e *MockCluster_Expecter) UnsubDmChannel(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_UnsubDmChannel_Call

UnsubDmChannel is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.UnsubDmChannelRequest

func (*MockCluster_Expecter) WatchDmChannels

func (_e *MockCluster_Expecter) WatchDmChannels(ctx interface{}, nodeID interface{}, req interface{}) *MockCluster_WatchDmChannels_Call

WatchDmChannels is a helper method to define mock.On call

  • ctx context.Context
  • nodeID int64
  • req *querypb.WatchDmChannelsRequest

type MockCluster_GetComponentStates_Call

type MockCluster_GetComponentStates_Call struct {
	*mock.Call
}

MockCluster_GetComponentStates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetComponentStates'

func (*MockCluster_GetComponentStates_Call) Return

func (*MockCluster_GetComponentStates_Call) Run

func (*MockCluster_GetComponentStates_Call) RunAndReturn

type MockCluster_GetDataDistribution_Call

type MockCluster_GetDataDistribution_Call struct {
	*mock.Call
}

MockCluster_GetDataDistribution_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDataDistribution'

func (*MockCluster_GetDataDistribution_Call) Return

func (*MockCluster_GetDataDistribution_Call) Run

type MockCluster_GetMetrics_Call

type MockCluster_GetMetrics_Call struct {
	*mock.Call
}

MockCluster_GetMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMetrics'

func (*MockCluster_GetMetrics_Call) Return

func (*MockCluster_GetMetrics_Call) Run

type MockCluster_LoadPartitions_Call

type MockCluster_LoadPartitions_Call struct {
	*mock.Call
}

MockCluster_LoadPartitions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadPartitions'

func (*MockCluster_LoadPartitions_Call) Return

func (*MockCluster_LoadPartitions_Call) Run

func (*MockCluster_LoadPartitions_Call) RunAndReturn

type MockCluster_LoadSegments_Call

type MockCluster_LoadSegments_Call struct {
	*mock.Call
}

MockCluster_LoadSegments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadSegments'

func (*MockCluster_LoadSegments_Call) Return

func (*MockCluster_LoadSegments_Call) Run

func (*MockCluster_LoadSegments_Call) RunAndReturn

type MockCluster_ReleasePartitions_Call

type MockCluster_ReleasePartitions_Call struct {
	*mock.Call
}

MockCluster_ReleasePartitions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReleasePartitions'

func (*MockCluster_ReleasePartitions_Call) Return

func (*MockCluster_ReleasePartitions_Call) Run

type MockCluster_ReleaseSegments_Call

type MockCluster_ReleaseSegments_Call struct {
	*mock.Call
}

MockCluster_ReleaseSegments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReleaseSegments'

func (*MockCluster_ReleaseSegments_Call) Return

func (*MockCluster_ReleaseSegments_Call) Run

func (*MockCluster_ReleaseSegments_Call) RunAndReturn

type MockCluster_Start_Call

type MockCluster_Start_Call struct {
	*mock.Call
}

MockCluster_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'

func (*MockCluster_Start_Call) Return

func (*MockCluster_Start_Call) Run

func (_c *MockCluster_Start_Call) Run(run func()) *MockCluster_Start_Call

func (*MockCluster_Start_Call) RunAndReturn

func (_c *MockCluster_Start_Call) RunAndReturn(run func()) *MockCluster_Start_Call

type MockCluster_Stop_Call

type MockCluster_Stop_Call struct {
	*mock.Call
}

MockCluster_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'

func (*MockCluster_Stop_Call) Return

func (*MockCluster_Stop_Call) Run

func (_c *MockCluster_Stop_Call) Run(run func()) *MockCluster_Stop_Call

func (*MockCluster_Stop_Call) RunAndReturn

func (_c *MockCluster_Stop_Call) RunAndReturn(run func()) *MockCluster_Stop_Call

type MockCluster_SyncDistribution_Call

type MockCluster_SyncDistribution_Call struct {
	*mock.Call
}

MockCluster_SyncDistribution_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncDistribution'

func (*MockCluster_SyncDistribution_Call) Return

func (*MockCluster_SyncDistribution_Call) Run

type MockCluster_UnsubDmChannel_Call

type MockCluster_UnsubDmChannel_Call struct {
	*mock.Call
}

MockCluster_UnsubDmChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsubDmChannel'

func (*MockCluster_UnsubDmChannel_Call) Return

func (*MockCluster_UnsubDmChannel_Call) Run

func (*MockCluster_UnsubDmChannel_Call) RunAndReturn

type MockCluster_WatchDmChannels_Call

type MockCluster_WatchDmChannels_Call struct {
	*mock.Call
}

MockCluster_WatchDmChannels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchDmChannels'

func (*MockCluster_WatchDmChannels_Call) Return

func (*MockCluster_WatchDmChannels_Call) Run

func (*MockCluster_WatchDmChannels_Call) RunAndReturn

type NodeInfo

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

func NewNodeInfo

func NewNodeInfo(info ImmutableNodeInfo) *NodeInfo

func (*NodeInfo) Addr

func (n *NodeInfo) Addr() string

func (*NodeInfo) ChannelCnt

func (n *NodeInfo) ChannelCnt() int

func (*NodeInfo) GetState

func (n *NodeInfo) GetState() State

func (*NodeInfo) Hostname

func (n *NodeInfo) Hostname() string

func (*NodeInfo) ID

func (n *NodeInfo) ID() int64

func (*NodeInfo) IsStoppingState

func (n *NodeInfo) IsStoppingState() bool

func (*NodeInfo) LastHeartbeat

func (n *NodeInfo) LastHeartbeat() time.Time

func (*NodeInfo) SegmentCnt

func (n *NodeInfo) SegmentCnt() int

func (*NodeInfo) SetLastHeartbeat

func (n *NodeInfo) SetLastHeartbeat(time time.Time)

func (*NodeInfo) SetState

func (n *NodeInfo) SetState(s State)

func (*NodeInfo) UpdateStats

func (n *NodeInfo) UpdateStats(opts ...StatsOption)

func (*NodeInfo) Version

func (n *NodeInfo) Version() semver.Version

type NodeManager

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

func NewNodeManager

func NewNodeManager() *NodeManager

func (*NodeManager) Add

func (m *NodeManager) Add(node *NodeInfo)

func (*NodeManager) Get

func (m *NodeManager) Get(nodeID int64) *NodeInfo

func (*NodeManager) GetAll

func (m *NodeManager) GetAll() []*NodeInfo

func (*NodeManager) IsStoppingNode

func (m *NodeManager) IsStoppingNode(nodeID int64) (bool, error)

func (*NodeManager) Remove

func (m *NodeManager) Remove(nodeID int64)

func (*NodeManager) Resume

func (m *NodeManager) Resume(nodeID int64) error

func (*NodeManager) Stopping

func (m *NodeManager) Stopping(nodeID int64)

func (*NodeManager) Suspend

func (m *NodeManager) Suspend(nodeID int64) error

type QueryCluster

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

QueryCluster is used to send requests to QueryNodes and manage connections

func NewCluster

func NewCluster(nodeManager *NodeManager, queryNodeCreator QueryNodeCreator) *QueryCluster

func (*QueryCluster) GetComponentStates

func (c *QueryCluster) GetComponentStates(ctx context.Context, nodeID int64) (*milvuspb.ComponentStates, error)

func (*QueryCluster) GetDataDistribution

func (*QueryCluster) GetMetrics

func (*QueryCluster) LoadPartitions

func (c *QueryCluster) LoadPartitions(ctx context.Context, nodeID int64, req *querypb.LoadPartitionsRequest) (*commonpb.Status, error)

func (*QueryCluster) LoadSegments

func (c *QueryCluster) LoadSegments(ctx context.Context, nodeID int64, req *querypb.LoadSegmentsRequest) (*commonpb.Status, error)

func (*QueryCluster) ReleasePartitions

func (c *QueryCluster) ReleasePartitions(ctx context.Context, nodeID int64, req *querypb.ReleasePartitionsRequest) (*commonpb.Status, error)

func (*QueryCluster) ReleaseSegments

func (c *QueryCluster) ReleaseSegments(ctx context.Context, nodeID int64, req *querypb.ReleaseSegmentsRequest) (*commonpb.Status, error)

func (*QueryCluster) Start

func (c *QueryCluster) Start()

func (*QueryCluster) Stop

func (c *QueryCluster) Stop()

func (*QueryCluster) SyncDistribution

func (c *QueryCluster) SyncDistribution(ctx context.Context, nodeID int64, req *querypb.SyncDistributionRequest) (*commonpb.Status, error)

func (*QueryCluster) UnsubDmChannel

func (c *QueryCluster) UnsubDmChannel(ctx context.Context, nodeID int64, req *querypb.UnsubDmChannelRequest) (*commonpb.Status, error)

func (*QueryCluster) WatchDmChannels

func (c *QueryCluster) WatchDmChannels(ctx context.Context, nodeID int64, req *querypb.WatchDmChannelsRequest) (*commonpb.Status, error)

type QueryNodeCreator

type QueryNodeCreator func(ctx context.Context, addr string, nodeID int64) (types.QueryNodeClient, error)

type State

type State int
const (
	NodeStateNormal State = iota
	NodeStateStopping
	NodeStateSuspend
)

func (State) String

func (s State) String() string

type StatsOption

type StatsOption func(*NodeInfo)

func WithChannelCnt

func WithChannelCnt(cnt int) StatsOption

func WithSegmentCnt

func WithSegmentCnt(cnt int) StatsOption

Jump to

Keyboard shortcuts

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