forked from karrick/goavro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathocf.go
More file actions
68 lines (55 loc) · 2.15 KB
/
ocf.go
File metadata and controls
68 lines (55 loc) · 2.15 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
65
66
67
68
package goavro
import "math"
// Compression are values used to specify compression algorithm used to compress
// and decompress Avro Object Container File (OCF) streams.
type Compression uint8
const (
// CompressionNull is used when OCF blocks are not compressed.
CompressionNull Compression = iota
// CompressionDeflate is used when OCF blocks are compressed using the
// deflate algorithm.
CompressionDeflate
// CompressionSnappy is used when OCF blocks are compressed using the snappy
// algorithm.
CompressionSnappy
)
const (
// CompressionNullLabel is used when OCF blocks are not compressed.
CompressionNullLabel = "null"
// CompressionDeflateLabel is used when OCF blocks are compressed using the
// deflate algorithm.
CompressionDeflateLabel = "deflate"
// CompressionSnappyLabel is used when OCF blocks are compressed using the
// snappy algorithm.
CompressionSnappyLabel = "snappy"
)
const (
magicString = "Obj\x01"
metadataSchema = `{"type":"map","values":"bytes"}`
syncLength = 16
)
var (
// MaxBlockCount is the maximum number of data items allowed in a single
// binary block that will be decoded from a binary stream. This check is to
// ensure decoding binary data will not cause the library to over allocate
// RAM, potentially creating a denial of service on the system.
//
// If a particular application needs to decode binary Avro data that
// potentially has more data items in a single block, then this variable may
// be modified at your discretion.
MaxBlockCount = int64(math.MaxInt32)
// MaxBlockSize is the maximum number of bytes that will be allocated for a
// single block of data items when decoding from a binary stream. This check
// is to ensure decoding binary data will not cause the library to over
// allocate RAM, potentially creating a denial of service on the system.
//
// If a particular application needs to decode binary Avro data that
// potentially has more bytes in a single block, then this variable may be
// modified at your discretion.
MaxBlockSize = int64(math.MaxInt32)
magicBytes = []byte(magicString)
metadataCodec *Codec
)
func init() {
metadataCodec, _ = NewCodec(metadataSchema)
}