func (o *Options) InsertAltFilter(p filter.Filter) error { if o == nil { return ErrNotSet } if p == nil { return ErrInvalid } o.mu.Lock() o.initFilters() o.filters[p.Name()] = p o.mu.Unlock() return nil }
func (o *Options) SetFilter(p filter.Filter) error { if o == nil { return ErrNotSet } o.mu.Lock() o.Filter = p if p != nil { o.initFilters() o.filters[p.Name()] = p } o.mu.Unlock() return nil }
func (b *filterBlock) contains(filter filter.Filter, offset uint64, key []byte) bool { i := int(offset >> b.baseLg) if i < b.filtersNum { o := b.data[b.oOffset+i*4:] n := int(binary.LittleEndian.Uint32(o)) m := int(binary.LittleEndian.Uint32(o[4:])) if n < m && m <= b.oOffset { return filter.Contains(b.data[n:m], key) } else if n == m { return false } } return true }