Documentation ¶
Index ¶
- Constants
- func GetPartitionId(dbName, tableName string, formatKey *LaserKeyFormat, partitionNumber int) uint32
- func GetShardId(partition *Partition, config *ConfigManager, dc string) int64
- func GetShardIdByShardNumber(partition *Partition, shardNumber uint32) int64
- type ClusterGroup
- type ClusterInfo
- type ConfigManager
- type DataCenter
- type DatabaseSchema
- type DbRole
- type KeyType
- type LaserKeyFormat
- type LaserKeyFormatBase
- type NodeShardList
- type Partition
- type PartitionManager
- type TableSchema
Constants ¶
View Source
const ( LASER_CONFIG_DATABASE_TABLE_SCHEMA_DATA = "database_table_schema_data" LASER_CONFIG_CLUSTER_INFO = "cluster_info_data" LASER_CONFIG_ROCKSDB_CONFIG = "rocksdb_config_data" )
View Source
const UINT32MAX int64 = 4294967295 // 2^32 - 1
Variables ¶
This section is empty.
Functions ¶
func GetPartitionId ¶
func GetPartitionId(dbName, tableName string, formatKey *LaserKeyFormat, partitionNumber int) uint32
func GetShardId ¶
func GetShardId(partition *Partition, config *ConfigManager, dc string) int64
func GetShardIdByShardNumber ¶
Types ¶
type ClusterGroup ¶
type ClusterGroup struct { GroupName string `json:"GroupName"` Nodes []NodeShardList `json:"Nodes"` Dc string `json:"Dc"` }
type ClusterInfo ¶
type ClusterInfo struct { ClusterName string `json:"ClusterName"` ShardNumber uint32 `json:"ShardNumber"` Dcs []DataCenter `json:"Dcs"` Groups []ClusterGroup `json:"Groups"` }
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
func NewConfigManager ¶
func NewConfigManager(targetServiceName string, router *service_router.Router) *ConfigManager
func (*ConfigManager) ConfigNotify ¶
func (cm *ConfigManager) ConfigNotify(serviceName string, config service_router.ServiceConfig)
func (*ConfigManager) GetShardNumber ¶
func (cm *ConfigManager) GetShardNumber(dc string) uint32
func (*ConfigManager) GetTableSchema ¶
func (cm *ConfigManager) GetTableSchema(databaseName, tableName string) (TableSchema, bool)
type DataCenter ¶
type DatabaseSchema ¶
type DatabaseSchema struct { DatabaseName string `json:"DatabaseName"` Tables []TableSchema `json:"Tables"` }
type KeyType ¶
type KeyType int
const ( KeyType_DEFAULT KeyType KeyType_COMPOSITE KeyType_TTL_SORT )
type LaserKeyFormat ¶
type LaserKeyFormat struct {
*LaserKeyFormatBase
}
func NewLaserKeyFormat ¶
func NewLaserKeyFormat( primaryKeys, columns []string, ) *LaserKeyFormat
type LaserKeyFormatBase ¶
type LaserKeyFormatBase struct {
// contains filtered or unexported fields
}
func NewLaserKeyFormatBase ¶
func NewLaserKeyFormatBase( primaryKeys, columns []string, keyType KeyType, ) *LaserKeyFormatBase
func (*LaserKeyFormatBase) GetColumns ¶
func (kfb *LaserKeyFormatBase) GetColumns() []string
func (*LaserKeyFormatBase) GetKeyHash ¶
func (kfb *LaserKeyFormatBase) GetKeyHash() int64
func (*LaserKeyFormatBase) GetKeyType ¶
func (kfb *LaserKeyFormatBase) GetKeyType() KeyType
func (*LaserKeyFormatBase) GetPrimaryKeys ¶
func (kfb *LaserKeyFormatBase) GetPrimaryKeys() []string
type NodeShardList ¶
type Partition ¶
type Partition struct {
// contains filtered or unexported fields
}
func NewPartition ¶
func (*Partition) GetPartitionHash ¶
type PartitionManager ¶
type PartitionManager struct { }
type TableSchema ¶
type TableSchema struct { DatabaseName string `json:"DatabaseName,omitempty"` TableName string `json:"TableName"` PartitionNumber int `json:"PartitionNumber"` Ttl uint64 `json:"Ttl"` BindEdgeNodes []string `json:"BindEdgeNodes"` EdgeFlowRatio int `json:"EdgeFlowRatio"` Dc string `json:"Dc"` DistDc string `json:"DistDc"` }
Click to show internal directories.
Click to hide internal directories.