read

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package read provides routines for reading commit graphs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BloomUnavailableError added in v0.1.68

type BloomUnavailableError struct {
	Pos Position
}

BloomUnavailableError reports missing changed-path bloom data at one position.

func (*BloomUnavailableError) Error added in v0.1.68

func (err *BloomUnavailableError) Error() string

Error implements error.

type Commit

type Commit struct {
	OID            objectid.ObjectID
	TreeOID        objectid.ObjectID
	Parent1        ParentRef
	Parent2        ParentRef
	ExtraParents   []Position
	CommitTimeUnix int64
	GenerationV1   uint32
	GenerationV2   uint64
}

Commit stores decoded commit-graph record data.

type LayerInfo

type LayerInfo struct {
	Path      string
	BaseCount uint32
	Commits   uint32
}

LayerInfo describes one loaded commit-graph layer.

type MalformedError added in v0.1.68

type MalformedError struct {
	Path   string
	Reason string
}

MalformedError reports malformed commit-graph data.

func (*MalformedError) Error added in v0.1.68

func (err *MalformedError) Error() string

Error implements error.

type NotFoundError added in v0.1.68

type NotFoundError struct {
	OID objectid.ObjectID
}

NotFoundError reports a missing commit graph entry by object ID.

func (*NotFoundError) Error added in v0.1.68

func (err *NotFoundError) Error() string

Error implements error.

type OpenMode

type OpenMode uint8

OpenMode controls which commit-graph layout Open loads.

const (
	// OpenSingle opens one commit-graph file at info/commit-graph.
	OpenSingle OpenMode = iota
	// OpenChain opens chained commit-graphs from info/commit-graphs.
	OpenChain
)

type ParentRef

type ParentRef struct {
	Valid bool
	Pos   Position
}

ParentRef references one parent position.

type Position

type Position struct {
	Graph uint32
	Index uint32
}

Position identifies one commit record by layer and row index.

type PositionOutOfRangeError added in v0.1.68

type PositionOutOfRangeError struct {
	Pos Position
}

PositionOutOfRangeError reports an invalid graph position.

func (*PositionOutOfRangeError) Error added in v0.1.68

func (err *PositionOutOfRangeError) Error() string

Error implements error.

type Reader

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

Reader provides read-only access to one mmap-backed commit-graph snapshot.

It is safe for concurrent read-only queries.

func Open

func Open(root *os.Root, algo objectid.Algorithm, mode OpenMode) (*Reader, error)

Open opens commit-graph data from one objects root.

func (*Reader) AllOIDs

func (reader *Reader) AllOIDs() iter.Seq[objectid.ObjectID]

AllOIDs iterates all commit object IDs in native layer order.

func (*Reader) AllPositions

func (reader *Reader) AllPositions() iter.Seq[Position]

AllPositions iterates all commit positions in native layer order.

func (*Reader) BloomFilterAt

func (reader *Reader) BloomFilterAt(pos Position) (*bloom.Filter, error)

BloomFilterAt returns one commit's changed-path Bloom filter.

Returns BloomUnavailableError when this commit graph has no Bloom data.

func (*Reader) BloomVersion

func (reader *Reader) BloomVersion() uint8

BloomVersion returns the changed-path Bloom hash version, or 0 if absent.

func (*Reader) Close

func (reader *Reader) Close() error

Close releases all mapped commit-graph files.

func (*Reader) CommitAt

func (reader *Reader) CommitAt(pos Position) (Commit, error)

CommitAt returns decoded commit-graph metadata at one position.

func (*Reader) HasBloom

func (reader *Reader) HasBloom() bool

HasBloom reports whether any layer has changed-path Bloom data.

func (*Reader) HashVersion

func (reader *Reader) HashVersion() uint8

HashVersion returns the commit-graph hash version.

func (*Reader) Layers

func (reader *Reader) Layers() []LayerInfo

Layers returns loaded layer metadata in native chain order.

func (*Reader) Lookup

func (reader *Reader) Lookup(oid objectid.ObjectID) (Position, error)

Lookup resolves one object ID to one graph position.

func (*Reader) NumCommits

func (reader *Reader) NumCommits() uint32

NumCommits returns total commits across loaded layers.

func (*Reader) OIDAt

func (reader *Reader) OIDAt(pos Position) (objectid.ObjectID, error)

OIDAt returns object ID at one position.

type UnsupportedVersionError added in v0.1.68

type UnsupportedVersionError struct {
	Version uint8
}

UnsupportedVersionError reports unsupported commit-graph version.

func (*UnsupportedVersionError) Error added in v0.1.68

func (err *UnsupportedVersionError) Error() string

Error implements error.

Jump to

Keyboard shortcuts

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