cluster

package
Version: v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 9 Imported by: 19

Documentation

Overview

Package cluster is a generated GoMock package.

Index

Constants

View Source
const (
	// TestCurrentClusterInitialFailoverVersion is initial failover version for current cluster
	TestCurrentClusterInitialFailoverVersion = int64(0)
	// TestAlternativeClusterInitialFailoverVersion is initial failover version for alternative cluster
	TestAlternativeClusterInitialFailoverVersion = int64(1)
	// TestDisabledClusterInitialFailoverVersion is initial failover version for disabled cluster
	TestDisabledClusterInitialFailoverVersion = int64(2)
	// TestFailoverVersionIncrement is failover version increment used for test
	TestFailoverVersionIncrement = int64(10)
	// TestCurrentClusterName is current cluster used for test
	TestCurrentClusterName = "active"
	// TestAlternativeClusterName is alternative cluster used for test
	TestAlternativeClusterName = "standby"
	// TestDisabledClusterName is disabled cluster used for test
	TestDisabledClusterName = "disabled"
	// TestCurrentClusterFrontendAddress is the ip port address of current cluster
	TestCurrentClusterFrontendAddress = "127.0.0.1:7104"
	// TestAlternativeClusterFrontendAddress is the ip port address of alternative cluster
	TestAlternativeClusterFrontendAddress = "127.0.0.1:8104"
)

Variables

View Source
var (
	// TestAllClusterNames is the all cluster names used for test
	TestAllClusterNames = []string{TestCurrentClusterName, TestAlternativeClusterName}
	// TestAllClusterInfo is the same as above, just convenient for test mocking
	TestAllClusterInfo = map[string]config.ClusterInformation{
		TestCurrentClusterName: {
			Enabled:                true,
			InitialFailoverVersion: TestCurrentClusterInitialFailoverVersion,
			RPCName:                common.FrontendServiceName,
			RPCAddress:             TestCurrentClusterFrontendAddress,
		},
		TestAlternativeClusterName: {
			Enabled:                true,
			InitialFailoverVersion: TestAlternativeClusterInitialFailoverVersion,
			RPCName:                common.FrontendServiceName,
			RPCAddress:             TestAlternativeClusterFrontendAddress,
		},
		TestDisabledClusterName: {
			Enabled:                false,
			InitialFailoverVersion: TestDisabledClusterInitialFailoverVersion,
		},
	}

	// TestSingleDCAllClusterNames is the all cluster names used for test
	TestSingleDCAllClusterNames = []string{TestCurrentClusterName}
	// TestSingleDCClusterInfo is the same as above, just convenient for test mocking
	TestSingleDCClusterInfo = map[string]config.ClusterInformation{
		TestCurrentClusterName: {
			Enabled:                true,
			InitialFailoverVersion: TestCurrentClusterInitialFailoverVersion,
			RPCName:                common.FrontendServiceName,
			RPCAddress:             TestCurrentClusterFrontendAddress,
		},
	}
)

Functions

func GetOrUseDefaultActiveCluster added in v0.22.0

func GetOrUseDefaultActiveCluster(currentClusterName string, activeClusterName string) string

GetOrUseDefaultActiveCluster return the current cluster name or use the input if valid

func GetOrUseDefaultClusters added in v0.22.0

func GetOrUseDefaultClusters(currentClusterName string, clusters []*persistence.ClusterReplicationConfig) []*persistence.ClusterReplicationConfig

GetOrUseDefaultClusters return the current cluster or use the input if valid

Types

type Metadata

type Metadata interface {
	// IsGlobalDomainEnabled whether the global domain is enabled,
	// this attr should be discarded when cross DC is made public
	IsGlobalDomainEnabled() bool
	// IsPrimaryCluster whether current cluster is the primary cluster
	IsPrimaryCluster() bool
	// GetNextFailoverVersion return the next failover version for domain failover
	GetNextFailoverVersion(string, int64) int64
	// IsVersionFromSameCluster return true if 2 version are used for the same cluster
	IsVersionFromSameCluster(version1 int64, version2 int64) bool
	// GetPrimaryClusterName return the primary cluster name
	GetPrimaryClusterName() string
	// GetCurrentClusterName return the current cluster name
	GetCurrentClusterName() string
	// GetAllClusterInfo return the all cluster name -> corresponding info
	GetAllClusterInfo() map[string]config.ClusterInformation
	// ClusterNameForFailoverVersion return the corresponding cluster name for a given failover version
	ClusterNameForFailoverVersion(failoverVersion int64) string
}

Metadata provides information about clusters

func GetTestClusterMetadata added in v0.3.11

func GetTestClusterMetadata(enableGlobalDomain bool, isPrimaryCluster bool) Metadata

GetTestClusterMetadata return an cluster metadata instance, which is initialized

func NewMetadata

func NewMetadata(
	logger log.Logger,
	enableGlobalDomain dynamicconfig.BoolPropertyFn,
	failoverVersionIncrement int64,
	primaryClusterName string,
	currentClusterName string,
	clusterInfo map[string]config.ClusterInformation,
) Metadata

NewMetadata create a new instance of Metadata

type MockMetadata added in v0.11.0

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

MockMetadata is a mock of Metadata interface

func NewMockMetadata added in v0.11.0

func NewMockMetadata(ctrl *gomock.Controller) *MockMetadata

NewMockMetadata creates a new mock instance

func (*MockMetadata) ClusterNameForFailoverVersion added in v0.11.0

func (m *MockMetadata) ClusterNameForFailoverVersion(failoverVersion int64) string

ClusterNameForFailoverVersion mocks base method

func (*MockMetadata) EXPECT added in v0.11.0

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMetadata) GetAllClusterInfo added in v0.11.0

func (m *MockMetadata) GetAllClusterInfo() map[string]config.ClusterInformation

GetAllClusterInfo mocks base method

func (*MockMetadata) GetCurrentClusterName added in v0.11.0

func (m *MockMetadata) GetCurrentClusterName() string

GetCurrentClusterName mocks base method

func (*MockMetadata) GetNextFailoverVersion added in v0.11.0

func (m *MockMetadata) GetNextFailoverVersion(arg0 string, arg1 int64) int64

GetNextFailoverVersion mocks base method

func (*MockMetadata) GetPrimaryClusterName added in v0.22.0

func (m *MockMetadata) GetPrimaryClusterName() string

GetPrimaryClusterName mocks base method

func (*MockMetadata) IsGlobalDomainEnabled added in v0.11.0

func (m *MockMetadata) IsGlobalDomainEnabled() bool

IsGlobalDomainEnabled mocks base method

func (*MockMetadata) IsPrimaryCluster added in v0.22.0

func (m *MockMetadata) IsPrimaryCluster() bool

IsPrimaryCluster mocks base method

func (*MockMetadata) IsVersionFromSameCluster added in v0.11.0

func (m *MockMetadata) IsVersionFromSameCluster(version1, version2 int64) bool

IsVersionFromSameCluster mocks base method

type MockMetadataMockRecorder added in v0.11.0

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

MockMetadataMockRecorder is the mock recorder for MockMetadata

func (*MockMetadataMockRecorder) ClusterNameForFailoverVersion added in v0.11.0

func (mr *MockMetadataMockRecorder) ClusterNameForFailoverVersion(failoverVersion interface{}) *gomock.Call

ClusterNameForFailoverVersion indicates an expected call of ClusterNameForFailoverVersion

func (*MockMetadataMockRecorder) GetAllClusterInfo added in v0.11.0

func (mr *MockMetadataMockRecorder) GetAllClusterInfo() *gomock.Call

GetAllClusterInfo indicates an expected call of GetAllClusterInfo

func (*MockMetadataMockRecorder) GetCurrentClusterName added in v0.11.0

func (mr *MockMetadataMockRecorder) GetCurrentClusterName() *gomock.Call

GetCurrentClusterName indicates an expected call of GetCurrentClusterName

func (*MockMetadataMockRecorder) GetNextFailoverVersion added in v0.11.0

func (mr *MockMetadataMockRecorder) GetNextFailoverVersion(arg0, arg1 interface{}) *gomock.Call

GetNextFailoverVersion indicates an expected call of GetNextFailoverVersion

func (*MockMetadataMockRecorder) GetPrimaryClusterName added in v0.22.0

func (mr *MockMetadataMockRecorder) GetPrimaryClusterName() *gomock.Call

GetPrimaryClusterName indicates an expected call of GetPrimaryClusterName

func (*MockMetadataMockRecorder) IsGlobalDomainEnabled added in v0.11.0

func (mr *MockMetadataMockRecorder) IsGlobalDomainEnabled() *gomock.Call

IsGlobalDomainEnabled indicates an expected call of IsGlobalDomainEnabled

func (*MockMetadataMockRecorder) IsPrimaryCluster added in v0.22.0

func (mr *MockMetadataMockRecorder) IsPrimaryCluster() *gomock.Call

IsPrimaryCluster indicates an expected call of IsPrimartCluster

func (*MockMetadataMockRecorder) IsVersionFromSameCluster added in v0.11.0

func (mr *MockMetadataMockRecorder) IsVersionFromSameCluster(version1, version2 interface{}) *gomock.Call

IsVersionFromSameCluster indicates an expected call of IsVersionFromSameCluster

Jump to

Keyboard shortcuts

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