cluster

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 7 Imported by: 5

Documentation

Overview

Package cluster is a generated GoMock package.

Index

Constants

View Source
const (
	// TestCurrentClusterInitialFailoverVersion is initial failover version for current cluster
	TestCurrentClusterInitialFailoverVersion = int64(1)
	// TestAlternativeClusterInitialFailoverVersion is initial failover version for alternative cluster
	TestAlternativeClusterInitialFailoverVersion = 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"
	// TestCurrentClusterFrontendAddress is the ip port address of current cluster
	TestCurrentClusterFrontendAddress = "127.0.0.1:7134"
	// TestAlternativeClusterFrontendAddress is the ip port address of alternative cluster
	TestAlternativeClusterFrontendAddress = "127.0.0.1:8134"
)

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: config.ClusterInformation{
			Enabled:                true,
			InitialFailoverVersion: TestCurrentClusterInitialFailoverVersion,
			RPCName:                common.FrontendServiceName,
			RPCAddress:             TestCurrentClusterFrontendAddress,
		},
		TestAlternativeClusterName: config.ClusterInformation{
			Enabled:                true,
			InitialFailoverVersion: TestAlternativeClusterInitialFailoverVersion,
			RPCName:                common.FrontendServiceName,
			RPCAddress:             TestAlternativeClusterFrontendAddress,
		},
	}

	// 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: config.ClusterInformation{
			Enabled:                true,
			InitialFailoverVersion: TestCurrentClusterInitialFailoverVersion,
			RPCName:                common.FrontendServiceName,
			RPCAddress:             TestCurrentClusterFrontendAddress,
		},
	}
)

Functions

This section is empty.

Types

type Metadata

type Metadata interface {
	// IsGlobalNamespaceEnabled whether the global namespace is enabled,
	// this attr should be discarded when cross DC is made public
	IsGlobalNamespaceEnabled() bool
	// IsMasterCluster whether current cluster is master cluster
	IsMasterCluster() bool
	// GetNextFailoverVersion return the next failover version for namespace failover
	GetNextFailoverVersion(string, int64) int64
	// IsVersionFromSameCluster return true if 2 version are used for the same cluster
	IsVersionFromSameCluster(version1 int64, version2 int64) bool
	// GetMasterClusterName return the master cluster name
	GetMasterClusterName() 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
	// GetReplicationConsumerConfig returns the config for replication task consumer.
	GetReplicationConsumerConfig() *config.ReplicationConsumerConfig
}

Metadata provides information about clusters

func GetTestClusterMetadata added in v0.3.11

func GetTestClusterMetadata(enableGlobalNamespace bool, isMasterCluster bool) Metadata

GetTestClusterMetadata return an cluster metadata instance, which is initialized

func NewMetadata

func NewMetadata(
	logger log.Logger,
	enableGlobalNamespace bool,
	failoverVersionIncrement int64,
	masterClusterName string,
	currentClusterName string,
	clusterInfo map[string]config.ClusterInformation,
	replicationConsumer *config.ReplicationConsumerConfig,
) Metadata

NewMetadata create a new instance of Metadata

type MockMetadata added in v0.27.0

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

MockMetadata is a mock of Metadata interface.

func NewMockMetadata added in v0.27.0

func NewMockMetadata(ctrl *gomock.Controller) *MockMetadata

NewMockMetadata creates a new mock instance.

func (*MockMetadata) ClusterNameForFailoverVersion added in v0.27.0

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

ClusterNameForFailoverVersion mocks base method.

func (*MockMetadata) EXPECT added in v0.27.0

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

func (*MockMetadata) GetAllClusterInfo added in v0.27.0

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

GetAllClusterInfo mocks base method.

func (*MockMetadata) GetCurrentClusterName added in v0.27.0

func (m *MockMetadata) GetCurrentClusterName() string

GetCurrentClusterName mocks base method.

func (*MockMetadata) GetMasterClusterName added in v0.27.0

func (m *MockMetadata) GetMasterClusterName() string

GetMasterClusterName mocks base method.

func (*MockMetadata) GetNextFailoverVersion added in v0.27.0

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

GetNextFailoverVersion mocks base method.

func (*MockMetadata) GetReplicationConsumerConfig added in v0.27.0

func (m *MockMetadata) GetReplicationConsumerConfig() *config.ReplicationConsumerConfig

GetReplicationConsumerConfig mocks base method.

func (*MockMetadata) IsGlobalNamespaceEnabled added in v0.27.0

func (m *MockMetadata) IsGlobalNamespaceEnabled() bool

IsGlobalNamespaceEnabled mocks base method.

func (*MockMetadata) IsMasterCluster added in v0.27.0

func (m *MockMetadata) IsMasterCluster() bool

IsMasterCluster mocks base method.

func (*MockMetadata) IsVersionFromSameCluster added in v0.27.0

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

IsVersionFromSameCluster mocks base method.

type MockMetadataMockRecorder added in v0.27.0

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

MockMetadataMockRecorder is the mock recorder for MockMetadata.

func (*MockMetadataMockRecorder) ClusterNameForFailoverVersion added in v0.27.0

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

ClusterNameForFailoverVersion indicates an expected call of ClusterNameForFailoverVersion.

func (*MockMetadataMockRecorder) GetAllClusterInfo added in v0.27.0

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

GetAllClusterInfo indicates an expected call of GetAllClusterInfo.

func (*MockMetadataMockRecorder) GetCurrentClusterName added in v0.27.0

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

GetCurrentClusterName indicates an expected call of GetCurrentClusterName.

func (*MockMetadataMockRecorder) GetMasterClusterName added in v0.27.0

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

GetMasterClusterName indicates an expected call of GetMasterClusterName.

func (*MockMetadataMockRecorder) GetNextFailoverVersion added in v0.27.0

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

GetNextFailoverVersion indicates an expected call of GetNextFailoverVersion.

func (*MockMetadataMockRecorder) GetReplicationConsumerConfig added in v0.27.0

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

GetReplicationConsumerConfig indicates an expected call of GetReplicationConsumerConfig.

func (*MockMetadataMockRecorder) IsGlobalNamespaceEnabled added in v0.27.0

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

IsGlobalNamespaceEnabled indicates an expected call of IsGlobalNamespaceEnabled.

func (*MockMetadataMockRecorder) IsMasterCluster added in v0.27.0

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

IsMasterCluster indicates an expected call of IsMasterCluster.

func (*MockMetadataMockRecorder) IsVersionFromSameCluster added in v0.27.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