-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.go
47 lines (35 loc) · 821 Bytes
/
index.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
// Copyright 2021 The June Authors. All rights reserved.
// Use of this source code is governed by Apache License
// that can be found in the LICENSE file.
package index
import (
"errors"
"io"
"github.com/reusee/sb"
)
type IndexManager interface {
Name() string
IndexFor(StoreID) (Index, error)
}
type SaveOption interface {
IsSaveOption()
}
func (_ TapEntry) IsSaveOption() {}
type Index interface {
Name() string
Iter(
lower *sb.Tokens, // inclusive in any order
upper *sb.Tokens, // exclusive in any order
order Order,
) (Src, io.Closer, error)
Save(entry Entry, options ...SaveOption) error
Delete(entry Entry) error
}
var ErrInvalidEntry = errors.New("invalid entry")
type Order uint8
const (
Asc Order = iota
Desc
)
func (_ Order) IsSelectOption() {}
func (_ Order) IsIterOption() {}