etcd/tools/etcd-dump-db/meta.go
Benjamin Wang cb2f7b7a63 Support scan-keys command to scan the key space starting a specific revision
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
2024-09-05 08:46:22 +01:00

41 lines
1.1 KiB
Go

// Copyright 2024 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import "unsafe"
const magic uint32 = 0xED0CDAED
type inBucket struct {
root uint64 // page id of the bucket's root-level page
sequence uint64 // monotonically incrementing, used by NextSequence()
}
type meta struct {
magic uint32
version uint32
pageSize uint32
flags uint32
root inBucket
freelist uint64
pgid uint64
txid uint64
checksum uint64
}
func loadPageMeta(buf []byte) *meta {
return (*meta)(unsafe.Pointer(&buf[pageHeaderSize]))
}