bdb

package
v1.5.49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package bdb provides support for read-only access to an RPM database using the BerkeleyDB "hash" format.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHashPageDuplicate error = unknownPageType(HashPageTypeDuplicate)
	ErrHashPageOffDup    error = unknownPageType(HashPageTypeOffDup)
	ErrHashPageBlob      error = unknownPageType(HashPageTypeBlob)
)

Sentinel errors for unimplemented parts:

Functions

func CheckMagic

func CheckMagic(ctx context.Context, r io.Reader) bool

CheckMagic looks at bit of the provided Reader to see if it looks like a BerkeleyDB file.

According to the libmagic database I looked at:

# Hash 1.85/1.86 databases store metadata in network byte order.
# Btree 1.85/1.86 databases store the metadata in host byte order.
# Hash and Btree 2.X and later databases store the metadata in host byte order.

Since this process can't (and doesn't want to) know the endian-ness of the layer's eventual host, we just look both ways for the one type we support.

Types

type HashPageType added in v1.5.49

type HashPageType byte

HashPageType is the type of an internal hash page.

const (
	HashPageTypeInvalid HashPageType = iota
	HashPageTypeKeyData
	HashPageTypeDuplicate
	HashPageTypeOffpage
	HashPageTypeOffDup
	HashPageTypeBlob
)

Hash Page Types

func (HashPageType) String added in v1.5.49

func (i HashPageType) String() string

type PackageDB

type PackageDB struct {
	// contains filtered or unexported fields
}

PackageDB is the "pkgdb" a.k.a. "Packages", the raw package data.

func (*PackageDB) Headers

func (db *PackageDB) Headers(_ context.Context) iter.Seq2[io.ReaderAt, error]

Headers returns an iterator over all RPM headers in the PackageDB.

func (*PackageDB) Parse

func (db *PackageDB) Parse(r io.ReaderAt) error

Parse closes over the provided io.ReaderAt and readies the provided PackageDB.

type PageType added in v1.5.49

type PageType byte

PageType is the type of a page.

This is always at offset 25 (0x19) of a page.

const (
	PageTypeInvalid PageType = iota // P_INVALID
	// Deprecated: Deprecated in version 3.1.
	PageTypeDuplicate     // P_DUPLICATE
	PageTypeHashUnsorted  // P_HASH_UNSORTED
	PageTypeBtreeInternal // P_IBTREE
	PageTypeRecnoInternal // P_IRECNO
	PageTypeBtreeLeaf     // P_LBTREE
	PageTypeRecnoLeaf     // P_LRECNO
	PageTypeOverflow      // P_OVERFLOW
	PageTypeHashMeta      // P_HASHMETA
	PageTypeBtreeMeta     // P_BTREEMETA
	PageTypeQamMeta       // P_QAMMETA
	PageTypeQamData       // P_QAMDATA
	PageTypeDupLeaf       // P_LDUP
	PageTypeHash          // P_HASH
	PageTypeHeapMeta      // P_HEAPMETA
	PageTypeHeap          // P_HEAP
	PageTypeHeapInternal  // P_IHEAP
)

Page Types

func (PageType) String added in v1.5.49

func (i PageType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL