forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fastlookup_state.go
44 lines (35 loc) · 909 Bytes
/
fastlookup_state.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
package gregor
type FastLookupState struct {
State
table map[string]Item
}
func NewFastLookupState(state State, table map[string]Item) FastLookupState {
return FastLookupState{
State: state,
table: table,
}
}
func (fs FastLookupState) GetItem(msgID MsgID) (Item, bool) {
if item, ok := fs.table[msgID.String()]; ok {
return item, true
}
return nil, false
}
func (fs FastLookupState) Export() (ProtocolState, error) {
return fs.State.Export()
}
func (fs FastLookupState) Items() (Item, bool) {
return fs.Items()
}
func (fs FastLookupState) ItemsInCategory(c Category) ([]Item, error) {
return fs.ItemsInCategory(c)
}
func (fs FastLookupState) ItemsWithCategoryPrefix(c Category) ([]Item, error) {
return fs.ItemsWithCategoryPrefix(c)
}
func (fs FastLookupState) Marshal() ([]byte, error) {
return fs.Marshal()
}
func (fs FastLookupState) Hash() ([]byte, error) {
return fs.Hash()
}