Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CopyOnWriteIndexer ¶
type CopyOnWriteIndexer struct {
// contains filtered or unexported fields
}
CopyOnWriteIndexer allows user to update the index. Internally it uses a loader to periodically reload index by applying the ADD/DEL/UPD operations.
func NewCopyOnWriteIndexer ¶
func NewCopyOnWriteIndexer(items []*expr.Conjunction, refreshInterval int) (*CopyOnWriteIndexer, error)
NewCopyOnWriteIndexer creats a new CopyOnWriteIndexer with given items. It internally uses a loader to periodically reload index.
func (*CopyOnWriteIndexer) Add ¶
func (u *CopyOnWriteIndexer) Add(c *expr.Conjunction) error
Add adds a new conjunction into index, this operation will be first buffered in a queue and be applied in a batcch way once the ticker is triggered. So the new item won't be updated immediately but with a lag.
func (*CopyOnWriteIndexer) Delete ¶
func (u *CopyOnWriteIndexer) Delete(ID int) error
Delete deletes a conjunction by ID.
func (*CopyOnWriteIndexer) Get ¶
func (u *CopyOnWriteIndexer) Get(conjunctionSize int, labels expr.Assignment) []*Record
Get gets the matched records.
func (*CopyOnWriteIndexer) MaxKSize ¶
func (u *CopyOnWriteIndexer) MaxKSize() int
type Indexer ¶
type Indexer interface { MaxKSize() int Get(conjunctionSize int, labels expr.Assignment) []*Record }
Indexer defines the top level indexer interface
type MemReadOnlyIndexer ¶
type MemReadOnlyIndexer struct {
// contains filtered or unexported fields
}
MemReadOnlyIndexer implements the Indexer interface and stores all the entries in memory.
func NewMemReadOnlyIndexer ¶
func NewMemReadOnlyIndexer(items []*expr.Conjunction) (*MemReadOnlyIndexer, error)
NewMemReadOnlyIndexer create a memory stored indexer. This kind of indexer is thread-safe.
func (*MemReadOnlyIndexer) Build ¶
func (k *MemReadOnlyIndexer) Build() error
Build finalise the build-up of indexer by calling the Build on each shards.
func (*MemReadOnlyIndexer) Get ¶
func (k *MemReadOnlyIndexer) Get(size int, labels expr.Assignment) []*Record
Get returns the list of Record, based on size and labels.
func (*MemReadOnlyIndexer) MaxKSize ¶
func (k *MemReadOnlyIndexer) MaxKSize() int
MaxKSize returns the max K-size of the conjunctions stored in indexer.
type MutableIndexer ¶
type MutableIndexer interface { MaxKSize() int Add(c *expr.Conjunction) error Delete(ID int) error Get(conjunctionSize int, labels expr.Assignment) []*Record }
MutableIndexer top level interface