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