-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
36 lines (31 loc) · 982 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package index
import (
"github.com/deepfabric/thinkkv/pkg/engine"
"github.com/deepfabric/vectorsql/pkg/storage/cache"
"github.com/deepfabric/vectorsql/pkg/storage/metadata"
"github.com/deepfabric/vectorsql/pkg/vm/value"
"github.com/pilosa/pilosa/roaring"
)
const (
Ffrac = 1000 // float fraction
Dfrac = 100000 // double fraction
)
type Index interface {
AddTuples([]interface{}) error
Eq(string, value.Value) (*roaring.Bitmap, error)
Ne(string, value.Value) (*roaring.Bitmap, error)
Lt(string, value.Value) (*roaring.Bitmap, error)
Le(string, value.Value) (*roaring.Bitmap, error)
Gt(string, value.Value) (*roaring.Bitmap, error)
Ge(string, value.Value) (*roaring.Bitmap, error)
}
// id.attr's name.v -> bitmap -- string
// id.attr's name.I -> bitmap -- bsi, bitmap
// id.attr's name.U -> bitmap -- ubsi bitmap
type index struct {
isE bool
id string // uid.database.table
db engine.DB
lc cache.Cache
attrs []metadata.Attribute
}