Documentation ¶
Index ¶
- Constants
- Variables
- func InitActiveRecord(opts ...Option)
- func ReinitActiveRecord(opts ...Option)
- func WithShard(masters []OptionInterface, replicas []OptionInterface) clusterOption
- type ActiveRecord
- type Cluster
- func AddClusterChecker(ctx context.Context, configPath string, params ClusterConfigParameters) (*Cluster, error)
- func GetClusterInfoFromCfg(ctx context.Context, path string, globs MapGlobParam, ...) (*Cluster, error)
- func NewCluster(shardCnt int) *Cluster
- func NewClusterInfo(opts ...clusterOption) *Cluster
- func (c *Cluster) Append(shard Shard)
- func (c *Cluster) Equal(c2 *Cluster) bool
- func (c *Cluster) NextMaster(shardNum int) ShardInstance
- func (c *Cluster) NextReplica(shardNum int) (ShardInstance, bool)
- func (c *Cluster) SetShardInstances(shardNum int, instances []ShardInstance)
- func (c *Cluster) ShardInstances(shardNum int) []ShardInstance
- func (c *Cluster) Shards() int
- type ClusterCheckerInterface
- type ClusterConfigParameters
- type ConfigCacherInterface
- type ConfigInterface
- type ConnectionCacherInterface
- type ConnectionInterface
- type DefaultConfig
- func (dc *DefaultConfig) GetBool(ctx context.Context, confPath string, dfl ...bool) bool
- func (dc *DefaultConfig) GetBoolIfExists(ctx context.Context, confPath string) (value bool, ok bool)
- func (dc *DefaultConfig) GetDuration(ctx context.Context, confPath string, dfl ...time.Duration) time.Duration
- func (dc *DefaultConfig) GetDurationIfExists(ctx context.Context, confPath string) (time.Duration, bool)
- func (dc *DefaultConfig) GetInt(ctx context.Context, confPath string, dfl ...int) int
- func (dc *DefaultConfig) GetIntIfExists(ctx context.Context, confPath string) (int, bool)
- func (dc *DefaultConfig) GetLastUpdateTime() time.Time
- func (dc *DefaultConfig) GetString(ctx context.Context, confPath string, dfl ...string) string
- func (dc *DefaultConfig) GetStringIfExists(ctx context.Context, confPath string) (string, bool)
- func (dc *DefaultConfig) GetStrings(ctx context.Context, confPath string, dfl []string) []string
- func (dc *DefaultConfig) GetStruct(ctx context.Context, confPath string, valuePtr interface{}) (bool, error)
- type DefaultConfigCacher
- type DefaultLogger
- func (l *DefaultLogger) CollectQueries(ctx context.Context, f func() (MockerLogger, error))
- func (l *DefaultLogger) Debug(ctx context.Context, args ...interface{})
- func (l *DefaultLogger) Error(ctx context.Context, args ...interface{})
- func (l *DefaultLogger) Fatal(ctx context.Context, args ...interface{})
- func (l *DefaultLogger) Info(ctx context.Context, args ...interface{})
- func (l *DefaultLogger) Panic(ctx context.Context, args ...interface{})
- func (l *DefaultLogger) SetLogLevel(level uint32)
- func (l *DefaultLogger) SetLoggerValueToContext(ctx context.Context, val ValueLogPrefix) context.Context
- func (l *DefaultLogger) Trace(ctx context.Context, args ...interface{})
- func (l *DefaultLogger) Warn(ctx context.Context, args ...interface{})
- type DefaultNoopMetric
- type DefaultNoopMetricCount
- type DefaultNoopMetricTimer
- type GroupHash
- type IprotoLogger
- type Limiter
- type LoggerInterface
- type MapGlobParam
- type MetricErrorCountInterface
- type MetricInterface
- type MetricStatCountInterface
- type MetricTimerInterface
- type MockConfig
- func (_m *MockConfig) EXPECT() *MockConfig_Expecter
- func (_m *MockConfig) GetBool(ctx context.Context, confPath string, dfl ...bool) bool
- func (_m *MockConfig) GetBoolIfExists(ctx context.Context, confPath string) (bool, bool)
- func (_m *MockConfig) GetDuration(ctx context.Context, confPath string, dfl ...time.Duration) time.Duration
- func (_m *MockConfig) GetDurationIfExists(ctx context.Context, confPath string) (time.Duration, bool)
- func (_m *MockConfig) GetInt(ctx context.Context, confPath string, dfl ...int) int
- func (_m *MockConfig) GetIntIfExists(ctx context.Context, confPath string) (int, bool)
- func (_m *MockConfig) GetLastUpdateTime() time.Time
- func (_m *MockConfig) GetString(ctx context.Context, confPath string, dfl ...string) string
- func (_m *MockConfig) GetStringIfExists(ctx context.Context, confPath string) (string, bool)
- func (_m *MockConfig) GetStrings(ctx context.Context, confPath string, dfl []string) []string
- func (_m *MockConfig) GetStruct(ctx context.Context, confPath string, valuePtr interface{}) (bool, error)
- type MockConfig_Expecter
- func (_e *MockConfig_Expecter) GetBool(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetBool_Call
- func (_e *MockConfig_Expecter) GetBoolIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetBoolIfExists_Call
- func (_e *MockConfig_Expecter) GetDuration(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetDuration_Call
- func (_e *MockConfig_Expecter) GetDurationIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetDurationIfExists_Call
- func (_e *MockConfig_Expecter) GetInt(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetInt_Call
- func (_e *MockConfig_Expecter) GetIntIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetIntIfExists_Call
- func (_e *MockConfig_Expecter) GetLastUpdateTime() *MockConfig_GetLastUpdateTime_Call
- func (_e *MockConfig_Expecter) GetString(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetString_Call
- func (_e *MockConfig_Expecter) GetStringIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetStringIfExists_Call
- func (_e *MockConfig_Expecter) GetStrings(ctx interface{}, confPath interface{}, dfl interface{}) *MockConfig_GetStrings_Call
- func (_e *MockConfig_Expecter) GetStruct(ctx interface{}, confPath interface{}, valuePtr interface{}) *MockConfig_GetStruct_Call
- type MockConfig_GetBoolIfExists_Call
- func (_c *MockConfig_GetBoolIfExists_Call) Return(value bool, ok bool) *MockConfig_GetBoolIfExists_Call
- func (_c *MockConfig_GetBoolIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetBoolIfExists_Call
- func (_c *MockConfig_GetBoolIfExists_Call) RunAndReturn(run func(context.Context, string) (bool, bool)) *MockConfig_GetBoolIfExists_Call
- type MockConfig_GetBool_Call
- func (_c *MockConfig_GetBool_Call) Return(_a0 bool) *MockConfig_GetBool_Call
- func (_c *MockConfig_GetBool_Call) Run(run func(ctx context.Context, confPath string, dfl ...bool)) *MockConfig_GetBool_Call
- func (_c *MockConfig_GetBool_Call) RunAndReturn(run func(context.Context, string, ...bool) bool) *MockConfig_GetBool_Call
- type MockConfig_GetDurationIfExists_Call
- func (_c *MockConfig_GetDurationIfExists_Call) Return(_a0 time.Duration, _a1 bool) *MockConfig_GetDurationIfExists_Call
- func (_c *MockConfig_GetDurationIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetDurationIfExists_Call
- func (_c *MockConfig_GetDurationIfExists_Call) RunAndReturn(run func(context.Context, string) (time.Duration, bool)) *MockConfig_GetDurationIfExists_Call
- type MockConfig_GetDuration_Call
- func (_c *MockConfig_GetDuration_Call) Return(_a0 time.Duration) *MockConfig_GetDuration_Call
- func (_c *MockConfig_GetDuration_Call) Run(run func(ctx context.Context, confPath string, dfl ...time.Duration)) *MockConfig_GetDuration_Call
- func (_c *MockConfig_GetDuration_Call) RunAndReturn(run func(context.Context, string, ...time.Duration) time.Duration) *MockConfig_GetDuration_Call
- type MockConfig_GetIntIfExists_Call
- func (_c *MockConfig_GetIntIfExists_Call) Return(_a0 int, _a1 bool) *MockConfig_GetIntIfExists_Call
- func (_c *MockConfig_GetIntIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetIntIfExists_Call
- func (_c *MockConfig_GetIntIfExists_Call) RunAndReturn(run func(context.Context, string) (int, bool)) *MockConfig_GetIntIfExists_Call
- type MockConfig_GetInt_Call
- func (_c *MockConfig_GetInt_Call) Return(_a0 int) *MockConfig_GetInt_Call
- func (_c *MockConfig_GetInt_Call) Run(run func(ctx context.Context, confPath string, dfl ...int)) *MockConfig_GetInt_Call
- func (_c *MockConfig_GetInt_Call) RunAndReturn(run func(context.Context, string, ...int) int) *MockConfig_GetInt_Call
- type MockConfig_GetLastUpdateTime_Call
- func (_c *MockConfig_GetLastUpdateTime_Call) Return(_a0 time.Time) *MockConfig_GetLastUpdateTime_Call
- func (_c *MockConfig_GetLastUpdateTime_Call) Run(run func()) *MockConfig_GetLastUpdateTime_Call
- func (_c *MockConfig_GetLastUpdateTime_Call) RunAndReturn(run func() time.Time) *MockConfig_GetLastUpdateTime_Call
- type MockConfig_GetStringIfExists_Call
- func (_c *MockConfig_GetStringIfExists_Call) Return(_a0 string, _a1 bool) *MockConfig_GetStringIfExists_Call
- func (_c *MockConfig_GetStringIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetStringIfExists_Call
- func (_c *MockConfig_GetStringIfExists_Call) RunAndReturn(run func(context.Context, string) (string, bool)) *MockConfig_GetStringIfExists_Call
- type MockConfig_GetString_Call
- func (_c *MockConfig_GetString_Call) Return(_a0 string) *MockConfig_GetString_Call
- func (_c *MockConfig_GetString_Call) Run(run func(ctx context.Context, confPath string, dfl ...string)) *MockConfig_GetString_Call
- func (_c *MockConfig_GetString_Call) RunAndReturn(run func(context.Context, string, ...string) string) *MockConfig_GetString_Call
- type MockConfig_GetStrings_Call
- func (_c *MockConfig_GetStrings_Call) Return(_a0 []string) *MockConfig_GetStrings_Call
- func (_c *MockConfig_GetStrings_Call) Run(run func(ctx context.Context, confPath string, dfl []string)) *MockConfig_GetStrings_Call
- func (_c *MockConfig_GetStrings_Call) RunAndReturn(run func(context.Context, string, []string) []string) *MockConfig_GetStrings_Call
- type MockConfig_GetStruct_Call
- func (_c *MockConfig_GetStruct_Call) Return(_a0 bool, _a1 error) *MockConfig_GetStruct_Call
- func (_c *MockConfig_GetStruct_Call) Run(run func(ctx context.Context, confPath string, valuePtr interface{})) *MockConfig_GetStruct_Call
- func (_c *MockConfig_GetStruct_Call) RunAndReturn(run func(context.Context, string, interface{}) (bool, error)) *MockConfig_GetStruct_Call
- type MockerLogger
- type Option
- type OptionInterface
- type SelectorLimiter
- type SerializerInterface
- type ServerModeType
- type Shard
- type ShardInstance
- type ShardInstanceConfig
- type ShardInstanceType
- type ValueLogPrefix
Constants ¶
const ( PanicLoggerLevel uint32 = iota FatalLoggerLevel ErrorLoggerLevel WarnLoggerLevel InfoLoggerLevel DebugLoggerLevel TraceLoggerLevel )
const (
ContextLogprefix ctxKey = iota
)
const (
ValueContextErrorField = "context"
)
Variables ¶
var ErrNoData = errors.New("no data")
Functions ¶
func InitActiveRecord ¶
func InitActiveRecord(opts ...Option)
func ReinitActiveRecord ¶
func ReinitActiveRecord(opts ...Option)
func WithShard ¶
func WithShard(masters []OptionInterface, replicas []OptionInterface) clusterOption
Types ¶
type ActiveRecord ¶
type ActiveRecord struct {
// contains filtered or unexported fields
}
func GetInstance ¶
func GetInstance() *ActiveRecord
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Тип описывающий кластер. Сейчас кластер - это набор шардов.
func AddClusterChecker ¶ added in v1.11.0
func AddClusterChecker(ctx context.Context, configPath string, params ClusterConfigParameters) (*Cluster, error)
AddClusterChecker регистрирует конфигурацию кластера в локальном пингере
func GetClusterInfoFromCfg ¶
func GetClusterInfoFromCfg(ctx context.Context, path string, globs MapGlobParam, optionCreator func(ShardInstanceConfig) (OptionInterface, error)) (*Cluster, error)
Констркуктор позволяющий проинициализировать кластер их конфигурации. На вход передаётся путь в конфиге, значения по умолчанию, и ссылка на функцию, которая создаёт структуру опций и считает контрольную сумму, для того, что бы следить за их изменением в онлайне.
func NewCluster ¶ added in v1.11.0
func NewClusterInfo ¶
func NewClusterInfo(opts ...clusterOption) *Cluster
Конструктор который позволяет проинициализировать новый кластер. В опциях передаются все шарды, сколько шардов, столько и опций. Используется в случаях, когда информация по кластеру прописана непосредственно в декларации модели, а не в конфиге. Так же используется при тестировании.
func (*Cluster) Equal ¶ added in v1.11.1
Equal сравнивает загруженные конфигурации кластеров на основе контрольной суммы всех инстансов кластера
func (*Cluster) NextMaster ¶ added in v1.11.0
func (c *Cluster) NextMaster(shardNum int) ShardInstance
NextMaster выбирает следующий доступный инстанс мастера в шарде shardNum
func (*Cluster) NextReplica ¶ added in v1.11.0
func (c *Cluster) NextReplica(shardNum int) (ShardInstance, bool)
NextMaster выбирает следующий доступный инстанс реплики в шарде shardNum
func (*Cluster) SetShardInstances ¶ added in v1.11.0
func (c *Cluster) SetShardInstances(shardNum int, instances []ShardInstance)
SetShardInstances заменяет инстансы кластера в шарде shardNum на инстансы из instances
func (*Cluster) ShardInstances ¶ added in v1.11.0
func (c *Cluster) ShardInstances(shardNum int) []ShardInstance
ShardInstances копия всех инстансов из шарды shardNum
type ClusterCheckerInterface ¶ added in v1.11.0
type ClusterConfigParameters ¶ added in v1.11.0
type ClusterConfigParameters struct { Globs MapGlobParam OptionCreator func(ShardInstanceConfig) (OptionInterface, error) OptionChecker func(ctx context.Context, instance ShardInstance) (OptionInterface, error) }
func (ClusterConfigParameters) Validate ¶ added in v1.11.0
func (c ClusterConfigParameters) Validate() bool
type ConfigCacherInterface ¶
type ConfigCacherInterface interface {
Get(ctx context.Context, path string, glob MapGlobParam, optionCreator func(ShardInstanceConfig) (OptionInterface, error)) (*Cluster, error)
}
func ConfigCacher ¶
func ConfigCacher() ConfigCacherInterface
type ConfigInterface ¶
type ConfigInterface interface { GetBool(ctx context.Context, confPath string, dfl ...bool) bool GetBoolIfExists(ctx context.Context, confPath string) (value bool, ok bool) GetInt(ctx context.Context, confPath string, dfl ...int) int GetIntIfExists(ctx context.Context, confPath string) (int, bool) GetDuration(ctx context.Context, confPath string, dfl ...time.Duration) time.Duration GetDurationIfExists(ctx context.Context, confPath string) (time.Duration, bool) GetString(ctx context.Context, confPath string, dfl ...string) string GetStringIfExists(ctx context.Context, confPath string) (string, bool) GetStrings(ctx context.Context, confPath string, dfl []string) []string GetStruct(ctx context.Context, confPath string, valuePtr interface{}) (bool, error) GetLastUpdateTime() time.Time }
func Config ¶
func Config() ConfigInterface
type ConnectionCacherInterface ¶
type ConnectionCacherInterface interface { Add(shard ShardInstance, connector func(interface{}) (ConnectionInterface, error)) (ConnectionInterface, error) GetOrAdd(shard ShardInstance, connector func(interface{}) (ConnectionInterface, error)) (ConnectionInterface, error) Get(shard ShardInstance) ConnectionInterface CloseConnection(context.Context) }
func ConnectionCacher ¶
func ConnectionCacher() ConnectionCacherInterface
type ConnectionInterface ¶
type ConnectionInterface interface { Close() Done() <-chan struct{} }
type DefaultConfig ¶
type DefaultConfig struct {
// contains filtered or unexported fields
}
func NewDefaultConfig ¶
func NewDefaultConfig() *DefaultConfig
func NewDefaultConfigFromMap ¶
func NewDefaultConfigFromMap(cfg map[string]interface{}) *DefaultConfig
func (*DefaultConfig) GetBoolIfExists ¶
func (*DefaultConfig) GetDuration ¶
func (*DefaultConfig) GetDurationIfExists ¶
func (*DefaultConfig) GetIntIfExists ¶
func (*DefaultConfig) GetLastUpdateTime ¶
func (dc *DefaultConfig) GetLastUpdateTime() time.Time
func (*DefaultConfig) GetStringIfExists ¶
func (*DefaultConfig) GetStrings ¶
type DefaultConfigCacher ¶
type DefaultConfigCacher struct {
// contains filtered or unexported fields
}
Структура для кеширования полученных конфигураций. Инвалидация происходит посредством сравнения updateTime сданной труктуры и самого конфига. Используется для шаринга конфигов между можелями если они используют одну и ту же конфигурацию для подключений
func NewConfigCacher ¶ added in v1.11.0
func NewConfigCacher() *DefaultConfigCacher
Конструктор для создания нового кешера конфигов
func (*DefaultConfigCacher) Get ¶
func (cc *DefaultConfigCacher) Get(ctx context.Context, path string, globs MapGlobParam, optionCreator func(ShardInstanceConfig) (OptionInterface, error)) (*Cluster, error)
Получение конфигурации. Если есть в кеше и он еще валидный, то конфигурация берётся из кешаб если в кеше нет, то достаём из конфига и кешируем.
type DefaultLogger ¶
type DefaultLogger struct { Fields ValueLogPrefix // contains filtered or unexported fields }
func NewLogger ¶
func NewLogger() *DefaultLogger
func (*DefaultLogger) CollectQueries ¶
func (l *DefaultLogger) CollectQueries(ctx context.Context, f func() (MockerLogger, error))
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(ctx context.Context, args ...interface{})
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(ctx context.Context, args ...interface{})
func (*DefaultLogger) Fatal ¶
func (l *DefaultLogger) Fatal(ctx context.Context, args ...interface{})
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(ctx context.Context, args ...interface{})
func (*DefaultLogger) Panic ¶
func (l *DefaultLogger) Panic(ctx context.Context, args ...interface{})
func (*DefaultLogger) SetLogLevel ¶
func (l *DefaultLogger) SetLogLevel(level uint32)
func (*DefaultLogger) SetLoggerValueToContext ¶
func (l *DefaultLogger) SetLoggerValueToContext(ctx context.Context, val ValueLogPrefix) context.Context
func (*DefaultLogger) Trace ¶
func (l *DefaultLogger) Trace(ctx context.Context, args ...interface{})
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(ctx context.Context, args ...interface{})
type DefaultNoopMetric ¶
type DefaultNoopMetric struct{}
func NewDefaultNoopMetric ¶
func NewDefaultNoopMetric() *DefaultNoopMetric
func (*DefaultNoopMetric) ErrorCount ¶
func (*DefaultNoopMetric) ErrorCount(storage, entity string) MetricStatCountInterface
func (*DefaultNoopMetric) StatCount ¶
func (*DefaultNoopMetric) StatCount(storage, entity string) MetricStatCountInterface
func (*DefaultNoopMetric) Timer ¶
func (*DefaultNoopMetric) Timer(storage, entity string) MetricTimerInterface
type DefaultNoopMetricCount ¶
type DefaultNoopMetricCount struct{}
type DefaultNoopMetricTimer ¶
type DefaultNoopMetricTimer struct{}
type GroupHash ¶ added in v1.12.0
type GroupHash struct {
// contains filtered or unexported fields
}
func NewGroupHash ¶ added in v1.12.0
func (*GroupHash) UpdateHash ¶ added in v1.12.0
type IprotoLogger ¶
type IprotoLogger struct{}
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
func EmptyLimiter ¶
func EmptyLimiter() Limiter
func NewLimitOffset ¶
func NewLimiter ¶
func NewThreshold ¶
func (Limiter) FullfillWarn ¶
type LoggerInterface ¶
type LoggerInterface interface { SetLoggerValueToContext(ctx context.Context, addVal ValueLogPrefix) context.Context SetLogLevel(level uint32) Fatal(ctx context.Context, args ...interface{}) Error(ctx context.Context, args ...interface{}) Warn(ctx context.Context, args ...interface{}) Info(ctx context.Context, args ...interface{}) Debug(ctx context.Context, args ...interface{}) Trace(ctx context.Context, args ...interface{}) CollectQueries(ctx context.Context, f func() (MockerLogger, error)) }
func Logger ¶
func Logger() LoggerInterface
type MapGlobParam ¶
Тип используемый для передачи набора значений по умолчанию для параметров
type MetricInterface ¶
type MetricInterface interface { StatCount(storage, entity string) MetricStatCountInterface ErrorCount(storage, entity string) MetricStatCountInterface Timer(storage, entity string) MetricTimerInterface }
func Metric ¶
func Metric() MetricInterface
type MetricTimerInterface ¶
type MockConfig ¶ added in v1.11.0
MockConfig is an autogenerated mock type for the ConfigInterface type
func NewMockConfig ¶ added in v1.11.0
func NewMockConfig(t mockConstructorTestingTNewMockConfig) *MockConfig
NewMockConfig creates a new instance of MockConfig. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockConfig) EXPECT ¶ added in v1.11.0
func (_m *MockConfig) EXPECT() *MockConfig_Expecter
func (*MockConfig) GetBool ¶ added in v1.11.0
GetBool provides a mock function with given fields: ctx, confPath, dfl
func (*MockConfig) GetBoolIfExists ¶ added in v1.11.0
GetBoolIfExists provides a mock function with given fields: ctx, confPath
func (*MockConfig) GetDuration ¶ added in v1.11.0
func (_m *MockConfig) GetDuration(ctx context.Context, confPath string, dfl ...time.Duration) time.Duration
GetDuration provides a mock function with given fields: ctx, confPath, dfl
func (*MockConfig) GetDurationIfExists ¶ added in v1.11.0
func (_m *MockConfig) GetDurationIfExists(ctx context.Context, confPath string) (time.Duration, bool)
GetDurationIfExists provides a mock function with given fields: ctx, confPath
func (*MockConfig) GetInt ¶ added in v1.11.0
GetInt provides a mock function with given fields: ctx, confPath, dfl
func (*MockConfig) GetIntIfExists ¶ added in v1.11.0
GetIntIfExists provides a mock function with given fields: ctx, confPath
func (*MockConfig) GetLastUpdateTime ¶ added in v1.11.0
func (_m *MockConfig) GetLastUpdateTime() time.Time
GetLastUpdateTime provides a mock function with given fields:
func (*MockConfig) GetString ¶ added in v1.11.0
GetString provides a mock function with given fields: ctx, confPath, dfl
func (*MockConfig) GetStringIfExists ¶ added in v1.11.0
GetStringIfExists provides a mock function with given fields: ctx, confPath
func (*MockConfig) GetStrings ¶ added in v1.11.0
GetStrings provides a mock function with given fields: ctx, confPath, dfl
type MockConfig_Expecter ¶ added in v1.11.0
type MockConfig_Expecter struct {
// contains filtered or unexported fields
}
func (*MockConfig_Expecter) GetBool ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetBool(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetBool_Call
GetBool is a helper method to define mock.On call
- ctx context.Context
- confPath string
- dfl ...bool
func (*MockConfig_Expecter) GetBoolIfExists ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetBoolIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetBoolIfExists_Call
GetBoolIfExists is a helper method to define mock.On call
- ctx context.Context
- confPath string
func (*MockConfig_Expecter) GetDuration ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetDuration(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetDuration_Call
GetDuration is a helper method to define mock.On call
- ctx context.Context
- confPath string
- dfl ...time.Duration
func (*MockConfig_Expecter) GetDurationIfExists ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetDurationIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetDurationIfExists_Call
GetDurationIfExists is a helper method to define mock.On call
- ctx context.Context
- confPath string
func (*MockConfig_Expecter) GetInt ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetInt(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetInt_Call
GetInt is a helper method to define mock.On call
- ctx context.Context
- confPath string
- dfl ...int
func (*MockConfig_Expecter) GetIntIfExists ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetIntIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetIntIfExists_Call
GetIntIfExists is a helper method to define mock.On call
- ctx context.Context
- confPath string
func (*MockConfig_Expecter) GetLastUpdateTime ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetLastUpdateTime() *MockConfig_GetLastUpdateTime_Call
GetLastUpdateTime is a helper method to define mock.On call
func (*MockConfig_Expecter) GetString ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetString(ctx interface{}, confPath interface{}, dfl ...interface{}) *MockConfig_GetString_Call
GetString is a helper method to define mock.On call
- ctx context.Context
- confPath string
- dfl ...string
func (*MockConfig_Expecter) GetStringIfExists ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetStringIfExists(ctx interface{}, confPath interface{}) *MockConfig_GetStringIfExists_Call
GetStringIfExists is a helper method to define mock.On call
- ctx context.Context
- confPath string
func (*MockConfig_Expecter) GetStrings ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetStrings(ctx interface{}, confPath interface{}, dfl interface{}) *MockConfig_GetStrings_Call
GetStrings is a helper method to define mock.On call
- ctx context.Context
- confPath string
- dfl []string
func (*MockConfig_Expecter) GetStruct ¶ added in v1.11.0
func (_e *MockConfig_Expecter) GetStruct(ctx interface{}, confPath interface{}, valuePtr interface{}) *MockConfig_GetStruct_Call
GetStruct is a helper method to define mock.On call
- ctx context.Context
- confPath string
- valuePtr interface{}
type MockConfig_GetBoolIfExists_Call ¶ added in v1.11.0
MockConfig_GetBoolIfExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBoolIfExists'
func (*MockConfig_GetBoolIfExists_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetBoolIfExists_Call) Return(value bool, ok bool) *MockConfig_GetBoolIfExists_Call
func (*MockConfig_GetBoolIfExists_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetBoolIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetBoolIfExists_Call
func (*MockConfig_GetBoolIfExists_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetBoolIfExists_Call) RunAndReturn(run func(context.Context, string) (bool, bool)) *MockConfig_GetBoolIfExists_Call
type MockConfig_GetBool_Call ¶ added in v1.11.0
MockConfig_GetBool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBool'
func (*MockConfig_GetBool_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetBool_Call) Return(_a0 bool) *MockConfig_GetBool_Call
func (*MockConfig_GetBool_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetBool_Call) Run(run func(ctx context.Context, confPath string, dfl ...bool)) *MockConfig_GetBool_Call
func (*MockConfig_GetBool_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetBool_Call) RunAndReturn(run func(context.Context, string, ...bool) bool) *MockConfig_GetBool_Call
type MockConfig_GetDurationIfExists_Call ¶ added in v1.11.0
MockConfig_GetDurationIfExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDurationIfExists'
func (*MockConfig_GetDurationIfExists_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetDurationIfExists_Call) Return(_a0 time.Duration, _a1 bool) *MockConfig_GetDurationIfExists_Call
func (*MockConfig_GetDurationIfExists_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetDurationIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetDurationIfExists_Call
func (*MockConfig_GetDurationIfExists_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetDurationIfExists_Call) RunAndReturn(run func(context.Context, string) (time.Duration, bool)) *MockConfig_GetDurationIfExists_Call
type MockConfig_GetDuration_Call ¶ added in v1.11.0
MockConfig_GetDuration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDuration'
func (*MockConfig_GetDuration_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetDuration_Call) Return(_a0 time.Duration) *MockConfig_GetDuration_Call
func (*MockConfig_GetDuration_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetDuration_Call) Run(run func(ctx context.Context, confPath string, dfl ...time.Duration)) *MockConfig_GetDuration_Call
func (*MockConfig_GetDuration_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetDuration_Call) RunAndReturn(run func(context.Context, string, ...time.Duration) time.Duration) *MockConfig_GetDuration_Call
type MockConfig_GetIntIfExists_Call ¶ added in v1.11.0
MockConfig_GetIntIfExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIntIfExists'
func (*MockConfig_GetIntIfExists_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetIntIfExists_Call) Return(_a0 int, _a1 bool) *MockConfig_GetIntIfExists_Call
func (*MockConfig_GetIntIfExists_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetIntIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetIntIfExists_Call
func (*MockConfig_GetIntIfExists_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetIntIfExists_Call) RunAndReturn(run func(context.Context, string) (int, bool)) *MockConfig_GetIntIfExists_Call
type MockConfig_GetInt_Call ¶ added in v1.11.0
MockConfig_GetInt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInt'
func (*MockConfig_GetInt_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetInt_Call) Return(_a0 int) *MockConfig_GetInt_Call
func (*MockConfig_GetInt_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetInt_Call) Run(run func(ctx context.Context, confPath string, dfl ...int)) *MockConfig_GetInt_Call
func (*MockConfig_GetInt_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetInt_Call) RunAndReturn(run func(context.Context, string, ...int) int) *MockConfig_GetInt_Call
type MockConfig_GetLastUpdateTime_Call ¶ added in v1.11.0
MockConfig_GetLastUpdateTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLastUpdateTime'
func (*MockConfig_GetLastUpdateTime_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetLastUpdateTime_Call) Return(_a0 time.Time) *MockConfig_GetLastUpdateTime_Call
func (*MockConfig_GetLastUpdateTime_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetLastUpdateTime_Call) Run(run func()) *MockConfig_GetLastUpdateTime_Call
func (*MockConfig_GetLastUpdateTime_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetLastUpdateTime_Call) RunAndReturn(run func() time.Time) *MockConfig_GetLastUpdateTime_Call
type MockConfig_GetStringIfExists_Call ¶ added in v1.11.0
MockConfig_GetStringIfExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStringIfExists'
func (*MockConfig_GetStringIfExists_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetStringIfExists_Call) Return(_a0 string, _a1 bool) *MockConfig_GetStringIfExists_Call
func (*MockConfig_GetStringIfExists_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetStringIfExists_Call) Run(run func(ctx context.Context, confPath string)) *MockConfig_GetStringIfExists_Call
func (*MockConfig_GetStringIfExists_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetStringIfExists_Call) RunAndReturn(run func(context.Context, string) (string, bool)) *MockConfig_GetStringIfExists_Call
type MockConfig_GetString_Call ¶ added in v1.11.0
MockConfig_GetString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetString'
func (*MockConfig_GetString_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetString_Call) Return(_a0 string) *MockConfig_GetString_Call
func (*MockConfig_GetString_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetString_Call) Run(run func(ctx context.Context, confPath string, dfl ...string)) *MockConfig_GetString_Call
func (*MockConfig_GetString_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetString_Call) RunAndReturn(run func(context.Context, string, ...string) string) *MockConfig_GetString_Call
type MockConfig_GetStrings_Call ¶ added in v1.11.0
MockConfig_GetStrings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStrings'
func (*MockConfig_GetStrings_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetStrings_Call) Return(_a0 []string) *MockConfig_GetStrings_Call
func (*MockConfig_GetStrings_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetStrings_Call) Run(run func(ctx context.Context, confPath string, dfl []string)) *MockConfig_GetStrings_Call
func (*MockConfig_GetStrings_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetStrings_Call) RunAndReturn(run func(context.Context, string, []string) []string) *MockConfig_GetStrings_Call
type MockConfig_GetStruct_Call ¶ added in v1.11.0
MockConfig_GetStruct_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStruct'
func (*MockConfig_GetStruct_Call) Return ¶ added in v1.11.0
func (_c *MockConfig_GetStruct_Call) Return(_a0 bool, _a1 error) *MockConfig_GetStruct_Call
func (*MockConfig_GetStruct_Call) Run ¶ added in v1.11.0
func (_c *MockConfig_GetStruct_Call) Run(run func(ctx context.Context, confPath string, valuePtr interface{})) *MockConfig_GetStruct_Call
func (*MockConfig_GetStruct_Call) RunAndReturn ¶ added in v1.11.0
func (_c *MockConfig_GetStruct_Call) RunAndReturn(run func(context.Context, string, interface{}) (bool, error)) *MockConfig_GetStruct_Call
type MockerLogger ¶
type MockerLogger struct { // Название моккера MockerName string // Вызовы моккера для создания списка моков Mockers string // Получение списка фикстур для моков FixturesSelector string // Название пакета для которого необходимо добавить моки ResultName string // Результат возвращаемый селектором Results any }
Структура используемая для сбора статистики по запросам
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithConfig ¶
func WithConfig(config ConfigInterface) Option
func WithConfigCacher ¶ added in v1.11.0
func WithConfigCacher(configCacher ConfigCacherInterface) Option
func WithConnectionPinger ¶ added in v1.11.0
func WithConnectionPinger(pc ClusterCheckerInterface) Option
func WithLogger ¶
func WithLogger(logger LoggerInterface) Option
func WithMetrics ¶
func WithMetrics(metric MetricInterface) Option
type OptionInterface ¶
type OptionInterface interface { GetConnectionID() string InstanceMode() ServerModeType }
Интерфейс которому должен соответствовать билдер опций подключения к конретному инстансу
type SelectorLimiter ¶
type SerializerInterface ¶
type ServerModeType ¶
type ServerModeType uint8
Тип и константы для определения режима работы конкретного инстанса.
const ( ModeMaster ServerModeType = iota ModeReplica )
type Shard ¶
type Shard struct { Masters []ShardInstance Replicas []ShardInstance // contains filtered or unexported fields }
Структура описывающая конкретный шард. Каждый шард может состоять из набора мастеров и реплик
func (*Shard) Instances ¶ added in v1.11.0
func (c *Shard) Instances() []ShardInstance
Instances копия списка конфигураций всех инстансов шарды. В начале списка следуют мастера, потом реплики
func (*Shard) NextMaster ¶
func (s *Shard) NextMaster() ShardInstance
Функция выбирающая следующий доступный инстанс мастера в конкретном шарде
func (*Shard) NextReplica ¶
func (s *Shard) NextReplica() ShardInstance
Инстанс выбирающий следующий доступный инстанс реплики в конкретном шарде
type ShardInstance ¶
type ShardInstance struct { ParamsID string Config ShardInstanceConfig Options interface{} Offline bool }
Структура описывающая инстанс в кластере
type ShardInstanceConfig ¶
type ShardInstanceConfig struct { Timeout time.Duration Mode ServerModeType PoolSize int Addr string User string Password string }
Структура используется для описания конфигурации конктретного инстанса
type ShardInstanceType ¶
type ShardInstanceType uint8
Тип и константы для выбора инстанса в шарде
const ( MasterInstanceType ShardInstanceType = iota // Любой из описанных мастеров. По умолчанию используется для rw запросов ReplicaInstanceType // Любой из описанных реплик ReplicaOrMasterInstanceType // Любая реплика если есть, если нет то любой мастер. По умолчанию используется при селекте )
type ValueLogPrefix ¶
type ValueLogPrefix map[string]interface{}