Documentation
¶
Index ¶
- Constants
- Variables
- func IdentityDataId(identity Identity) []byte
- func IdentityMetaId(identity Identity) []byte
- func IdentityVersionId(identity Identity, version int32) []byte
- func KeyBytes(key []byte) []byte
- func NsTabBytes(ns, tab int32) []byte
- func NsTabKeyBytes(ns, tab int32, key []byte) []byte
- type Data
- type Engine
- func (p *Engine) AddPart(part model.Partition) error
- func (p *Engine) Close()
- func (p *Engine) GetData(partId int32, id Identity) (*model.DataMeta, *model.DataContent, error)
- func (p *Engine) GetPart(partId int32) *model.Partition
- func (p *Engine) GetPartOfIndex(partIndex int32) *model.Partition
- func (p *Engine) PartRanges() []int
- func (p *Engine) PartSize() int
- func (p *Engine) Parts() []model.Partition
- func (p *Engine) SetData(partId int32, data Data, incrementVersion bool) error
- func (p *Engine) SimilarPart(ring int32) *model.Partition
- func (p *Engine) Table() *EngineTable
- func (p *Engine) ValidatePartition(nodeId int32) ([]model.Partition, error)
- type EngineTable
- func (p *EngineTable) AddPartition(part model.Partition) error
- func (p *EngineTable) Partition(partId int32) *model.Partition
- func (p *EngineTable) PartitionOfIndex(partIndex int32) *model.Partition
- func (p *EngineTable) Repository() *model.Repository
- func (p *EngineTable) RepositoryUpdate(repository model.Repository) error
- type Identity
- func NewIdOfData(namespace, table string, key []byte) *Identity
- func NewIdOfNs(key []byte) *Identity
- func NewIdOfPart(key []byte) *Identity
- func NewIdOfTab(namespace string, key []byte) *Identity
- func NewIdentity(ns, tab string, key []byte) *Identity
- func NewIdentityWithValue(idBytes []byte) *Identity
- type Store
- type StoreBadger
- type StoreConfig
- type StoreIterator
- type StoreMetaIterator
- type StoreOperator
- type StoreOperatorKV
- func (p *StoreOperatorKV) Close() error
- func (p *StoreOperatorKV) DataForEach(iter StoreIterator) error
- func (p *StoreOperatorKV) DataSeek(identity Identity, iter StoreIterator) error
- func (p *StoreOperatorKV) GetData(identity Identity) (*model.DataMeta, *model.DataContent, error)
- func (p *StoreOperatorKV) GetMeta(dataId Identity) (meta *model.DataMeta, err error)
- func (p *StoreOperatorKV) MetaForEach(iter StoreMetaIterator) error
- func (p *StoreOperatorKV) MetaSeek(identity Identity, iter StoreMetaIterator) error
- func (p *StoreOperatorKV) NS(namespace string) *model.Namespace
- func (p *StoreOperatorKV) NSIfAbsent(namespace string) *model.Namespace
- func (p *StoreOperatorKV) NSValue(nsId int32) *model.Namespace
- func (p *StoreOperatorKV) NSs() []model.Namespace
- func (p *StoreOperatorKV) Part() *model.Partition
- func (p *StoreOperatorKV) PartIfAbsent(part model.Partition) (*model.Partition, error)
- func (p *StoreOperatorKV) SetData(data Data, incrementVersion bool) error
- func (p *StoreOperatorKV) SetMeta(dataId Identity, meta model.DataMeta) error
- func (p *StoreOperatorKV) SysGet(table, key string, message ggproto.Message) error
- func (p *StoreOperatorKV) SysSet(table, key string, message ggproto.Message) error
- func (p *StoreOperatorKV) TAB(namespace string, tab string) *model.Table
- func (p *StoreOperatorKV) TABIfAbsent(namespace string, tab string) *model.Table
- func (p *StoreOperatorKV) TABValue(namespace string, tabId int32) *model.Table
- func (p *StoreOperatorKV) TABs(namespace string) []model.Table
- type StoreType
- type UEngineConfig
Constants ¶
View Source
const ( ENGINE_NAMESPACE_SYSTEM = "_sys" // 系统命名空间 ENGINE_NAMESPACE_USER = "_user" // 用户命名空间 ENGINE_TABLE_NAMESPACES = "_ns" //系统命名空间表名 ENGINE_TABLE_TABLES = "_tab" //系统表名 ENGINE_TABLE_PARTITIONS = "_part" //系统分区表名 ENGINE_TABLE_CLUSTERS = "_cluster" //集群信息存储表 ENGINE_TABLE_METAS = "_meta" //系统元数据表名 ENGINE_KEY_META_STORAGE = "storage" //存储元数据主键 ENGINE_KEY_META_PART = "part" //分区元数据主键 ENGINE_KEY_META_REPOSITORY = "repo" //分区元数据主键 )
View Source
const (
VERSION = 1
)
Variables ¶
View Source
var ( ErrPartRingVerifyFailed = errors.New("partition ring verify failed") ErrPartNotFound = errors.New("partition not found") ErrPartAllocated = errors.New("partition has been allocated") ErrPartNotAllocate = errors.New("partition not allocate") )
database
View Source
var ( StoreType_Value = map[string]uint8{ "UDB": 0, "BOLG": 1, "LEVELDB": 2, "BADGER": 3, } FLAG_META = []byte{'0'} FLAG_DATA = []byte{'1'} )
View Source
var (
EMPTY_KEY = []byte{}
)
View Source
var (
ErrDbKeyNotFound = errors.New("db:key not found")
)
Functions ¶
func IdentityDataId ¶
func IdentityMetaId ¶
func IdentityVersionId ¶
func NsTabBytes ¶
func NsTabKeyBytes ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine(config UEngineConfig) *Engine
func (*Engine) PartRanges ¶
func (*Engine) Table ¶
func (p *Engine) Table() *EngineTable
type EngineTable ¶
type EngineTable struct {
// contains filtered or unexported fields
}
func NewEngineTable ¶
func NewEngineTable(engine *Engine) *EngineTable
func (*EngineTable) AddPartition ¶
func (p *EngineTable) AddPartition(part model.Partition) error
func (*EngineTable) PartitionOfIndex ¶
func (p *EngineTable) PartitionOfIndex(partIndex int32) *model.Partition
func (*EngineTable) Repository ¶
func (p *EngineTable) Repository() *model.Repository
func (*EngineTable) RepositoryUpdate ¶
func (p *EngineTable) RepositoryUpdate(repository model.Repository) error
type Identity ¶
type Identity struct { NamespaceId int32 //命名空间id Namespace string //命名空间名称 TableId int32 //表id Table string //表名称 PartitionIndex int32 //分区索引 PartitionId int32 //分区id Key []byte //用户主键 // contains filtered or unexported fields }
func NewIdOfData ¶
func NewIdOfPart ¶
func NewIdOfTab ¶
func NewIdentity ¶
func NewIdentityWithValue ¶
type Store ¶
type Store interface { Close() error Set(key, value []byte) error Get(key []byte) ([]byte, error) Seek(key []byte, iter StoreIterator) error ForEach(iter StoreIterator) error }
func NewStore ¶
func NewStore(cfg StoreConfig) (s Store)
func OpenStoreBadger ¶
func OpenStoreBadger(cfg StoreConfig) (Store, error)
type StoreBadger ¶
type StoreBadger struct {
// contains filtered or unexported fields
}
func (*StoreBadger) Close ¶
func (p *StoreBadger) Close() error
func (*StoreBadger) ForEach ¶
func (p *StoreBadger) ForEach(iter StoreIterator) (err error)
func (*StoreBadger) Seek ¶
func (p *StoreBadger) Seek(key []byte, iter StoreIterator) (err error)
func (*StoreBadger) Set ¶
func (p *StoreBadger) Set(key, value []byte) error
type StoreConfig ¶
type StoreIterator ¶
type StoreOperator ¶
type StoreOperator interface { Close() error PartIfAbsent(part model.Partition) (*model.Partition, error) Part() *model.Partition MetaSeek(identity Identity, iter StoreMetaIterator) error MetaForEach(iter StoreMetaIterator) error DataSeek(identity Identity, iter StoreIterator) error DataForEach(iter StoreIterator) error NSs() []model.Namespace NS(namespace string) *model.Namespace NSValue(namespaceId int32) *model.Namespace NSIfAbsent(namespace string) *model.Namespace TABs(namespace string) []model.Table TAB(namespace, table string) *model.Table TABValue(namespace string, tableId int32) *model.Table TABIfAbsent(namespace, table string) *model.Table SysSet(table, key string, message ggproto.Message) error SysGet(table, key string, message ggproto.Message) error SetMeta(identity Identity, meta model.DataMeta) error GetMeta(identity Identity) (*model.DataMeta, error) SetData(data Data, incrementVersion bool) error GetData(identity Identity) (*model.DataMeta, *model.DataContent, error) }
type StoreOperatorKV ¶
type StoreOperatorKV struct {
// contains filtered or unexported fields
}
func NewStoreOperatorKV ¶
func NewStoreOperatorKV(store Store) *StoreOperatorKV
func (*StoreOperatorKV) Close ¶
func (p *StoreOperatorKV) Close() error
func (*StoreOperatorKV) DataForEach ¶
func (p *StoreOperatorKV) DataForEach(iter StoreIterator) error
func (*StoreOperatorKV) DataSeek ¶
func (p *StoreOperatorKV) DataSeek(identity Identity, iter StoreIterator) error
func (*StoreOperatorKV) GetData ¶
func (p *StoreOperatorKV) GetData(identity Identity) (*model.DataMeta, *model.DataContent, error)
func (*StoreOperatorKV) GetMeta ¶
func (p *StoreOperatorKV) GetMeta(dataId Identity) (meta *model.DataMeta, err error)
func (*StoreOperatorKV) MetaForEach ¶
func (p *StoreOperatorKV) MetaForEach(iter StoreMetaIterator) error
func (*StoreOperatorKV) MetaSeek ¶
func (p *StoreOperatorKV) MetaSeek(identity Identity, iter StoreMetaIterator) error
func (*StoreOperatorKV) NSIfAbsent ¶
func (p *StoreOperatorKV) NSIfAbsent(namespace string) *model.Namespace
func (*StoreOperatorKV) NSs ¶
func (p *StoreOperatorKV) NSs() []model.Namespace
func (*StoreOperatorKV) Part ¶
func (p *StoreOperatorKV) Part() *model.Partition
func (*StoreOperatorKV) PartIfAbsent ¶
func (*StoreOperatorKV) SetData ¶
func (p *StoreOperatorKV) SetData(data Data, incrementVersion bool) error
func (*StoreOperatorKV) SetMeta ¶
func (p *StoreOperatorKV) SetMeta(dataId Identity, meta model.DataMeta) error
func (*StoreOperatorKV) SysGet ¶
func (p *StoreOperatorKV) SysGet(table, key string, message ggproto.Message) error
func (*StoreOperatorKV) SysSet ¶
func (p *StoreOperatorKV) SysSet(table, key string, message ggproto.Message) error
func (*StoreOperatorKV) TAB ¶
func (p *StoreOperatorKV) TAB(namespace string, tab string) *model.Table
func (*StoreOperatorKV) TABIfAbsent ¶
func (p *StoreOperatorKV) TABIfAbsent(namespace string, tab string) *model.Table
Source Files
¶
Click to show internal directories.
Click to hide internal directories.