lib

package
v0.0.0-...-f3016af Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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

func GetShardIdByShardNumber(partition *Partition, shardNumber uint32) int64

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 DataCenter struct {
	Name        string `json:"Name"`
	ShardNumber uint32 `json:"ShardNumber"`
}

type DatabaseSchema

type DatabaseSchema struct {
	DatabaseName string        `json:"DatabaseName"`
	Tables       []TableSchema `json:"Tables"`
}

type DbRole

type DbRole string
const (
	DbRole_LEADER   DbRole = "leader"
	DbRole_Follower DbRole = "follower"
)

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 NodeShardList struct {
	NodeId            uint32   `json:"NodeId"`
	LeaderShardList   []uint32 `json:"LeaderShardList"`
	FollowerShardList []uint32 `json:"FollowerShardList"`
	IsEdgeNode        bool     `json:"IsEdgeNode"`
}

type Partition

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

func NewPartition

func NewPartition(dbName, tableName string, partitionId uint32) *Partition

func (*Partition) GetPartitionHash

func (p *Partition) GetPartitionHash() int64

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"`
}

Jump to

Keyboard shortcuts

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