Documentation ¶
Overview ¶
Licensed to the LF AI & Data foundation under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func GetServerInfoFilePath(pid int) string
- func GetServerLabelsFromEnv(role string) map[string]string
- func GetSessionPrefixByRole(role string) string
- func GetSessions(pid int) []string
- func RemoveServerInfoFile(pid int)
- func SaveServerInfo(role string, serverID int64)
- type IndexEngineVersion
- type MockSession
- func (_m *MockSession) Disconnected() bool
- func (_m *MockSession) EXPECT() *MockSession_Expecter
- func (_m *MockSession) ForceActiveStandby(activateFunc func() error) error
- func (_m *MockSession) GetAddress() string
- func (_m *MockSession) GetServerID() int64
- func (_m *MockSession) GetSessions(prefix string) (map[string]*Session, int64, error)
- func (_m *MockSession) GetSessionsWithVersionRange(prefix string, r semver.Range) (map[string]*Session, int64, error)
- func (_m *MockSession) GoingStop() error
- func (_m *MockSession) Init(serverName string, address string, exclusive bool, triggerKill bool)
- func (_m *MockSession) IsTriggerKill() bool
- func (_m *MockSession) LivenessCheck(ctx context.Context, callback func())
- func (_m *MockSession) MarshalJSON() ([]byte, error)
- func (_m *MockSession) ProcessActiveStandBy(activateFunc func() error) error
- func (_m *MockSession) Register()
- func (_m *MockSession) Registered() bool
- func (_m *MockSession) Revoke(timeout time.Duration)
- func (_m *MockSession) SetDisconnected(b bool)
- func (_m *MockSession) SetEnableActiveStandBy(enable bool)
- func (_m *MockSession) Stop()
- func (_m *MockSession) String() string
- func (_m *MockSession) UnmarshalJSON(data []byte) error
- func (_m *MockSession) UpdateRegistered(b bool)
- func (_m *MockSession) WatchServices(prefix string, revision int64, rewatch Rewatch) <-chan *SessionEvent
- func (_m *MockSession) WatchServicesWithVersionRange(prefix string, r semver.Range, revision int64, rewatch Rewatch) <-chan *SessionEvent
- type MockSession_Disconnected_Call
- type MockSession_Expecter
- func (_e *MockSession_Expecter) Disconnected() *MockSession_Disconnected_Call
- func (_e *MockSession_Expecter) ForceActiveStandby(activateFunc interface{}) *MockSession_ForceActiveStandby_Call
- func (_e *MockSession_Expecter) GetAddress() *MockSession_GetAddress_Call
- func (_e *MockSession_Expecter) GetServerID() *MockSession_GetServerID_Call
- func (_e *MockSession_Expecter) GetSessions(prefix interface{}) *MockSession_GetSessions_Call
- func (_e *MockSession_Expecter) GetSessionsWithVersionRange(prefix interface{}, r interface{}) *MockSession_GetSessionsWithVersionRange_Call
- func (_e *MockSession_Expecter) GoingStop() *MockSession_GoingStop_Call
- func (_e *MockSession_Expecter) Init(serverName interface{}, address interface{}, exclusive interface{}, ...) *MockSession_Init_Call
- func (_e *MockSession_Expecter) IsTriggerKill() *MockSession_IsTriggerKill_Call
- func (_e *MockSession_Expecter) LivenessCheck(ctx interface{}, callback interface{}) *MockSession_LivenessCheck_Call
- func (_e *MockSession_Expecter) MarshalJSON() *MockSession_MarshalJSON_Call
- func (_e *MockSession_Expecter) ProcessActiveStandBy(activateFunc interface{}) *MockSession_ProcessActiveStandBy_Call
- func (_e *MockSession_Expecter) Register() *MockSession_Register_Call
- func (_e *MockSession_Expecter) Registered() *MockSession_Registered_Call
- func (_e *MockSession_Expecter) Revoke(timeout interface{}) *MockSession_Revoke_Call
- func (_e *MockSession_Expecter) SetDisconnected(b interface{}) *MockSession_SetDisconnected_Call
- func (_e *MockSession_Expecter) SetEnableActiveStandBy(enable interface{}) *MockSession_SetEnableActiveStandBy_Call
- func (_e *MockSession_Expecter) Stop() *MockSession_Stop_Call
- func (_e *MockSession_Expecter) String() *MockSession_String_Call
- func (_e *MockSession_Expecter) UnmarshalJSON(data interface{}) *MockSession_UnmarshalJSON_Call
- func (_e *MockSession_Expecter) UpdateRegistered(b interface{}) *MockSession_UpdateRegistered_Call
- func (_e *MockSession_Expecter) WatchServices(prefix interface{}, revision interface{}, rewatch interface{}) *MockSession_WatchServices_Call
- func (_e *MockSession_Expecter) WatchServicesWithVersionRange(prefix interface{}, r interface{}, revision interface{}, rewatch interface{}) *MockSession_WatchServicesWithVersionRange_Call
- type MockSession_ForceActiveStandby_Call
- func (_c *MockSession_ForceActiveStandby_Call) Return(_a0 error) *MockSession_ForceActiveStandby_Call
- func (_c *MockSession_ForceActiveStandby_Call) Run(run func(activateFunc func() error)) *MockSession_ForceActiveStandby_Call
- func (_c *MockSession_ForceActiveStandby_Call) RunAndReturn(run func(func() error) error) *MockSession_ForceActiveStandby_Call
- type MockSession_GetAddress_Call
- type MockSession_GetServerID_Call
- type MockSession_GetSessionsWithVersionRange_Call
- func (_c *MockSession_GetSessionsWithVersionRange_Call) Return(_a0 map[string]*Session, _a1 int64, _a2 error) *MockSession_GetSessionsWithVersionRange_Call
- func (_c *MockSession_GetSessionsWithVersionRange_Call) Run(run func(prefix string, r semver.Range)) *MockSession_GetSessionsWithVersionRange_Call
- func (_c *MockSession_GetSessionsWithVersionRange_Call) RunAndReturn(run func(string, semver.Range) (map[string]*Session, int64, error)) *MockSession_GetSessionsWithVersionRange_Call
- type MockSession_GetSessions_Call
- func (_c *MockSession_GetSessions_Call) Return(_a0 map[string]*Session, _a1 int64, _a2 error) *MockSession_GetSessions_Call
- func (_c *MockSession_GetSessions_Call) Run(run func(prefix string)) *MockSession_GetSessions_Call
- func (_c *MockSession_GetSessions_Call) RunAndReturn(run func(string) (map[string]*Session, int64, error)) *MockSession_GetSessions_Call
- type MockSession_GoingStop_Call
- type MockSession_Init_Call
- func (_c *MockSession_Init_Call) Return() *MockSession_Init_Call
- func (_c *MockSession_Init_Call) Run(run func(serverName string, address string, exclusive bool, triggerKill bool)) *MockSession_Init_Call
- func (_c *MockSession_Init_Call) RunAndReturn(run func(string, string, bool, bool)) *MockSession_Init_Call
- type MockSession_IsTriggerKill_Call
- type MockSession_LivenessCheck_Call
- func (_c *MockSession_LivenessCheck_Call) Return() *MockSession_LivenessCheck_Call
- func (_c *MockSession_LivenessCheck_Call) Run(run func(ctx context.Context, callback func())) *MockSession_LivenessCheck_Call
- func (_c *MockSession_LivenessCheck_Call) RunAndReturn(run func(context.Context, func())) *MockSession_LivenessCheck_Call
- type MockSession_MarshalJSON_Call
- type MockSession_ProcessActiveStandBy_Call
- func (_c *MockSession_ProcessActiveStandBy_Call) Return(_a0 error) *MockSession_ProcessActiveStandBy_Call
- func (_c *MockSession_ProcessActiveStandBy_Call) Run(run func(activateFunc func() error)) *MockSession_ProcessActiveStandBy_Call
- func (_c *MockSession_ProcessActiveStandBy_Call) RunAndReturn(run func(func() error) error) *MockSession_ProcessActiveStandBy_Call
- type MockSession_Register_Call
- type MockSession_Registered_Call
- type MockSession_Revoke_Call
- type MockSession_SetDisconnected_Call
- type MockSession_SetEnableActiveStandBy_Call
- func (_c *MockSession_SetEnableActiveStandBy_Call) Return() *MockSession_SetEnableActiveStandBy_Call
- func (_c *MockSession_SetEnableActiveStandBy_Call) Run(run func(enable bool)) *MockSession_SetEnableActiveStandBy_Call
- func (_c *MockSession_SetEnableActiveStandBy_Call) RunAndReturn(run func(bool)) *MockSession_SetEnableActiveStandBy_Call
- type MockSession_Stop_Call
- type MockSession_String_Call
- type MockSession_UnmarshalJSON_Call
- func (_c *MockSession_UnmarshalJSON_Call) Return(_a0 error) *MockSession_UnmarshalJSON_Call
- func (_c *MockSession_UnmarshalJSON_Call) Run(run func(data []byte)) *MockSession_UnmarshalJSON_Call
- func (_c *MockSession_UnmarshalJSON_Call) RunAndReturn(run func([]byte) error) *MockSession_UnmarshalJSON_Call
- type MockSession_UpdateRegistered_Call
- type MockSession_WatchServicesWithVersionRange_Call
- func (_c *MockSession_WatchServicesWithVersionRange_Call) Return(eventChannel <-chan *SessionEvent) *MockSession_WatchServicesWithVersionRange_Call
- func (_c *MockSession_WatchServicesWithVersionRange_Call) Run(run func(prefix string, r semver.Range, revision int64, rewatch Rewatch)) *MockSession_WatchServicesWithVersionRange_Call
- func (_c *MockSession_WatchServicesWithVersionRange_Call) RunAndReturn(run func(string, semver.Range, int64, Rewatch) <-chan *SessionEvent) *MockSession_WatchServicesWithVersionRange_Call
- type MockSession_WatchServices_Call
- func (_c *MockSession_WatchServices_Call) Return(eventChannel <-chan *SessionEvent) *MockSession_WatchServices_Call
- func (_c *MockSession_WatchServices_Call) Run(run func(prefix string, revision int64, rewatch Rewatch)) *MockSession_WatchServices_Call
- func (_c *MockSession_WatchServices_Call) RunAndReturn(run func(string, int64, Rewatch) <-chan *SessionEvent) *MockSession_WatchServices_Call
- type Rewatch
- type Session
- func (s *Session) Disconnected() bool
- func (s *Session) ForceActiveStandby(activateFunc func() error) error
- func (s *Session) GetSessions(prefix string) (map[string]*Session, int64, error)
- func (s *Session) GetSessionsWithVersionRange(prefix string, r semver.Range) (map[string]*Session, int64, error)
- func (s *Session) GoingStop() error
- func (s *Session) Init(serverName, address string, exclusive bool, triggerKill bool)
- func (s *Session) LivenessCheck(ctx context.Context, callback func())
- func (s *Session) MarshalJSON() ([]byte, error)
- func (s *Session) ProcessActiveStandBy(activateFunc func() error) error
- func (s *Session) Register()
- func (s *Session) Registered() bool
- func (s *Session) Revoke(timeout time.Duration)
- func (s *Session) SetDisconnected(b bool)
- func (s *Session) SetEnableActiveStandBy(enable bool)
- func (s *Session) Stop()
- func (s *Session) String() string
- func (s *Session) UnmarshalJSON(data []byte) error
- func (s *Session) UpdateRegistered(b bool)
- func (s *Session) WatchServices(prefix string, revision int64, rewatch Rewatch) (eventChannel <-chan *SessionEvent)
- func (s *Session) WatchServicesWithVersionRange(prefix string, r semver.Range, revision int64, rewatch Rewatch) (eventChannel <-chan *SessionEvent)
- type SessionEvent
- type SessionEventType
- type SessionInterface
- type SessionOption
- type SessionRaw
Constants ¶
const ( // DefaultServiceRoot default root path used in kv by Session DefaultServiceRoot = "session/" // DefaultIDKey default id key for Session DefaultIDKey = "id" SupportedLabelPrefix = "MILVUS_SERVER_LABEL_" )
Variables ¶
This section is empty.
Functions ¶
func GetServerInfoFilePath ¶
GetServerInfoFilePath get server info file path, eg: /tmp/milvus/server_id_123456789 Notes: this method will not support Windows OS return file path
func GetServerLabelsFromEnv ¶
func GetSessionPrefixByRole ¶
GetSessionPrefixByRole get session prefix by role
func GetSessions ¶
func RemoveServerInfoFile ¶
func RemoveServerInfoFile(pid int)
func SaveServerInfo ¶
Types ¶
type IndexEngineVersion ¶
type MockSession ¶
MockSession is an autogenerated mock type for the SessionInterface type
func NewMockSession ¶
func NewMockSession(t interface { mock.TestingT Cleanup(func()) }) *MockSession
NewMockSession creates a new instance of MockSession. 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 (*MockSession) Disconnected ¶
func (_m *MockSession) Disconnected() bool
Disconnected provides a mock function with given fields:
func (*MockSession) EXPECT ¶
func (_m *MockSession) EXPECT() *MockSession_Expecter
func (*MockSession) ForceActiveStandby ¶
func (_m *MockSession) ForceActiveStandby(activateFunc func() error) error
ForceActiveStandby provides a mock function with given fields: activateFunc
func (*MockSession) GetAddress ¶
func (_m *MockSession) GetAddress() string
GetAddress provides a mock function with given fields:
func (*MockSession) GetServerID ¶
func (_m *MockSession) GetServerID() int64
GetServerID provides a mock function with given fields:
func (*MockSession) GetSessions ¶
GetSessions provides a mock function with given fields: prefix
func (*MockSession) GetSessionsWithVersionRange ¶
func (_m *MockSession) GetSessionsWithVersionRange(prefix string, r semver.Range) (map[string]*Session, int64, error)
GetSessionsWithVersionRange provides a mock function with given fields: prefix, r
func (*MockSession) GoingStop ¶
func (_m *MockSession) GoingStop() error
GoingStop provides a mock function with given fields:
func (*MockSession) Init ¶
func (_m *MockSession) Init(serverName string, address string, exclusive bool, triggerKill bool)
Init provides a mock function with given fields: serverName, address, exclusive, triggerKill
func (*MockSession) IsTriggerKill ¶
func (_m *MockSession) IsTriggerKill() bool
IsTriggerKill provides a mock function with given fields:
func (*MockSession) LivenessCheck ¶
func (_m *MockSession) LivenessCheck(ctx context.Context, callback func())
LivenessCheck provides a mock function with given fields: ctx, callback
func (*MockSession) MarshalJSON ¶
func (_m *MockSession) MarshalJSON() ([]byte, error)
MarshalJSON provides a mock function with given fields:
func (*MockSession) ProcessActiveStandBy ¶
func (_m *MockSession) ProcessActiveStandBy(activateFunc func() error) error
ProcessActiveStandBy provides a mock function with given fields: activateFunc
func (*MockSession) Register ¶
func (_m *MockSession) Register()
Register provides a mock function with given fields:
func (*MockSession) Registered ¶
func (_m *MockSession) Registered() bool
Registered provides a mock function with given fields:
func (*MockSession) Revoke ¶
func (_m *MockSession) Revoke(timeout time.Duration)
Revoke provides a mock function with given fields: timeout
func (*MockSession) SetDisconnected ¶
func (_m *MockSession) SetDisconnected(b bool)
SetDisconnected provides a mock function with given fields: b
func (*MockSession) SetEnableActiveStandBy ¶
func (_m *MockSession) SetEnableActiveStandBy(enable bool)
SetEnableActiveStandBy provides a mock function with given fields: enable
func (*MockSession) Stop ¶
func (_m *MockSession) Stop()
Stop provides a mock function with given fields:
func (*MockSession) String ¶
func (_m *MockSession) String() string
String provides a mock function with given fields:
func (*MockSession) UnmarshalJSON ¶
func (_m *MockSession) UnmarshalJSON(data []byte) error
UnmarshalJSON provides a mock function with given fields: data
func (*MockSession) UpdateRegistered ¶
func (_m *MockSession) UpdateRegistered(b bool)
UpdateRegistered provides a mock function with given fields: b
func (*MockSession) WatchServices ¶
func (_m *MockSession) WatchServices(prefix string, revision int64, rewatch Rewatch) <-chan *SessionEvent
WatchServices provides a mock function with given fields: prefix, revision, rewatch
func (*MockSession) WatchServicesWithVersionRange ¶
func (_m *MockSession) WatchServicesWithVersionRange(prefix string, r semver.Range, revision int64, rewatch Rewatch) <-chan *SessionEvent
WatchServicesWithVersionRange provides a mock function with given fields: prefix, r, revision, rewatch
type MockSession_Disconnected_Call ¶
MockSession_Disconnected_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Disconnected'
func (*MockSession_Disconnected_Call) Return ¶
func (_c *MockSession_Disconnected_Call) Return(_a0 bool) *MockSession_Disconnected_Call
func (*MockSession_Disconnected_Call) Run ¶
func (_c *MockSession_Disconnected_Call) Run(run func()) *MockSession_Disconnected_Call
func (*MockSession_Disconnected_Call) RunAndReturn ¶
func (_c *MockSession_Disconnected_Call) RunAndReturn(run func() bool) *MockSession_Disconnected_Call
type MockSession_Expecter ¶
type MockSession_Expecter struct {
// contains filtered or unexported fields
}
func (*MockSession_Expecter) Disconnected ¶
func (_e *MockSession_Expecter) Disconnected() *MockSession_Disconnected_Call
Disconnected is a helper method to define mock.On call
func (*MockSession_Expecter) ForceActiveStandby ¶
func (_e *MockSession_Expecter) ForceActiveStandby(activateFunc interface{}) *MockSession_ForceActiveStandby_Call
ForceActiveStandby is a helper method to define mock.On call
- activateFunc func() error
func (*MockSession_Expecter) GetAddress ¶
func (_e *MockSession_Expecter) GetAddress() *MockSession_GetAddress_Call
GetAddress is a helper method to define mock.On call
func (*MockSession_Expecter) GetServerID ¶
func (_e *MockSession_Expecter) GetServerID() *MockSession_GetServerID_Call
GetServerID is a helper method to define mock.On call
func (*MockSession_Expecter) GetSessions ¶
func (_e *MockSession_Expecter) GetSessions(prefix interface{}) *MockSession_GetSessions_Call
GetSessions is a helper method to define mock.On call
- prefix string
func (*MockSession_Expecter) GetSessionsWithVersionRange ¶
func (_e *MockSession_Expecter) GetSessionsWithVersionRange(prefix interface{}, r interface{}) *MockSession_GetSessionsWithVersionRange_Call
GetSessionsWithVersionRange is a helper method to define mock.On call
- prefix string
- r semver.Range
func (*MockSession_Expecter) GoingStop ¶
func (_e *MockSession_Expecter) GoingStop() *MockSession_GoingStop_Call
GoingStop is a helper method to define mock.On call
func (*MockSession_Expecter) Init ¶
func (_e *MockSession_Expecter) Init(serverName interface{}, address interface{}, exclusive interface{}, triggerKill interface{}) *MockSession_Init_Call
Init is a helper method to define mock.On call
- serverName string
- address string
- exclusive bool
- triggerKill bool
func (*MockSession_Expecter) IsTriggerKill ¶
func (_e *MockSession_Expecter) IsTriggerKill() *MockSession_IsTriggerKill_Call
IsTriggerKill is a helper method to define mock.On call
func (*MockSession_Expecter) LivenessCheck ¶
func (_e *MockSession_Expecter) LivenessCheck(ctx interface{}, callback interface{}) *MockSession_LivenessCheck_Call
LivenessCheck is a helper method to define mock.On call
- ctx context.Context
- callback func()
func (*MockSession_Expecter) MarshalJSON ¶
func (_e *MockSession_Expecter) MarshalJSON() *MockSession_MarshalJSON_Call
MarshalJSON is a helper method to define mock.On call
func (*MockSession_Expecter) ProcessActiveStandBy ¶
func (_e *MockSession_Expecter) ProcessActiveStandBy(activateFunc interface{}) *MockSession_ProcessActiveStandBy_Call
ProcessActiveStandBy is a helper method to define mock.On call
- activateFunc func() error
func (*MockSession_Expecter) Register ¶
func (_e *MockSession_Expecter) Register() *MockSession_Register_Call
Register is a helper method to define mock.On call
func (*MockSession_Expecter) Registered ¶
func (_e *MockSession_Expecter) Registered() *MockSession_Registered_Call
Registered is a helper method to define mock.On call
func (*MockSession_Expecter) Revoke ¶
func (_e *MockSession_Expecter) Revoke(timeout interface{}) *MockSession_Revoke_Call
Revoke is a helper method to define mock.On call
- timeout time.Duration
func (*MockSession_Expecter) SetDisconnected ¶
func (_e *MockSession_Expecter) SetDisconnected(b interface{}) *MockSession_SetDisconnected_Call
SetDisconnected is a helper method to define mock.On call
- b bool
func (*MockSession_Expecter) SetEnableActiveStandBy ¶
func (_e *MockSession_Expecter) SetEnableActiveStandBy(enable interface{}) *MockSession_SetEnableActiveStandBy_Call
SetEnableActiveStandBy is a helper method to define mock.On call
- enable bool
func (*MockSession_Expecter) Stop ¶
func (_e *MockSession_Expecter) Stop() *MockSession_Stop_Call
Stop is a helper method to define mock.On call
func (*MockSession_Expecter) String ¶
func (_e *MockSession_Expecter) String() *MockSession_String_Call
String is a helper method to define mock.On call
func (*MockSession_Expecter) UnmarshalJSON ¶
func (_e *MockSession_Expecter) UnmarshalJSON(data interface{}) *MockSession_UnmarshalJSON_Call
UnmarshalJSON is a helper method to define mock.On call
- data []byte
func (*MockSession_Expecter) UpdateRegistered ¶
func (_e *MockSession_Expecter) UpdateRegistered(b interface{}) *MockSession_UpdateRegistered_Call
UpdateRegistered is a helper method to define mock.On call
- b bool
func (*MockSession_Expecter) WatchServices ¶
func (_e *MockSession_Expecter) WatchServices(prefix interface{}, revision interface{}, rewatch interface{}) *MockSession_WatchServices_Call
WatchServices is a helper method to define mock.On call
- prefix string
- revision int64
- rewatch Rewatch
func (*MockSession_Expecter) WatchServicesWithVersionRange ¶
func (_e *MockSession_Expecter) WatchServicesWithVersionRange(prefix interface{}, r interface{}, revision interface{}, rewatch interface{}) *MockSession_WatchServicesWithVersionRange_Call
WatchServicesWithVersionRange is a helper method to define mock.On call
- prefix string
- r semver.Range
- revision int64
- rewatch Rewatch
type MockSession_ForceActiveStandby_Call ¶
MockSession_ForceActiveStandby_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ForceActiveStandby'
func (*MockSession_ForceActiveStandby_Call) Return ¶
func (_c *MockSession_ForceActiveStandby_Call) Return(_a0 error) *MockSession_ForceActiveStandby_Call
func (*MockSession_ForceActiveStandby_Call) Run ¶
func (_c *MockSession_ForceActiveStandby_Call) Run(run func(activateFunc func() error)) *MockSession_ForceActiveStandby_Call
func (*MockSession_ForceActiveStandby_Call) RunAndReturn ¶
func (_c *MockSession_ForceActiveStandby_Call) RunAndReturn(run func(func() error) error) *MockSession_ForceActiveStandby_Call
type MockSession_GetAddress_Call ¶
MockSession_GetAddress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAddress'
func (*MockSession_GetAddress_Call) Return ¶
func (_c *MockSession_GetAddress_Call) Return(_a0 string) *MockSession_GetAddress_Call
func (*MockSession_GetAddress_Call) Run ¶
func (_c *MockSession_GetAddress_Call) Run(run func()) *MockSession_GetAddress_Call
func (*MockSession_GetAddress_Call) RunAndReturn ¶
func (_c *MockSession_GetAddress_Call) RunAndReturn(run func() string) *MockSession_GetAddress_Call
type MockSession_GetServerID_Call ¶
MockSession_GetServerID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServerID'
func (*MockSession_GetServerID_Call) Return ¶
func (_c *MockSession_GetServerID_Call) Return(_a0 int64) *MockSession_GetServerID_Call
func (*MockSession_GetServerID_Call) Run ¶
func (_c *MockSession_GetServerID_Call) Run(run func()) *MockSession_GetServerID_Call
func (*MockSession_GetServerID_Call) RunAndReturn ¶
func (_c *MockSession_GetServerID_Call) RunAndReturn(run func() int64) *MockSession_GetServerID_Call
type MockSession_GetSessionsWithVersionRange_Call ¶
MockSession_GetSessionsWithVersionRange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSessionsWithVersionRange'
func (*MockSession_GetSessionsWithVersionRange_Call) Return ¶
func (_c *MockSession_GetSessionsWithVersionRange_Call) Return(_a0 map[string]*Session, _a1 int64, _a2 error) *MockSession_GetSessionsWithVersionRange_Call
func (*MockSession_GetSessionsWithVersionRange_Call) Run ¶
func (_c *MockSession_GetSessionsWithVersionRange_Call) Run(run func(prefix string, r semver.Range)) *MockSession_GetSessionsWithVersionRange_Call
func (*MockSession_GetSessionsWithVersionRange_Call) RunAndReturn ¶
func (_c *MockSession_GetSessionsWithVersionRange_Call) RunAndReturn(run func(string, semver.Range) (map[string]*Session, int64, error)) *MockSession_GetSessionsWithVersionRange_Call
type MockSession_GetSessions_Call ¶
MockSession_GetSessions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSessions'
func (*MockSession_GetSessions_Call) Return ¶
func (_c *MockSession_GetSessions_Call) Return(_a0 map[string]*Session, _a1 int64, _a2 error) *MockSession_GetSessions_Call
func (*MockSession_GetSessions_Call) Run ¶
func (_c *MockSession_GetSessions_Call) Run(run func(prefix string)) *MockSession_GetSessions_Call
func (*MockSession_GetSessions_Call) RunAndReturn ¶
func (_c *MockSession_GetSessions_Call) RunAndReturn(run func(string) (map[string]*Session, int64, error)) *MockSession_GetSessions_Call
type MockSession_GoingStop_Call ¶
MockSession_GoingStop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GoingStop'
func (*MockSession_GoingStop_Call) Return ¶
func (_c *MockSession_GoingStop_Call) Return(_a0 error) *MockSession_GoingStop_Call
func (*MockSession_GoingStop_Call) Run ¶
func (_c *MockSession_GoingStop_Call) Run(run func()) *MockSession_GoingStop_Call
func (*MockSession_GoingStop_Call) RunAndReturn ¶
func (_c *MockSession_GoingStop_Call) RunAndReturn(run func() error) *MockSession_GoingStop_Call
type MockSession_Init_Call ¶
MockSession_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'
func (*MockSession_Init_Call) Return ¶
func (_c *MockSession_Init_Call) Return() *MockSession_Init_Call
func (*MockSession_Init_Call) Run ¶
func (_c *MockSession_Init_Call) Run(run func(serverName string, address string, exclusive bool, triggerKill bool)) *MockSession_Init_Call
func (*MockSession_Init_Call) RunAndReturn ¶
func (_c *MockSession_Init_Call) RunAndReturn(run func(string, string, bool, bool)) *MockSession_Init_Call
type MockSession_IsTriggerKill_Call ¶
MockSession_IsTriggerKill_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsTriggerKill'
func (*MockSession_IsTriggerKill_Call) Return ¶
func (_c *MockSession_IsTriggerKill_Call) Return(_a0 bool) *MockSession_IsTriggerKill_Call
func (*MockSession_IsTriggerKill_Call) Run ¶
func (_c *MockSession_IsTriggerKill_Call) Run(run func()) *MockSession_IsTriggerKill_Call
func (*MockSession_IsTriggerKill_Call) RunAndReturn ¶
func (_c *MockSession_IsTriggerKill_Call) RunAndReturn(run func() bool) *MockSession_IsTriggerKill_Call
type MockSession_LivenessCheck_Call ¶
MockSession_LivenessCheck_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LivenessCheck'
func (*MockSession_LivenessCheck_Call) Return ¶
func (_c *MockSession_LivenessCheck_Call) Return() *MockSession_LivenessCheck_Call
func (*MockSession_LivenessCheck_Call) Run ¶
func (_c *MockSession_LivenessCheck_Call) Run(run func(ctx context.Context, callback func())) *MockSession_LivenessCheck_Call
func (*MockSession_LivenessCheck_Call) RunAndReturn ¶
func (_c *MockSession_LivenessCheck_Call) RunAndReturn(run func(context.Context, func())) *MockSession_LivenessCheck_Call
type MockSession_MarshalJSON_Call ¶
MockSession_MarshalJSON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarshalJSON'
func (*MockSession_MarshalJSON_Call) Return ¶
func (_c *MockSession_MarshalJSON_Call) Return(_a0 []byte, _a1 error) *MockSession_MarshalJSON_Call
func (*MockSession_MarshalJSON_Call) Run ¶
func (_c *MockSession_MarshalJSON_Call) Run(run func()) *MockSession_MarshalJSON_Call
func (*MockSession_MarshalJSON_Call) RunAndReturn ¶
func (_c *MockSession_MarshalJSON_Call) RunAndReturn(run func() ([]byte, error)) *MockSession_MarshalJSON_Call
type MockSession_ProcessActiveStandBy_Call ¶
MockSession_ProcessActiveStandBy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessActiveStandBy'
func (*MockSession_ProcessActiveStandBy_Call) Return ¶
func (_c *MockSession_ProcessActiveStandBy_Call) Return(_a0 error) *MockSession_ProcessActiveStandBy_Call
func (*MockSession_ProcessActiveStandBy_Call) Run ¶
func (_c *MockSession_ProcessActiveStandBy_Call) Run(run func(activateFunc func() error)) *MockSession_ProcessActiveStandBy_Call
func (*MockSession_ProcessActiveStandBy_Call) RunAndReturn ¶
func (_c *MockSession_ProcessActiveStandBy_Call) RunAndReturn(run func(func() error) error) *MockSession_ProcessActiveStandBy_Call
type MockSession_Register_Call ¶
MockSession_Register_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Register'
func (*MockSession_Register_Call) Return ¶
func (_c *MockSession_Register_Call) Return() *MockSession_Register_Call
func (*MockSession_Register_Call) Run ¶
func (_c *MockSession_Register_Call) Run(run func()) *MockSession_Register_Call
func (*MockSession_Register_Call) RunAndReturn ¶
func (_c *MockSession_Register_Call) RunAndReturn(run func()) *MockSession_Register_Call
type MockSession_Registered_Call ¶
MockSession_Registered_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Registered'
func (*MockSession_Registered_Call) Return ¶
func (_c *MockSession_Registered_Call) Return(_a0 bool) *MockSession_Registered_Call
func (*MockSession_Registered_Call) Run ¶
func (_c *MockSession_Registered_Call) Run(run func()) *MockSession_Registered_Call
func (*MockSession_Registered_Call) RunAndReturn ¶
func (_c *MockSession_Registered_Call) RunAndReturn(run func() bool) *MockSession_Registered_Call
type MockSession_Revoke_Call ¶
MockSession_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke'
func (*MockSession_Revoke_Call) Return ¶
func (_c *MockSession_Revoke_Call) Return() *MockSession_Revoke_Call
func (*MockSession_Revoke_Call) Run ¶
func (_c *MockSession_Revoke_Call) Run(run func(timeout time.Duration)) *MockSession_Revoke_Call
func (*MockSession_Revoke_Call) RunAndReturn ¶
func (_c *MockSession_Revoke_Call) RunAndReturn(run func(time.Duration)) *MockSession_Revoke_Call
type MockSession_SetDisconnected_Call ¶
MockSession_SetDisconnected_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetDisconnected'
func (*MockSession_SetDisconnected_Call) Return ¶
func (_c *MockSession_SetDisconnected_Call) Return() *MockSession_SetDisconnected_Call
func (*MockSession_SetDisconnected_Call) Run ¶
func (_c *MockSession_SetDisconnected_Call) Run(run func(b bool)) *MockSession_SetDisconnected_Call
func (*MockSession_SetDisconnected_Call) RunAndReturn ¶
func (_c *MockSession_SetDisconnected_Call) RunAndReturn(run func(bool)) *MockSession_SetDisconnected_Call
type MockSession_SetEnableActiveStandBy_Call ¶
MockSession_SetEnableActiveStandBy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetEnableActiveStandBy'
func (*MockSession_SetEnableActiveStandBy_Call) Return ¶
func (_c *MockSession_SetEnableActiveStandBy_Call) Return() *MockSession_SetEnableActiveStandBy_Call
func (*MockSession_SetEnableActiveStandBy_Call) Run ¶
func (_c *MockSession_SetEnableActiveStandBy_Call) Run(run func(enable bool)) *MockSession_SetEnableActiveStandBy_Call
func (*MockSession_SetEnableActiveStandBy_Call) RunAndReturn ¶
func (_c *MockSession_SetEnableActiveStandBy_Call) RunAndReturn(run func(bool)) *MockSession_SetEnableActiveStandBy_Call
type MockSession_Stop_Call ¶
MockSession_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
func (*MockSession_Stop_Call) Return ¶
func (_c *MockSession_Stop_Call) Return() *MockSession_Stop_Call
func (*MockSession_Stop_Call) Run ¶
func (_c *MockSession_Stop_Call) Run(run func()) *MockSession_Stop_Call
func (*MockSession_Stop_Call) RunAndReturn ¶
func (_c *MockSession_Stop_Call) RunAndReturn(run func()) *MockSession_Stop_Call
type MockSession_String_Call ¶
MockSession_String_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'String'
func (*MockSession_String_Call) Return ¶
func (_c *MockSession_String_Call) Return(_a0 string) *MockSession_String_Call
func (*MockSession_String_Call) Run ¶
func (_c *MockSession_String_Call) Run(run func()) *MockSession_String_Call
func (*MockSession_String_Call) RunAndReturn ¶
func (_c *MockSession_String_Call) RunAndReturn(run func() string) *MockSession_String_Call
type MockSession_UnmarshalJSON_Call ¶
MockSession_UnmarshalJSON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnmarshalJSON'
func (*MockSession_UnmarshalJSON_Call) Return ¶
func (_c *MockSession_UnmarshalJSON_Call) Return(_a0 error) *MockSession_UnmarshalJSON_Call
func (*MockSession_UnmarshalJSON_Call) Run ¶
func (_c *MockSession_UnmarshalJSON_Call) Run(run func(data []byte)) *MockSession_UnmarshalJSON_Call
func (*MockSession_UnmarshalJSON_Call) RunAndReturn ¶
func (_c *MockSession_UnmarshalJSON_Call) RunAndReturn(run func([]byte) error) *MockSession_UnmarshalJSON_Call
type MockSession_UpdateRegistered_Call ¶
MockSession_UpdateRegistered_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRegistered'
func (*MockSession_UpdateRegistered_Call) Return ¶
func (_c *MockSession_UpdateRegistered_Call) Return() *MockSession_UpdateRegistered_Call
func (*MockSession_UpdateRegistered_Call) Run ¶
func (_c *MockSession_UpdateRegistered_Call) Run(run func(b bool)) *MockSession_UpdateRegistered_Call
func (*MockSession_UpdateRegistered_Call) RunAndReturn ¶
func (_c *MockSession_UpdateRegistered_Call) RunAndReturn(run func(bool)) *MockSession_UpdateRegistered_Call
type MockSession_WatchServicesWithVersionRange_Call ¶
MockSession_WatchServicesWithVersionRange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchServicesWithVersionRange'
func (*MockSession_WatchServicesWithVersionRange_Call) Return ¶
func (_c *MockSession_WatchServicesWithVersionRange_Call) Return(eventChannel <-chan *SessionEvent) *MockSession_WatchServicesWithVersionRange_Call
func (*MockSession_WatchServicesWithVersionRange_Call) Run ¶
func (_c *MockSession_WatchServicesWithVersionRange_Call) Run(run func(prefix string, r semver.Range, revision int64, rewatch Rewatch)) *MockSession_WatchServicesWithVersionRange_Call
func (*MockSession_WatchServicesWithVersionRange_Call) RunAndReturn ¶
func (_c *MockSession_WatchServicesWithVersionRange_Call) RunAndReturn(run func(string, semver.Range, int64, Rewatch) <-chan *SessionEvent) *MockSession_WatchServicesWithVersionRange_Call
type MockSession_WatchServices_Call ¶
MockSession_WatchServices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WatchServices'
func (*MockSession_WatchServices_Call) Return ¶
func (_c *MockSession_WatchServices_Call) Return(eventChannel <-chan *SessionEvent) *MockSession_WatchServices_Call
func (*MockSession_WatchServices_Call) Run ¶
func (_c *MockSession_WatchServices_Call) Run(run func(prefix string, revision int64, rewatch Rewatch)) *MockSession_WatchServices_Call
func (*MockSession_WatchServices_Call) RunAndReturn ¶
func (_c *MockSession_WatchServices_Call) RunAndReturn(run func(string, int64, Rewatch) <-chan *SessionEvent) *MockSession_WatchServices_Call
type Rewatch ¶
Rewatch defines the behavior outer session watch handles ErrCompacted it should process the current full list of session and returns err if meta error or anything else goes wrong
type Session ¶
type Session struct { SessionRaw Version semver.Version `json:"Version,omitempty"` // contains filtered or unexported fields }
Session is a struct to store service's session, including ServerID, ServerName, Address. Exclusive indicates that this server can only start one.
func NewSession ¶
func NewSession(ctx context.Context, opts ...SessionOption) *Session
Create a new Session object. Will use global etcd client
func NewSessionWithEtcd ¶
func NewSessionWithEtcd(ctx context.Context, metaRoot string, client *clientv3.Client, opts ...SessionOption) *Session
NewSessionWithEtcd is a helper to build a Session object. ServerID, ServerName, Address, Exclusive will be assigned after Init(). metaRoot is a path in etcd to save session information. etcdEndpoints is to init etcdCli when NewSession
func (*Session) Disconnected ¶
func (*Session) ForceActiveStandby ¶
func (*Session) GetSessions ¶
GetSessions will get all sessions registered in etcd. Revision is returned for WatchServices to prevent key events from being missed.
func (*Session) GetSessionsWithVersionRange ¶
func (s *Session) GetSessionsWithVersionRange(prefix string, r semver.Range) (map[string]*Session, int64, error)
GetSessionsWithVersionRange will get all sessions with provided prefix and version range in etcd. Revision is returned for WatchServices to prevent missing events.
func (*Session) Init ¶
Init will initialize base struct of the Session, including ServerName, ServerID, Address, Exclusive. ServerID is obtained in getServerID.
func (*Session) LivenessCheck ¶
LivenessCheck performs liveness check with provided context and channel ctx controls the liveness check loop ch is the liveness signal channel, ch is closed only when the session is expired callback must be called before liveness check exit, to close the session's owner component
func (*Session) MarshalJSON ¶
MarshalJSON marshals session to bytes.
func (*Session) ProcessActiveStandBy ¶
ProcessActiveStandBy is used by coordinators to do active-standby mechanism. coordinator enabled active-standby will first call Register and then call ProcessActiveStandBy. steps: 1, Enter STANDBY mode 2, Try to register to active key. 3, If 2. return true, this service becomes ACTIVE. Exit STANDBY mode. 4, If 2. return false, which means an ACTIVE service already exist.
Start watching the active key. Whenever active key disappears, STANDBY node will go backup to 2.
activateFunc is the function to re-active the service.
func (*Session) Register ¶
func (s *Session) Register()
Register will process keepAliveResponse to keep alive with etcd.
func (*Session) Registered ¶
Registered check if session was registered into etcd.
func (*Session) SetDisconnected ¶
func (*Session) SetEnableActiveStandBy ¶
func (*Session) UnmarshalJSON ¶
UnmarshalJSON unmarshal bytes to Session.
func (*Session) UpdateRegistered ¶
UpdateRegistered update the state of registered.
func (*Session) WatchServices ¶
func (s *Session) WatchServices(prefix string, revision int64, rewatch Rewatch) (eventChannel <-chan *SessionEvent)
WatchServices watches the service's up and down in etcd, and sends event to eventChannel. prefix is a parameter to know which service to watch and can be obtained in typeutil.type.go. revision is a etcd reversion to prevent missing key events and can be obtained in GetSessions. If a server up, an event will be add to channel with eventType SessionAddType. If a server down, an event will be add to channel with eventType SessionDelType.
func (*Session) WatchServicesWithVersionRange ¶
func (s *Session) WatchServicesWithVersionRange(prefix string, r semver.Range, revision int64, rewatch Rewatch) (eventChannel <-chan *SessionEvent)
WatchServicesWithVersionRange watches the service's up and down in etcd, and sends event to event Channel. Acts like WatchServices but with extra version range check. prefix is a parameter to know which service to watch and can be obtained in type util.type.go. revision is a etcd reversion to prevent missing key events and can be obtained in GetSessions. If a server up, an event will be add to channel with eventType SessionAddType. If a server down, an event will be add to channel with eventType SessionDelType.
type SessionEvent ¶
type SessionEvent struct { EventType SessionEventType Session *Session }
SessionEvent indicates the changes of other servers. if a server is up, EventType is SessAddEvent. if a server is down, EventType is SessDelEvent. Session Saves the changed server's information.
type SessionEventType ¶
type SessionEventType int
SessionEventType session event type
const ( // SessionNoneEvent place holder for zero value SessionNoneEvent SessionEventType = iota // SessionAddEvent event type for a new Session Added SessionAddEvent // SessionDelEvent event type for a Session deleted SessionDelEvent // SessionUpdateEvent event type for a Session stopping SessionUpdateEvent )
func (SessionEventType) String ¶
func (t SessionEventType) String() string
type SessionInterface ¶
type SessionInterface interface { UnmarshalJSON(data []byte) error MarshalJSON() ([]byte, error) Init(serverName, address string, exclusive bool, triggerKill bool) String() string Register() GetSessions(prefix string) (map[string]*Session, int64, error) GetSessionsWithVersionRange(prefix string, r semver.Range) (map[string]*Session, int64, error) GoingStop() error WatchServices(prefix string, revision int64, rewatch Rewatch) (eventChannel <-chan *SessionEvent) WatchServicesWithVersionRange(prefix string, r semver.Range, revision int64, rewatch Rewatch) (eventChannel <-chan *SessionEvent) LivenessCheck(ctx context.Context, callback func()) Stop() Revoke(timeout time.Duration) UpdateRegistered(b bool) Registered() bool SetDisconnected(b bool) Disconnected() bool SetEnableActiveStandBy(enable bool) ProcessActiveStandBy(activateFunc func() error) error ForceActiveStandby(activateFunc func() error) error GetAddress() string GetServerID() int64 IsTriggerKill() bool }
type SessionOption ¶
type SessionOption func(session *Session)
func WithEnableDisk ¶
func WithEnableDisk(enableDisk bool) SessionOption
func WithIndexEngineVersion ¶
func WithIndexEngineVersion(minimal, current int32) SessionOption
WithIndexEngineVersion should be only used by querynode.
func WithResueNodeID ¶
func WithResueNodeID(b bool) SessionOption
func WithRetryTimes ¶
func WithRetryTimes(n int64) SessionOption
func WithTTL ¶
func WithTTL(ttl int64) SessionOption
type SessionRaw ¶
type SessionRaw struct { ServerID int64 `json:"ServerID,omitempty"` ServerName string `json:"ServerName,omitempty"` Address string `json:"Address,omitempty"` Exclusive bool `json:"Exclusive,omitempty"` Stopping bool `json:"Stopping,omitempty"` TriggerKill bool Version string `json:"Version"` IndexEngineVersion IndexEngineVersion `json:"IndexEngineVersion,omitempty"` LeaseID *clientv3.LeaseID `json:"LeaseID,omitempty"` HostName string `json:"HostName,omitempty"` EnableDisk bool `json:"EnableDisk,omitempty"` ServerLabels map[string]string `json:"ServerLabels,omitempty"` }
SessionRaw the persistent part of Session.
func (*SessionRaw) GetAddress ¶
func (s *SessionRaw) GetAddress() string
func (*SessionRaw) GetServerID ¶
func (s *SessionRaw) GetServerID() int64
func (*SessionRaw) GetServerLabel ¶
func (s *SessionRaw) GetServerLabel() map[string]string
func (*SessionRaw) IsTriggerKill ¶
func (s *SessionRaw) IsTriggerKill() bool