fsck

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	ReadCheckpoint(ctx context.Context) ([]byte, error)
	ReadTile(ctx context.Context, l, i uint64, p uint8) ([]byte, error)
	ReadEntryBundle(ctx context.Context, i uint64, p uint8) ([]byte, error)
}

Fetcher describes a struct which knows how to retrieve tlog-tiles artifacts from a log.

type Fsck

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

Fsck knows how to check the integrity of tlog-tile logs.

func New

func New(origin string, verifier note.Verifier, f Fetcher, bundleHasher func([]byte) ([][]byte, error), opts Opts) *Fsck

New creates a new Fsck instance configured for a particular log.

The log resources will be retrieved via the provided fetcher, using the provided bundleHasher to parse and convert entries from the log's entry bundles into leaf hashes.

The leaf hashes are used to: 1. re-construct the root hash of the log, and compare it against the value in the log's checkpoint 2. re-construct the internal tiles of the log, and compare them against the log's tile resources.

The checking will use the provided N parameter to control the number of concurrent workers undertaking this process.

func (*Fsck) Check

func (f *Fsck) Check(ctx context.Context) error

Check performs an integrity check against the log.

Check may only be called once per instance of Fsck.

func (*Fsck) Status

func (f *Fsck) Status() Status

Status returns a struct representing the current status of the fsck operation.

type Opts

type Opts struct {
	N uint
}

type Range

type Range struct {
	// First is the index of the first resource covered by this range.
	First uint64
	// N is the number of resources covered by this range.
	N uint64
	// State is the state all resources covered by this range have.
	State State
}

Range describes the common state of a range of bundles/tiles. The range covers [First, First+N) in tile-space, and all resources in the range share the same State.

func (*Range) String

func (r *Range) String() string

String returns a simple human readable representation of the range.

type State

type State uint8

State represents the state of a given static resource.

const (
	// Unchecked represents the state of resources which hasn't yet been checked.
	Unchecked State = iota
	// Fetching is the state of a resource being retrieved from the target log.
	Fetching
	// FetchError is the state of a failed fetch.
	FetchError
	// Fetched represents a resource which has been fetched, but not yet processed.
	Fetched
	// Calculating represents a resource being used to calculate hashes.
	Calculating
	// OK represents a resource which was successfully verified.
	OK
	// Invalid represents a resource which was determined to be incorrect or invalid somehow.
	Invalid
)

func (State) String

func (s State) String() string

String returns a string representation of the state.

type Status

type Status struct {
	// EntryRanges describes the status of the entrybundles in the target log.
	EntryRanges []Range
	// TileRanges describes the status of the tiles in the target log.
	// The zeroth entry in the slice represents the lower-most tile level, just above the entry bundles.
	TileRanges [][]Range

	// BytesFetched is the total number of bytes fetched from the target log since the last time Status() was called.
	BytesFetched uint64
	// ResourcesFetched is the total number of resources fetched from the target log since the last time Status() was called.
	ResourcesFetched uint64
	// ErrorsEncountered is the total number of errors encountered since the last time Status() was called.
	ErrorsEncountered uint64
}

Status represents the current status of an ongoing fsck check.

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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