aboutsummaryrefslogtreecommitdiff
path: root/meta.go
blob: 881417aaf1813a9e0347d38f943f642a88614bf7 (plain) (blame)
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
package bolt

var (
	InvalidMetaPageError = &Error{"Invalid meta page", nil}
)

const magic uint32 = 0xC0DEC0DE
const version uint32 = 1

type meta struct {
	magic    uint32
	version  uint32
	buckets  bucket
	pageSize uint32
	pgid     pgid
	txnid    txnid
}

// validate checks the marker bytes and version of the meta page to ensure it matches this binary.
func (m *meta) validate() error {
	if m.magic != magic {
		return InvalidError
	} else if m.version != Version {
		return VersionMismatchError
	}
	return nil
}