Versions in this module Expand all Collapse all v2 v2.3.3 Oct 19, 2023 Changes in this version + const DefaultLoadFactor + const Filepath + const TestDir + var ErrBirdsNestSizeCannotBeZero = errors.New("the size cannot be 0") + var ErrCannotModifyTheNestConfiguration = errors.New(...) + var ErrFilterExtensionNotSupportMessage = "filter extension not support type: %v" + var ErrKeyCannotBeEmpty = errors.New("key cannot be empty") + var ErrKeyItsSoLongAgoError = errors.New("key is out of the range") + var ErrKeyLengthCannotBeZero = errors.New("the key length cannot be 0") + var ErrKeyTimeIsNotInTheFilterRange = errors.New("key time is not in the filter range") + var ErrNotTimestampKey = errors.New("not timestamp txid") + var ErrTimestampKeyIsInvalid = errors.New("TxId nanosecond is invalid") + var KeyType_name = map[KeyType]string + var Separator = byte(202) + var SeparatorString = "-" + var SerializeIntervalType_name = map[SerializeIntervalType]string + func CurrentTimestampNano() int64 + func Factory() *factory + func GenTimestampKey() string + func GenTimestampKeyByNano(nano int64) string + func GenTxId() string + func LruStrategy(bn *BirdsNestImpl) error + func ToStrings(keys []Key) []string + func ToTimestampKeysAndNormalKeys(key []string) (timestampKeys []Key, normalKeys []Key) + type AbsoluteExpireTimeRule struct + func NewAETRule(absoluteExpireTime int64, logger Logger) AbsoluteExpireTimeRule + func (r AbsoluteExpireTimeRule) Validate(key Key) error + type BirdsNest interface + Add func(key Key) error + Adds func(keys []Key) (result error) + AddsAndSetHeight func(keys []Key, height uint64) (result error) + Contains func(key Key, rules ...RuleType) (bool, error) + GetHeight func() uint64 + Info func() []uint64 + SetHeight func(height uint64) + Start func() + ValidateRule func(key Key, rules ...RuleType) error + type BirdsNestConfig struct + ChainId string + Cuckoo *CuckooConfig + Length uint32 + Rules *RulesConfig + Snapshot *SnapshotSerializerConfig + type BirdsNestImpl struct + func NewBirdsNest(config *BirdsNestConfig, exitC chan struct{}, strategy Strategy, logger Logger) (*BirdsNestImpl, error) + func NewBirdsNestByNumber(config *BirdsNestConfig, exitC chan struct{}, strategy Strategy, logger Logger, ...) (*BirdsNestImpl, error) + func (b *BirdsNestImpl) Add(key Key) error + func (b *BirdsNestImpl) Adds(keys []Key) error + func (b *BirdsNestImpl) AddsAndSetHeight(keys []Key, height uint64) (result error) + func (b *BirdsNestImpl) Contains(key Key, rules ...RuleType) (bool, error) + func (b *BirdsNestImpl) Deserialize() error + func (b *BirdsNestImpl) GetHeight() uint64 + func (b *BirdsNestImpl) Info() []uint64 + func (b *BirdsNestImpl) Serialize(index int) error + func (b *BirdsNestImpl) SetHeight(height uint64) + func (b *BirdsNestImpl) Start() + func (b *BirdsNestImpl) ValidateRule(key Key, rules ...RuleType) error + type BirdsNestSerialize struct + Config *BirdsNestConfig + CurrentIndex uint32 + Filters []*CuckooFilterSerialize + Height uint64 + type BlockHeightSerializeIntervalConfig struct + Interval uint64 + type CuckooConfig struct + BitsPerItem uint32 + KeyType KeyType + MaxNumKeys uint32 + TableType uint32 + TagsPerBucket uint32 + type CuckooFilter interface + Add func(key Key) (bool, error) + Contains func(key Key) (bool, error) + Encode func() (FilterEncoder, error) + Extension func() FilterExtension + Info func() []uint64 + IsFull func() bool + func NewCuckooFilter(config *CuckooConfig) CuckooFilter + type CuckooFilterImpl struct + func NewCuckooFilterByDecode(filter *birdsnestpb.CuckooFilter) (*CuckooFilterImpl, error) + func (c *CuckooFilterImpl) Add(key Key) (bool, error) + func (c *CuckooFilterImpl) Config() ([]byte, error) + func (c *CuckooFilterImpl) Contains(key Key) (bool, error) + func (c *CuckooFilterImpl) Encode() (FilterEncoder, error) + func (c *CuckooFilterImpl) Extension() FilterExtension + func (c *CuckooFilterImpl) Info() []uint64 + func (c *CuckooFilterImpl) IsFull() bool + type CuckooFilterSerialize struct + Config []byte + Cuckoo []byte + Extension []byte + type DefaultFilterExtension struct + func NewDefaultFilterExtension() *DefaultFilterExtension + func (d DefaultFilterExtension) Serialize() []byte + func (d DefaultFilterExtension) Store(Key) error + func (d DefaultFilterExtension) Validate(Key, bool) error + type FilterEncoder struct + type FilterExtension interface + Serialize func() []byte + Store func(key Key) error + Validate func(key Key, full bool) error + func DeserializeDefault() FilterExtension + func ExtensionDeserialize(bytes []byte) (FilterExtension, error) + func NewTimestampFilterExtension() FilterExtension + type FilterExtensionType int32 + const FilterExtensionType_FETDefault + const FilterExtensionType_FETTimestamp + type Key interface + GetNano func() int64 + Key func() []byte + Len func() int + Parse func() ([][]byte, error) + String func() string + func GetTimestampKey() Key + func GetTimestampKeyByNano(i int64) Key + func GetTimestampKeys(n int) []Key + type KeyType int32 + const KeyType_KTDefault + const KeyType_KTTimestampKey + type Logger interface + Debugf func(format string, args ...interface{}) + Errorf func(format string, args ...interface{}) + Infof func(format string, args ...interface{}) + Warnf func(format string, args ...interface{}) + type Rule interface + Validate func(Key) error + type RuleType int32 + const RuleType_AbsoluteExpireTime + type RulesConfig struct + AbsoluteExpireTime int64 + type SerializeIntervalType int32 + const SerializeIntervalType_Exit + const SerializeIntervalType_Height + const SerializeIntervalType_Timed + type Serializer interface + Deserialize func() error + Serialize func() error + type Snapshot interface + Read func() ([]byte, error) + Write func(data []byte) error + type SnapshotSerializerConfig struct + BlockHeight *BlockHeightSerializeIntervalConfig + Path string + Timed *TimedSerializeIntervalConfig + Type SerializeIntervalType + type SprintfError string + func NewError(s string, args ...interface{}) SprintfError + func (s SprintfError) Error() string + type Strategy func(bn *BirdsNestImpl) error + type TestLogger struct + T *testing.T + func (t TestLogger) Debugf(format string, args ...interface{}) + func (t TestLogger) Errorf(format string, args ...interface{}) + func (t TestLogger) Infof(format string, args ...interface{}) + func (t TestLogger) Warnf(format string, args ...interface{}) + type TimedSerializeIntervalConfig struct + Interval int64 + type TimestampFilterExtension struct + func DeserializeTimestamp(bytes []byte) (*TimestampFilterExtension, error) + func (t *TimestampFilterExtension) Serialize() []byte + func (t *TimestampFilterExtension) Store(key Key) error + func (t *TimestampFilterExtension) Validate(key Key, full bool) error + type TimestampKey []byte + func ToTimestampKey(txId string) (TimestampKey, error) + func (k TimestampKey) GetNano() int64 + func (k TimestampKey) Key() []byte + func (k TimestampKey) Len() int + func (k TimestampKey) Parse() ([][]byte, error) + func (k TimestampKey) String() string + type WalSnapshot struct + func NewWalSnapshot(path, name string, number int) (*WalSnapshot, error) + func (s *WalSnapshot) Read() ([]byte, error) + func (s *WalSnapshot) Write(data []byte) error