-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.go
49 lines (40 loc) · 1.17 KB
/
interface.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
package topic
import (
"context"
"time"
)
// Store represents topic store.
type Store interface {
Subscribe(topic Type, userIDs ...uint64) error
Unsubscribe(topic Type, userIDs ...uint64) error
ExpireAt(topic Type, expireAt time.Time) error
NewSession(cond Expr) *sessionImpl
SaveLastPushedAt(userIDs []uint64, lastPushDate time.Time) error
GetLastPushedAt(userIDs []uint64) (res []time.Time, err error)
}
var _ Store = (*storeImpl)(nil)
// Pipeline represents set operation.
type Pipeline interface {
Union(dest string, keys ...string)
Inter(dest string, keys ...string)
Diff(dest string, keys ...string)
Source(key string) string
Session() string
}
var _ Pipeline = (*pipelineImpl)(nil)
// Expr represents topic condition.
type Expr interface {
And(targets ...Expr) Expr
Or(targets ...Expr) Expr
Not(targets ...Expr) Expr
Exec(Pipeline) (key string)
}
var _ Expr = (*source)(nil)
var _ Expr = (*condAnd)(nil)
var _ Expr = (*condOr)(nil)
var _ Expr = (*condNot)(nil)
// Session represents scan results operation.
type Session interface {
Scan(ctx context.Context, maxScanCount int64, bulk Bulk) (totalSuccess int64, err error)
}
var _ Session = (*sessionImpl)(nil)