ndb

package
v1.5.12 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

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(ctx 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 Index

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

Index is an index over an RPM tag.

func (*Index) Lookup

func (i *Index) Lookup(s string) (pg []IndexPair, err error)

Lookup returns the pair (if any) for the provided key.

func (*Index) Parse

func (i *Index) Parse(r io.ReaderAt) error

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

func (*Index) UnmarshalBinary

func (i *Index) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler for an Index header.

type IndexPair

type IndexPair struct {
	Package uint32
	Data    uint32
}

IndexPair is the package index and data offset.

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) AllHeaders

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

AllHeaders returns ReaderAts for all RPM headers in the PackageDB.

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) 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.

type XDB

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

XDB is the "xdb" a.k.a. "Index.db", the ndb mechanism for creating indexes.

func (*XDB) Index

func (db *XDB) Index(tag rpm.Tag) (*Index, error)

Index reports the index for the specifed tag.

func (*XDB) Parse

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

Parse closes over the passed io.ReaderAt and populates the XDB.

func (*XDB) UnmarshalBinary

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

UnmarshalBinary implements encoding.BinaryUnmarshaler for the xdb header.

Jump to

Keyboard shortcuts

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