-
Notifications
You must be signed in to change notification settings - Fork 311
/
gateway.go
41 lines (35 loc) · 927 Bytes
/
gateway.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
package gateway
import (
_ "embed"
"errors"
"regexp"
)
/*
* The gateway module handles incoming requests from client devices.
* It batches web requests and writes to DB in bulk to improve I/O.
* Only after the request payload is persisted, an ACK is sent to
* the client.
*/
const (
delimiter = "<<>>"
eventStreamSourceCategory = "eventStream"
extractEvent = "extract"
rETLEvent = "record"
customVal = "GW"
)
var (
semverRegexp = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`)
batchEvent = []byte(`
{
"batch": [
]
}
`)
)
var (
errRequestDropped = errors.New("request dropped")
errRequestSuppressed = errors.New("request suppressed")
errEventSuppressed = errors.New("event suppressed")
)
//go:embed openapi/index.html
var openApiSpec []byte