keypath

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ClusterPath is the path to save the cluster meta information.
	ClusterPath = "raft"
	// Config is the path to save the PD config.
	Config = "config"
	// ServiceMiddlewarePath is the path to save the service middleware config.
	ServiceMiddlewarePath = "service_middleware"

	// RulesPath is the path to save the placement rules.
	RulesPath = "rules"
	// RuleGroupPath is the path to save the placement rule groups.
	RuleGroupPath = "rule_group"
	// RegionLabelPath is the path to save the region label.
	RegionLabelPath = "region_label"

	// CustomSchedulerConfigPath is the path to save the scheduler config.
	CustomSchedulerConfigPath = "scheduler_config"
	// GCWorkerServiceSafePointID is the service id of GC worker.
	GCWorkerServiceSafePointID = "gc_worker"

	// resource group storage endpoint has prefix `resource_group`
	// ResourceGroupSettingsPath is the path to save the resource group settings.
	ResourceGroupSettingsPath = "settings"
	// ResourceGroupStatesPath is the path to save the resource group states.
	ResourceGroupStatesPath = "states"
	// ControllerConfigPath is the path to save the controller config.
	ControllerConfigPath = "controller"

	// TimestampKey is the key of timestamp oracle used for the suffix.
	TimestampKey = "timestamp"

	// ClusterIDPath is the path to store cluster id
	ClusterIDPath = "/pd/cluster_id"
)

Variables

This section is empty.

Functions

func AppendToRootPath

func AppendToRootPath(rootPath string, key string) string

AppendToRootPath appends the given key to the rootPath.

func ClusterBootstrapTimeKey

func ClusterBootstrapTimeKey() string

ClusterBootstrapTimeKey returns the path to save the cluster bootstrap timestamp.

func ClusterID

func ClusterID() uint64

ClusterID returns the cluster ID.

func ClusterRootPath

func ClusterRootPath(rootPath string) string

ClusterRootPath appends the `ClusterPath` to the rootPath.

func ConfigPath

func ConfigPath() string

ConfigPath returns the path to save the PD config.

func EncodeKeyspaceID

func EncodeKeyspaceID(spaceID uint32) string

EncodeKeyspaceID from uint32 to string. It adds extra padding to make encoded ID ordered. Encoded ID can be decoded directly with strconv.ParseUint. Width of the padded keyspaceID is 8 (decimal representation of uint24max is 16777215).

func ExternalTimestampPath

func ExternalTimestampPath() string

ExternalTimestampPath returns the external timestamp path.

func ExtractStoreIDFromPath

func ExtractStoreIDFromPath(path string) (uint64, error)

ExtractStoreIDFromPath extracts the store ID from the given path.

func FullTimestampPath

func FullTimestampPath(groupID uint32) string

FullTimestampPath returns the full timestamp path.

  1. for the default keyspace group: /pd/{cluster_id}/timestamp
  2. for the non-default keyspace groups: /ms/{cluster_id}/tso/{group}/gta/timestamp

func GCSafePointPath

func GCSafePointPath() string

GCSafePointPath returns the GC safe point key path.

func GCSafePointServicePath

func GCSafePointServicePath(serviceID string) string

GCSafePointServicePath returns the GC safe point service key path with the given service ID.

func GCSafePointServicePrefixPath

func GCSafePointServicePrefixPath() string

GCSafePointServicePrefixPath returns the GC safe point service key path prefix.

func GCSafePointV2Path

func GCSafePointV2Path(keyspaceID uint32) string

GCSafePointV2Path is the storage path of gc safe point v2. Path: keyspaces/gc_safe_point/{keyspaceID}

func GCSafePointV2Prefix

func GCSafePointV2Prefix() string

GCSafePointV2Prefix is the path prefix to all gc safe point v2. Prefix: keyspaces/gc_safe_point/

func GetCompiledKeyspaceGroupIDRegexp

func GetCompiledKeyspaceGroupIDRegexp() *regexp.Regexp

GetCompiledKeyspaceGroupIDRegexp returns the compiled regular expression for matching keyspace group id.

func GetCompiledNonDefaultIDRegexp

func GetCompiledNonDefaultIDRegexp() *regexp.Regexp

GetCompiledNonDefaultIDRegexp returns the compiled regular expression for matching non-default keyspace group id.

func KeyspaceGroupGlobalTSPath

func KeyspaceGroupGlobalTSPath(groupID uint32) string

KeyspaceGroupGlobalTSPath constructs the timestampOracle path prefix for Global TSO, which is:

  1. for the default keyspace group: "" in /pd/{cluster_id}/timestamp
  2. for the non-default keyspace groups: {group}/gta in /ms/{cluster_id}/tso/{group}/gta/timestamp

func KeyspaceGroupIDPath

func KeyspaceGroupIDPath(id uint32) string

KeyspaceGroupIDPath returns the path to keyspace id from the given name. Path: tso/keyspace_groups/membership/{id}

func KeyspaceGroupIDPrefix

func KeyspaceGroupIDPrefix() string

KeyspaceGroupIDPrefix returns the prefix of keyspace group id. Path: tso/keyspace_groups/membership

func KeyspaceGroupLocalTSPath

func KeyspaceGroupLocalTSPath(keyPrefix string, groupID uint32, dcLocation string) string

KeyspaceGroupLocalTSPath constructs the timestampOracle path prefix for Local TSO, which is:

  1. for the default keyspace group: lta/{dc-location} in /pd/{cluster_id}/lta/{dc-location}/timestamp
  2. for the non-default keyspace groups: {group}/lta/{dc-location} in /ms/{cluster_id}/tso/{group}/lta/{dc-location}/timestamp

func KeyspaceGroupPrimaryPath

func KeyspaceGroupPrimaryPath(rootPath string, keyspaceGroupID uint32) string

KeyspaceGroupPrimaryPath returns the path of keyspace group primary. default keyspace group: "/ms/{cluster_id}/tso/00000/primary". non-default keyspace group: "/ms/{cluster_id}/tso/keyspace_groups/election/{group}/primary".

func KeyspaceGroupsElectionPath

func KeyspaceGroupsElectionPath(rootPath string, keyspaceGroupID uint32) string

KeyspaceGroupsElectionPath returns the path of keyspace groups election. default keyspace group: "/ms/{cluster_id}/tso/00000". non-default keyspace group: "/ms/{cluster_id}/tso/keyspace_groups/election/{group}".

func KeyspaceIDAlloc

func KeyspaceIDAlloc() string

KeyspaceIDAlloc returns the path of the keyspace id's persistent window boundary. Path: keyspaces/alloc_id

func KeyspaceIDPath

func KeyspaceIDPath(name string) string

KeyspaceIDPath returns the path to keyspace id from the given name. Path: keyspaces/id/{name}

func KeyspaceMetaPath

func KeyspaceMetaPath(spaceID uint32) string

KeyspaceMetaPath returns the path to the given keyspace's metadata. Path: keyspaces/meta/{space_id}

func KeyspaceMetaPrefix

func KeyspaceMetaPrefix() string

KeyspaceMetaPrefix returns the prefix of keyspaces' metadata. Prefix: keyspaces/meta/

func LegacyRootPath

func LegacyRootPath() string

LegacyRootPath returns the root path of legacy pd service. Path: /pd/{cluster_id}

func MinResolvedTSPath

func MinResolvedTSPath() string

MinResolvedTSPath returns the min resolved ts path.

func PDRootPath

func PDRootPath() string

PDRootPath returns the PD root path.

func RegionLabelKeyPath

func RegionLabelKeyPath(ruleKey string) string

RegionLabelKeyPath returns the path to save the region label with the given rule key.

func RegionLabelPathPrefix

func RegionLabelPathPrefix() string

RegionLabelPathPrefix returns the path prefix to save the region label.

func RegionPath

func RegionPath(regionID uint64) string

RegionPath returns the region meta info key path with the given region ID.

func RegistryPath

func RegistryPath(serviceName, serviceAddr string) string

RegistryPath returns the full path to store microservice addresses.

func ReplicationModePath

func ReplicationModePath(mode string) string

ReplicationModePath returns the path to save the replication mode with the given mode.

func ResetClusterID

func ResetClusterID()

ResetClusterID resets the cluster ID to 0. It's only used in tests.

func ResourceGroupSettingKeyPath

func ResourceGroupSettingKeyPath(groupName string) string

ResourceGroupSettingKeyPath returns the path to save the resource group settings.

func ResourceGroupStateKeyPath

func ResourceGroupStateKeyPath(groupName string) string

ResourceGroupStateKeyPath returns the path to save the resource group states.

func ResourceManagerSvcRootPath

func ResourceManagerSvcRootPath() string

ResourceManagerSvcRootPath returns the root path of resource manager service. Path: /ms/{cluster_id}/resource_manager

func RuleCommonPathPrefix

func RuleCommonPathPrefix() string

RuleCommonPathPrefix returns the path prefix to save the placement rule common config.

func RuleGroupIDPath

func RuleGroupIDPath(groupID string) string

RuleGroupIDPath returns the path to save the placement rule group with the given group ID.

func RuleGroupPathPrefix

func RuleGroupPathPrefix() string

RuleGroupPathPrefix returns the path prefix to save the placement rule groups.

func RuleKeyPath

func RuleKeyPath(ruleKey string) string

RuleKeyPath returns the path to save the placement rule with the given rule key.

func RulesPathPrefix

func RulesPathPrefix() string

RulesPathPrefix returns the path prefix to save the placement rules.

func SchedulerConfigPath

func SchedulerConfigPath(schedulerName string) string

SchedulerConfigPath returns the path to save the scheduler config.

func SchedulerConfigPathPrefix

func SchedulerConfigPathPrefix() string

SchedulerConfigPathPrefix returns the path prefix to save the scheduler config.

func SchedulingPrimaryPath

func SchedulingPrimaryPath() string

SchedulingPrimaryPath returns the path of scheduling primary. Path: /ms/{cluster_id}/scheduling/primary

func SchedulingSvcRootPath

func SchedulingSvcRootPath() string

SchedulingSvcRootPath returns the root path of scheduling service. Path: /ms/{cluster_id}/scheduling

func ServicePath

func ServicePath(serviceName string) string

ServicePath returns the path to store microservice addresses.

func ServiceSafePointV2Path

func ServiceSafePointV2Path(keyspaceID uint32, serviceID string) string

ServiceSafePointV2Path is the storage path of service safe point v2. Path: keyspaces/service_safe_point/{spaceID}/{serviceID}

func ServiceSafePointV2Prefix

func ServiceSafePointV2Prefix(keyspaceID uint32) string

ServiceSafePointV2Prefix is the path prefix of all service safe point that belongs to a specific keyspace. Can be used to retrieve keyspace's service safe point at once. Path: keyspaces/service_safe_point/{spaceID}/

func SetClusterID

func SetClusterID(id uint64)

SetClusterID sets the cluster ID.

func StoreLeaderWeightPath

func StoreLeaderWeightPath(storeID uint64) string

StoreLeaderWeightPath returns the store leader weight key path with the given store ID.

func StorePath

func StorePath(storeID uint64) string

StorePath returns the store meta info key path with the given store ID.

func StorePathPrefix

func StorePathPrefix() string

StorePathPrefix returns the store meta info key path prefix.

func StoreRegionWeightPath

func StoreRegionWeightPath(storeID uint64) string

StoreRegionWeightPath returns the store region weight key path with the given store ID.

func TSOPath

func TSOPath() string

TSOPath returns the path to store TSO addresses.

func TSOSvcRootPath

func TSOSvcRootPath() string

TSOSvcRootPath returns the root path of tso service. Path: /ms/{cluster_id}/tso

func TimestampPath

func TimestampPath(tsPath string) string

TimestampPath returns the timestamp path for the given timestamp oracle path prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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