-
Notifications
You must be signed in to change notification settings - Fork 5
/
types.go
74 lines (60 loc) · 1.4 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package rdb
import "time"
type iterator interface {
Next() (interface{}, error)
}
type collectionHead struct {
DataKey DataKey
Length int
}
type collectionEntry struct {
DataKey DataKey
Index int
Length int
Value interface{}
}
type collectionSlice struct {
DataKey DataKey
Value []interface{}
}
type collectionMapper interface {
MapHead(*collectionHead) (interface{}, error)
MapEntry(*collectionEntry) (interface{}, error)
MapSlice(*collectionSlice) (interface{}, error)
}
type Aux struct {
Key string
Value string
}
type DatabaseSize struct {
Size int
Expire int
}
// DataKey contains the database, the key and the expiry of data.
type DataKey struct {
Database int
Key string
Expiry *time.Time
}
// Expired returns true if the key is expired.
func (d DataKey) Expired() bool {
if d.Expiry == nil {
return false
}
return time.Now().After(*d.Expiry)
}
// StringData contains the key and the value of string data.
type StringData struct {
DataKey
Value string
}
// BloomFilter represents a bloom filter data structure implemented by RedisBloom.
// At present, It only contains data key, but does not store the actual data values.
type BloomFilter struct {
DataKey
}
// CuckooFilter represents a cuckoo filter data structure implemented by RedisBloom.
// At present, It only contains data key, but does not store the actual data values.
type CuckooFilter struct {
DataKey
}