package common
Import Path
go.etcd.io/bbolt/internal/common (on go.dev)
Dependency Relation
imports 10 packages, and imported by 2 packages
Involved Source Files
bolt_amd64.go
bucket.go
inode.go
meta.go
page.go
types.go
unsafe.go
utils.go
Copied from https://github.com/etcd-io/etcd/blob/main/client/pkg/verify/verify.go
Package-Level Type Names (total 11)
InBucket represents the on-file representation of a bucket.
This is stored as the "value" of a bucket key. If the bucket is small enough,
then its root page can be stored inline in the "value", after the bucket
header. In the case of inline buckets, the "root" will be 0.
InSequence returns the sequence. The reason why not naming it `Sequence`
is to avoid duplicated name as `(*Bucket) Sequence()`
(*InBucket) IncSequence()
(*InBucket) InlinePage(v []byte) *Page
(*InBucket) RootPage() Pgid
(*InBucket) SetInSequence(v uint64)
(*InBucket) SetRootPage(id Pgid)
(*InBucket) String() string
*InBucket : expvar.Var
*InBucket : fmt.Stringer
*InBucket : github.com/pancsta/asyncmachine-go/internal/nofmt.Stringer
*InBucket : github.com/pandatix/go-abnf.ElemItf
func LoadBucket(buf []byte) *InBucket
func NewInBucket(root Pgid, seq uint64) InBucket
func (*Meta).RootBucket() *InBucket
func (*Meta).SetRootBucket(b InBucket)
Inode represents an internal node inside of a node.
It can be used to point to elements in a page or point
to an element which hasn't been added to a page yet.
(*Inode) Flags() uint32
(*Inode) Key() []byte
(*Inode) Pgid() Pgid
(*Inode) SetFlags(flags uint32)
(*Inode) SetKey(key []byte)
(*Inode) SetPgid(id Pgid)
(*Inode) SetValue(value []byte)
(*Inode) Value() []byte
func ReadInodeFromPage(p *Page) Inodes
func UsedSpaceInPage(inodes Inodes, p *Page) uint32
func WriteInodeToPage(inodes Inodes, p *Page) uint32
(*Meta) Checksum() uint64
Copy copies one meta object to another.
(*Meta) DecTxid()
(*Meta) Flags() uint32
(*Meta) Freelist() Pgid
(*Meta) IncTxid()
(*Meta) IsFreelistPersisted() bool
(*Meta) Magic() uint32
(*Meta) PageSize() uint32
(*Meta) Pgid() Pgid
(*Meta) Print(w io.Writer)
(*Meta) RootBucket() *InBucket
(*Meta) SetChecksum(v uint64)
(*Meta) SetFlags(v uint32)
(*Meta) SetFreelist(v Pgid)
(*Meta) SetMagic(v uint32)
(*Meta) SetPageSize(v uint32)
(*Meta) SetPgid(id Pgid)
(*Meta) SetRootBucket(b InBucket)
(*Meta) SetTxid(id Txid)
(*Meta) SetVersion(v uint32)
Sum64 generates the checksum for the meta.
(*Meta) Txid() Txid
Validate checks the marker bytes and version of the meta page to ensure it matches this binary.
(*Meta) Version() uint32
Write writes the meta onto a page.
func LoadPageMeta(buf []byte) *Meta
func (*Page).Meta() *Meta
func (*Meta).Copy(dest *Meta)
BranchPageElement retrieves the branch node by index
BranchPageElements retrieves a list of branch nodes.
(*Page) Count() uint16
(*Page) FastCheck(id Pgid)
(*Page) Flags() uint16
(*Page) FreelistPageCount() (int, int)
(*Page) FreelistPageIds() []Pgid
(*Page) Id() Pgid
(*Page) IsBranchPage() bool
(*Page) IsFreelistPage() bool
(*Page) IsLeafPage() bool
(*Page) IsMetaPage() bool
IsValidPage checks Page flags correctness, only a single proper flag can be used.
LeafPageElement retrieves the leaf node by index
LeafPageElements retrieves a list of leaf nodes.
Meta returns a pointer to the metadata section of the page.
(*Page) Overflow() uint32
(*Page) PageElementSize() uintptr
(*Page) SetCount(target uint16)
(*Page) SetFlags(v uint16)
(*Page) SetId(target Pgid)
(*Page) SetOverflow(target uint32)
(*Page) String() string
Typ returns a human-readable page type string used for debugging.
*Page : expvar.Var
*Page : fmt.Stringer
*Page : github.com/pancsta/asyncmachine-go/internal/nofmt.Stringer
*Page : github.com/pandatix/go-abnf.ElemItf
func LoadPage(buf []byte) *Page
func NewPage(id Pgid, flags, count uint16, overflow uint32) *Page
func (*InBucket).InlinePage(v []byte) *Page
func ReadInodeFromPage(p *Page) Inodes
func UsedSpaceInPage(inodes Inodes, p *Page) uint32
func WriteInodeToPage(inodes Inodes, p *Page) uint32
func (*Meta).Write(p *Page)
func go.etcd.io/bbolt/internal/freelist.Interface.Free(txId Txid, p *Page)
func go.etcd.io/bbolt/internal/freelist.Interface.Read(page *Page)
func go.etcd.io/bbolt/internal/freelist.Interface.Reload(p *Page)
func go.etcd.io/bbolt/internal/freelist.Interface.Write(page *Page)
func go.etcd.io/bbolt/internal/freelist.ReadWriter.Read(page *Page)
func go.etcd.io/bbolt/internal/freelist.ReadWriter.Write(page *Page)
PageInfo represents human readable information about a page.
Count int
ID int
OverflowCount int
Type string
func go.etcd.io/bbolt.(*Tx).Page(id int) (*PageInfo, error)
func (*InBucket).RootPage() Pgid
func (*Inode).Pgid() Pgid
func (*Meta).Freelist() Pgid
func (*Meta).Pgid() Pgid
func (*Page).FreelistPageIds() []Pgid
func (*Page).Id() Pgid
func go.etcd.io/bbolt/internal/freelist.Interface.Allocate(txid Txid, numPages int) Pgid
func go.etcd.io/bbolt.(*Bucket).Root() Pgid
func NewInBucket(root Pgid, seq uint64) InBucket
func NewPage(id Pgid, flags, count uint16, overflow uint32) *Page
func (*InBucket).SetRootPage(id Pgid)
func (*Inode).SetPgid(id Pgid)
func (*Meta).SetFreelist(v Pgid)
func (*Meta).SetPgid(id Pgid)
func (*Page).FastCheck(id Pgid)
func (*Page).SetId(target Pgid)
func go.etcd.io/bbolt/internal/freelist.Interface.Copyall(dst []Pgid)
func go.etcd.io/bbolt/internal/freelist.Interface.Freed(pgId Pgid) bool
const PgidNoFreelist
( Pgids) Len() int
( Pgids) Less(i, j int) bool
Merge returns the sorted union of a and b.
( Pgids) Swap(i, j int)
Pgids : sort.Interface
func Pgids.Merge(b Pgids) Pgids
func Mergepgids(dst, a, b Pgids)
func Pgids.Merge(b Pgids) Pgids
func go.etcd.io/bbolt/internal/freelist.Interface.Init(ids Pgids)
func go.etcd.io/bbolt/internal/freelist.Interface.NoSyncReload(pgIds Pgids)
Txid represents the internal transaction identifier.
func (*Meta).Txid() Txid
func (*Meta).SetTxid(id Txid)
func go.etcd.io/bbolt/internal/freelist.Interface.AddReadonlyTXID(txid Txid)
func go.etcd.io/bbolt/internal/freelist.Interface.Allocate(txid Txid, numPages int) Pgid
func go.etcd.io/bbolt/internal/freelist.Interface.Free(txId Txid, p *Page)
func go.etcd.io/bbolt/internal/freelist.Interface.RemoveReadonlyTXID(txid Txid)
func go.etcd.io/bbolt/internal/freelist.Interface.Rollback(txId Txid)
func EnableVerifications(verification VerificationType) func()
func IsVerificationEnabled(verification VerificationType) bool
const ENV_VERIFY_VALUE_ALL
const ENV_VERIFY_VALUE_ASSERT
Package-Level Functions (total 20)
Assert will panic with a given formatted message if the given condition is false.
DisableVerifications unsets `ENV_VERIFY` and returns a function that
can be used to bring the original settings.
EnableAllVerifications enables verification and returns a function
that can be used to bring the original settings.
EnableVerifications sets `ENV_VERIFY` and returns a function that
can be used to bring the original settings.
func IsVerificationEnabled(verification VerificationType) bool func LoadBucket(buf []byte) *InBucket func LoadPageMeta(buf []byte) *Meta
Mergepgids copies the sorted union of a and b into dst.
If dst is too small, it panics.
func NewInBucket(root Pgid, seq uint64) InBucket func NewLeafPageElement(flags, pos, ksize, vsize uint32) *leafPageElement func ReadInodeFromPage(p *Page) Inodes func UsedSpaceInPage(inodes Inodes, p *Page) uint32
Verify performs verification if the assertions are enabled.
In the default setup running in tests and skipped in the production code.
func WriteInodeToPage(inodes Inodes, p *Page) uint32
Package-Level Variables (only one)
DefaultPageSize is the default page size for db which is set to the OS page size.
Package-Level Constants (total 23)
const BranchPageElementSize uintptr = 16 const BranchPageFlag = 1 const BucketHeaderSize int = 16 const BucketLeafFlag = 1
Default values if not set in a DB instance.
Default values if not set in a DB instance.
Default values if not set in a DB instance.
const ENV_VERIFY = "BBOLT_VERIFY" const ENV_VERIFY_VALUE_ALL VerificationType = "all" const ENV_VERIFY_VALUE_ASSERT VerificationType = "assert" const FreelistPageFlag = 16
IgnoreNoSync specifies whether the NoSync field of a DB is ignored when
syncing changes to a file. This is required as some operating systems,
such as OpenBSD, do not have a unified buffer cache (UBC) and writes
must be synchronized using the msync(2) syscall.
const LeafPageElementSize uintptr = 16 const LeafPageFlag = 2
Magic represents a marker value to indicate that a file is a Bolt DB.
MaxAllocSize is the size used when creating array pointers.
MaxMapSize represents the largest mmap size supported by Bolt.
MaxMmapStep is the largest step that can be taken when remapping the mmap.
const MetaPageFlag = 4 const MinKeysPerPage = 2 const PageHeaderSize uintptr = 16 const PgidNoFreelist Pgid = 18446744073709551615
Version represents the data file format version.
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |