Documentation ¶
Overview ¶
Copyright (C) BABEC. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) BABEC. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) BABEC. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) BABEC. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func ChecksumKeyModulo(key bn.Key, length int) int
- type KeyModuloAlgorithm
- type ModuloShardingAlgorithm
- type ShardingAlgorithm
- type ShardingBirdsNest
- func (s *ShardingBirdsNest) Add(key bn.Key) error
- func (s *ShardingBirdsNest) Adds(keys []bn.Key) (err error)
- func (s *ShardingBirdsNest) AddsAndSetHeight(keys []bn.Key, height uint64) (result error)
- func (s *ShardingBirdsNest) Contains(key bn.Key, rules ...common.RuleType) (bool, error)
- func (s *ShardingBirdsNest) Deserialize() error
- func (s *ShardingBirdsNest) GetHeight() uint64
- func (s *ShardingBirdsNest) Info() []uint64
- func (s *ShardingBirdsNest) Infos() [][]uint64
- func (s *ShardingBirdsNest) Serialize() error
- func (s *ShardingBirdsNest) SetHeight(height uint64)
- func (s *ShardingBirdsNest) Start()
- func (s *ShardingBirdsNest) ValidateRule(key bn.Key, rules ...common.RuleType) error
Constants ¶
View Source
const (
Filepath = "sharding"
)
Variables ¶
Functions ¶
Types ¶
type ModuloShardingAlgorithm ¶
type ModuloShardingAlgorithm struct {
Length int
}
func NewModuloSA ¶
func NewModuloSA(l int) *ModuloShardingAlgorithm
func (ModuloShardingAlgorithm) DoSharding ¶
func (a ModuloShardingAlgorithm) DoSharding(shardingValues []bn.Key) [][]bn.Key
DoSharding 如果传入 shardingValues 小于 Length 则 最小设置为1
func (ModuloShardingAlgorithm) DoShardingOnce ¶
func (a ModuloShardingAlgorithm) DoShardingOnce(key bn.Key) (index int)
type ShardingAlgorithm ¶
type ShardingBirdsNest ¶
type ShardingBirdsNest struct {
// contains filtered or unexported fields
}
func NewShardingBirdsNest ¶
func NewShardingBirdsNest(config *common.ShardingBirdsNestConfig, exitC chan struct{}, strategy bn.Strategy, alg ShardingAlgorithm, logger bn.Logger) (*ShardingBirdsNest, error)
func (*ShardingBirdsNest) Add ¶
func (s *ShardingBirdsNest) Add(key bn.Key) error
func (*ShardingBirdsNest) Adds ¶
func (s *ShardingBirdsNest) Adds(keys []bn.Key) (err error)
func (*ShardingBirdsNest) AddsAndSetHeight ¶
func (s *ShardingBirdsNest) AddsAndSetHeight(keys []bn.Key, height uint64) (result error)
func (*ShardingBirdsNest) Contains ¶
func (*ShardingBirdsNest) Deserialize ¶
func (s *ShardingBirdsNest) Deserialize() error
func (*ShardingBirdsNest) GetHeight ¶
func (s *ShardingBirdsNest) GetHeight() uint64
func (*ShardingBirdsNest) Info ¶
func (s *ShardingBirdsNest) Info() []uint64
func (*ShardingBirdsNest) Infos ¶
func (s *ShardingBirdsNest) Infos() [][]uint64
Infos index 0 sharding index index 0 height index 1 cuckoo size index 2 current index index 3 total cuckoo size index 4 total space occupied by cuckoo
func (*ShardingBirdsNest) Serialize ¶
func (s *ShardingBirdsNest) Serialize() error
func (*ShardingBirdsNest) SetHeight ¶
func (s *ShardingBirdsNest) SetHeight(height uint64)
func (*ShardingBirdsNest) Start ¶
func (s *ShardingBirdsNest) Start()
Start TODO Goroutinue should be turned off using context.Context here
Source Files ¶
Click to show internal directories.
Click to hide internal directories.