forked from influxdata/influxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
60 lines (49 loc) · 2.45 KB
/
common.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
package binary
//go:generate protoc -I$GOPATH/src/github.com/influxdata/influxdb/vendor -I. --gogofaster_out=Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types:. binary.proto
//go:generate stringer -type=MessageType
import "errors"
var (
ErrWriteAfterClose = errors.New("format/binary: write after close")
ErrWriteBucketAfterClose = errors.New("format/binary: write to closed bucket")
)
var (
Magic = [...]byte{0x49, 0x46, 0x4c, 0x58, 0x44, 0x55, 0x4d, 0x50} // IFLXDUMP
)
type MessageType byte
const (
HeaderType MessageType = iota + 1
BucketHeaderType
BucketFooterType
SeriesHeaderType
FloatPointsType
IntegerPointsType
UnsignedPointsType
BooleanPointsType
StringPointsType
SeriesFooterType
)
type message interface {
Size() int
MarshalTo(dAtA []byte) (int, error)
}
/*
Stream format
FILE:
┌─────────────────┬────────────────────┬─────────────────┐
│ │ │ │
│ IFLXDUMP (8) │ Header │ BUCKET 0..n │
│ │ │ │
└─────────────────┴────────────────────┴─────────────────┘
BUCKET:
┌─────────────────┬────────────────────┬─────────────────┐
│ │ │ │
│ Bucket Header │ SERIES DATA 0..n │ Bucket Footer │
│ │ │ │
└─────────────────┴────────────────────┴─────────────────┘
SERIES DATA:
┌─────────────────┬────────────────────┬─────────────────┐
│ │ │ │
│ Series Header │ POINTS 0..n │ Series Footer │
│ │ │ │
└─────────────────┴────────────────────┴─────────────────┘
*/