Documentation
¶
Index ¶
- Variables
- func EstimateFalsePositiveRate(m, k, n uint) float64
- func NewBloomBlock() block.Block
- type BloomFilter
- func (b *BloomFilter) BlockAliasIdentity() *block.AliasIdentityToken
- func (b *BloomFilter) Clone() *BloomFilter
- func (m *BloomFilter) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *BloomFilter) CloneVT() *BloomFilter
- func (this *BloomFilter) EqualMessageVT(thatMsg any) bool
- func (this *BloomFilter) EqualVT(that *BloomFilter) bool
- func (x *BloomFilter) GetBitSet() *bitset.BitSet
- func (x *BloomFilter) GetK() uint32
- func (x *BloomFilter) GetM() uint32
- func (b *BloomFilter) IsEmpty() bool
- func (b *BloomFilter) IsNil() bool
- func (b *BloomFilter) MarshalBlock() ([]byte, error)
- func (x *BloomFilter) MarshalJSON() ([]byte, error)
- func (x *BloomFilter) MarshalProtoJSON(s *json.MarshalState)
- func (x *BloomFilter) MarshalProtoText() string
- func (m *BloomFilter) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *BloomFilter) MarshalToVT(dAtA []byte) (int, error)
- func (m *BloomFilter) MarshalVT() (dAtA []byte, err error)
- func (*BloomFilter) ProtoMessage()
- func (x *BloomFilter) Reset()
- func (m *BloomFilter) SizeVT() (n int)
- func (x *BloomFilter) String() string
- func (b *BloomFilter) ToBloomFilter() *Filter
- func (b *BloomFilter) UnmarshalBlock(data []byte) error
- func (x *BloomFilter) UnmarshalJSON(b []byte) error
- func (x *BloomFilter) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *BloomFilter) UnmarshalVT(dAtA []byte) error
- type Filter
- func (f *Filter) Add(key []byte)
- func (f *Filter) AddString(key string)
- func (f *Filter) Cap() uint
- func (f *Filter) Copy() *Filter
- func (f *Filter) K() uint
- func (f *Filter) Merge(other *Filter) error
- func (f *Filter) Test(key []byte) bool
- func (f *Filter) TestString(key string) bool
- func (f *Filter) Words() []uint64
Constants ¶
This section is empty.
Variables ¶
var ErrIncompatibleBloom = errors.New("incompatible bloom filters")
Functions ¶
func EstimateFalsePositiveRate ¶ added in v0.51.0
EstimateFalsePositiveRate estimates the false-positive rate for the filter shape.
Types ¶
type BloomFilter ¶
type BloomFilter struct {
// K is the number of hash functions.
// Max: 10.
// Min: 1.
K uint32 `protobuf:"varint,1,opt,name=k,proto3" json:"k,omitempty"`
// M is the length (capacity) of the bloom filter.
M uint32 `protobuf:"varint,2,opt,name=m,proto3" json:"m,omitempty"`
// BitSet is the underlying bitset.
BitSet *bitset.BitSet `protobuf:"bytes,3,opt,name=bit_set,json=bitSet,proto3" json:"bitSet,omitempty"`
// contains filtered or unexported fields
}
BloomFilter contains a bloom filter in a Block. uses FNV64 hash function m factor is determined by len(bit_set)*64
func NewBloom ¶
func NewBloom(bl *Filter) *BloomFilter
NewBloom constructs a new bloom object from an existing bloom. if input is nil, returns nil
func (*BloomFilter) BlockAliasIdentity ¶ added in v0.52.0
func (b *BloomFilter) BlockAliasIdentity() *block.AliasIdentityToken
BlockAliasIdentity returns the in-memory alias token for BloomFilter.
func (*BloomFilter) Clone ¶
func (b *BloomFilter) Clone() *BloomFilter
Clone clones the bloom filter block.
func (*BloomFilter) CloneMessageVT ¶
func (m *BloomFilter) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*BloomFilter) CloneVT ¶
func (m *BloomFilter) CloneVT() *BloomFilter
func (*BloomFilter) EqualMessageVT ¶
func (this *BloomFilter) EqualMessageVT(thatMsg any) bool
func (*BloomFilter) EqualVT ¶
func (this *BloomFilter) EqualVT(that *BloomFilter) bool
func (*BloomFilter) GetBitSet ¶
func (x *BloomFilter) GetBitSet() *bitset.BitSet
func (*BloomFilter) GetK ¶
func (x *BloomFilter) GetK() uint32
func (*BloomFilter) GetM ¶
func (x *BloomFilter) GetM() uint32
func (*BloomFilter) IsEmpty ¶
func (b *BloomFilter) IsEmpty() bool
IsEmpty checks if the bloom filter is empty.
func (*BloomFilter) MarshalBlock ¶
func (b *BloomFilter) MarshalBlock() ([]byte, error)
MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.
func (*BloomFilter) MarshalJSON ¶
func (x *BloomFilter) MarshalJSON() ([]byte, error)
MarshalJSON marshals the BloomFilter to JSON.
func (*BloomFilter) MarshalProtoJSON ¶
func (x *BloomFilter) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the BloomFilter message to JSON.
func (*BloomFilter) MarshalProtoText ¶
func (x *BloomFilter) MarshalProtoText() string
func (*BloomFilter) MarshalToSizedBufferVT ¶
func (m *BloomFilter) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*BloomFilter) MarshalToVT ¶
func (m *BloomFilter) MarshalToVT(dAtA []byte) (int, error)
func (*BloomFilter) MarshalVT ¶
func (m *BloomFilter) MarshalVT() (dAtA []byte, err error)
func (*BloomFilter) ProtoMessage ¶
func (*BloomFilter) ProtoMessage()
func (*BloomFilter) Reset ¶
func (x *BloomFilter) Reset()
func (*BloomFilter) SizeVT ¶
func (m *BloomFilter) SizeVT() (n int)
func (*BloomFilter) String ¶
func (x *BloomFilter) String() string
func (*BloomFilter) ToBloomFilter ¶
func (b *BloomFilter) ToBloomFilter() *Filter
ToBloomFilter converts the bloom block into a BloomFilter. Returns nil if empty.
func (*BloomFilter) UnmarshalBlock ¶
func (b *BloomFilter) UnmarshalBlock(data []byte) error
UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.
func (*BloomFilter) UnmarshalJSON ¶
func (x *BloomFilter) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the BloomFilter from JSON.
func (*BloomFilter) UnmarshalProtoJSON ¶
func (x *BloomFilter) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the BloomFilter message from JSON.
func (*BloomFilter) UnmarshalVT ¶
func (m *BloomFilter) UnmarshalVT(dAtA []byte) error
type Filter ¶ added in v0.51.0
type Filter struct {
// contains filtered or unexported fields
}
Filter is the runtime bloom filter used by block metadata.
func NewFilter ¶ added in v0.51.0
NewFilter creates a bloom filter sized for n entries and p false-positive rate.
func (*Filter) TestString ¶ added in v0.51.0
TestString checks if a key string may be present.