Documentation
¶
Index ¶
Constants ¶
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 ¶
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 ArchivalConfig ¶ added in v0.5.4
type ArchivalConfig struct {
// contains filtered or unexported fields
}
ArchivalConfig is an immutable representation of the current archival configuration of the cluster
func NewArchivalConfig ¶ added in v0.5.4
func NewArchivalConfig(status ArchivalStatus, defaultBucket string, enableReadFromArchival bool) *ArchivalConfig
NewArchivalConfig constructs a new valid ArchivalConfig
func (*ArchivalConfig) ConfiguredForArchival ¶ added in v0.5.4
func (a *ArchivalConfig) ConfiguredForArchival() bool
ConfiguredForArchival returns true if cluster is configured to handle archival, false otherwise. If cluster is configured for archival then defaultBucket will be set.
func (*ArchivalConfig) EnableReadFromArchival ¶ added in v0.5.7
func (a *ArchivalConfig) EnableReadFromArchival() bool
EnableReadFromArchival indicates whether history can be read from archival
func (*ArchivalConfig) GetArchivalStatus ¶ added in v0.5.4
func (a *ArchivalConfig) GetArchivalStatus() ArchivalStatus
GetArchivalStatus returns the archival status for ArchivalConfig
func (*ArchivalConfig) GetDefaultBucket ¶ added in v0.5.4
func (a *ArchivalConfig) GetDefaultBucket() string
GetDefaultBucket returns the default bucket for ArchivalConfig
type ArchivalStatus ¶ added in v0.5.4
type ArchivalStatus int
ArchivalStatus represents the archival status of the cluster
const (
// ArchivalDisabled means this cluster is not configured to handle archival
ArchivalDisabled ArchivalStatus = iota
// ArchivalPaused means this cluster is configured to handle archival but is currently not archiving
ArchivalPaused
// ArchivalEnabled means this cluster is currently archiving
ArchivalEnabled
)
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
// 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
// ArchivalConfig returns the archival config of the cluster
ArchivalConfig() *ArchivalConfig
}
Metadata provides information about clusters
func GetTestClusterMetadata ¶ added in v0.3.11
func GetTestClusterMetadata(enableGlobalDomain bool, isMasterCluster bool, enableArchival bool) Metadata
GetTestClusterMetadata return an cluster metadata instance, which is initialized
func NewMetadata ¶
func NewMetadata(
logger log.Logger,
enableGlobalDomain dynamicconfig.BoolPropertyFn,
failoverVersionIncrement int64,
masterClusterName string,
currentClusterName string,
clusterInfo map[string]config.ClusterInformation,
archivalStatus string,
defaultBucket string,
enableReadFromArchival bool,
) Metadata
NewMetadata create a new instance of Metadata