cluster

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 4 Imported by: 20

Documentation

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)
	// 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: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}
	// TestAllClusterFailoverVersions is the same as above, juse convinent for test mocking
	TestAllClusterFailoverVersions = map[string]int64{
		TestCurrentClusterName:     TestCurrentClusterInitialFailoverVersion,
		TestAlternativeClusterName: TestAlternativeClusterInitialFailoverVersion,
	}
	// TestAllClusterAddress is the same as above, juse convinent for test mocking
	TestAllClusterAddress = map[string]config.Address{
		TestCurrentClusterName:     config.Address{RPCName: common.FrontendServiceName, RPCAddress: TestCurrentClusterFrontendAddress},
		TestAlternativeClusterName: config.Address{RPCName: common.FrontendServiceName, RPCAddress: TestAlternativeClusterFrontendAddress},
	}

	// TestSingleDCAllClusterNames is the all cluster names used for test
	TestSingleDCAllClusterNames = []string{TestCurrentClusterName}
	// TestSingleDCAllClusterFailoverVersions is the same as above, juse convinent for test mocking
	TestSingleDCAllClusterFailoverVersions = map[string]int64{
		TestCurrentClusterName: TestCurrentClusterInitialFailoverVersion,
	}
	// TestSingleDCAllClusterAddress is the same as above, juse convinent for test mocking
	TestSingleDCAllClusterAddress = map[string]config.Address{
		TestCurrentClusterName: config.Address{RPCName: common.FrontendServiceName, RPCAddress: TestCurrentClusterFrontendAddress},
	}
)

Functions

This section is empty.

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
	// IsMasterCluster whether current cluster is master cluster
	IsMasterCluster() 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
	// GetMasterClusterName return the master cluster name
	GetMasterClusterName() string
	// GetCurrentClusterName return the current cluster name
	GetCurrentClusterName() string
	// GetAllClusterFailoverVersions return the all cluster name -> corresponding initial failover version
	GetAllClusterFailoverVersions() map[string]int64
	// ClusterNameForFailoverVersion return the corresponding cluster name for a given failover version
	ClusterNameForFailoverVersion(failoverVersion int64) string
	// GetAllClientAddress return the frontend address for each cluster name
	GetAllClientAddress() map[string]config.Address

	// IsArchivalEnabled whether archival is enabled
	IsArchivalEnabled() bool
	// GetDefaultArchivalBucket returns the default archival bucket name
	GetDefaultArchivalBucket() string
}

Metadata provides information about clusters

func GetTestClusterMetadata added in v0.3.11

func GetTestClusterMetadata(enableGlobalDomain bool, isMasterCluster bool) Metadata

GetTestClusterMetadata return an cluster metadata instance, which is initialized

func NewMetadata

func NewMetadata(
	enableGlobalDomain dynamicconfig.BoolPropertyFn,
	failoverVersionIncrement int64,
	masterClusterName string,
	currentClusterName string,
	clusterInitialFailoverVersions map[string]int64,
	clusterToAddress map[string]config.Address,
	enableArchival dynamicconfig.BoolPropertyFn,
	defaultArchivalBucket string,
) Metadata

NewMetadata create a new instance of Metadata

Jump to

Keyboard shortcuts

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