ndb

package
v1.5.48 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ndb provides support for read-only access to an RPM "ndb" database.

The support for ndb's native indexes is probably unneeded, but is implemented for completeness.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMagic

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

CheckMagic reports whether the Reader starts with a magic header for a file format supported by this package.

Types

type PackageDB

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

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

func (*PackageDB) GetHeader

func (db *PackageDB) GetHeader(pkgID uint32) (io.ReaderAt, error)

GetHeader returns an io.ReaderAt populated with [rpm.Header] data or reports an error.

func (*PackageDB) Headers

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

Headers returns an iterator over all the header blobs in the database.

func (*PackageDB) Parse

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

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

func (*PackageDB) UnmarshalBinary

func (h *PackageDB) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler for a PackageDB header.