-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdef.go
72 lines (56 loc) · 1.39 KB
/
def.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
package redis
import (
"log"
"os"
redis "github.com/go-redis/redis/v7"
)
const (
StreamAsteriskID string = "*"
StreamLastDeliveredID string = "$"
StreamZeroID string = "0"
StreamZeroOffset string = "0"
StreamNeverDeliveredOffset string = ">"
StreamUnspecifiedOffset string = ""
Nil = redis.Nil
LOGGER_PREFIX string = "[lib-redis-stream] "
MAX_PENDING_FETCHING_SIZE int64 = 4096
MIN_PENDING_FETCHING_SIZE int64 = 16
PENDING_FETCHING_SIZE_COEFFICIENT int64 = 3
)
var (
defaultLogger *log.Logger = log.New(os.Stdout, LOGGER_PREFIX, log.LstdFlags|log.Lmsgprefix)
)
type (
UniversalOptions = redis.UniversalOptions
UniversalClient = redis.UniversalClient
XMessage = redis.XMessage
XStream = redis.XStream
ProduceMessageOption interface {
applyContent(msg *MessageContent) error
applyID(id string) string
}
StreamOffsetInfo interface {
getStreamOffset() StreamOffset
}
MessageDelegate interface {
OnAck(msg *Message)
OnDel(msg *Message)
}
RedisError interface {
RedisError()
}
DecodeMessageContentOption interface {
apply(*DecodeMessageContentSetting)
}
DecodeMessageContentSetting struct {
MessageStateKeyPrefix string
}
)
// func
type (
ErrorHandleProc func(err error) (disposed bool)
MessageHandleProc func(message *Message)
)
func DefaultLogger() *log.Logger {
return defaultLogger
}