forked from frain-dev/convoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype.go
More file actions
64 lines (49 loc) · 1.02 KB
/
type.go
File metadata and controls
64 lines (49 loc) · 1.02 KB
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
package convoy
import (
"embed"
"strings"
)
type HttpMethod string
type TaskName string
//go:embed VERSION
var f embed.FS
func (t TaskName) SetPrefix(prefix string) TaskName {
var name strings.Builder
delim := "-"
name.WriteString(prefix)
name.WriteString(delim)
name.WriteString(string(t))
return TaskName(name.String())
}
func ReadVersion() ([]byte, error) {
data, err := f.ReadFile("VERSION")
if err != nil {
return nil, err
}
return data, nil
}
func GetVersion() string {
v := "0.1.0"
f, err := ReadVersion()
if err != nil {
return v
}
v = strings.TrimSuffix(string(f), "\n")
return v
}
const (
EventProcessor TaskName = "EventProcessor"
DeadLetterProcessor TaskName = "DeadLetterProcessor"
)
const (
StreamGroup = "taskq"
EventDeliveryIDLength = 12
)
const (
// Maximum number of goroutines fetching messages.
MaxNumFetcher = 100
// Number of messages reserved by a fetcher in the queue in one request.
ReservationSize = 1000
//Size of the internal buffer
BufferSize = 100000
)