doctor

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doctor

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

func NewDoctor

func NewDoctor(db objects.Store, rs ref.Store, user conf.User, logger logr.Logger) *Doctor

func (*Doctor) Diagnose

func (d *Doctor) Diagnose(ctx context.Context, refPrefixes, refNonPrefixes, skips []string) (issues chan *RefIssues, errCh chan error, err error)

func (*Doctor) Resolve

func (d *Doctor) Resolve(issues []*Issue) (err error)

type Issue

type Issue struct {
	// Name of wrgl reference
	Ref string `json:"ref,omitempty"`

	// Number of descendant commits
	DescendantCount int `json:"descendantCount,omitempty"`

	// Number of ancestor commits
	AncestorCount int `json:"ancestorCount,omitempty"`

	// Previous commit sum (in case commit sum is not available)
	PreviousCommit []byte `json:"previousCommit,omitempty"`

	// Commit sum
	Commit []byte `json:"commit,omitempty"`

	// Table sum if any
	Table []byte `json:"table,omitempty"`

	// Block sum if any
	Block []byte `json:"block,omitempty"`

	// Block index sum if any
	BlockIndex []byte `json:"blockIndex,omitempty"`

	// Error encountered
	Err string `json:"err,omitempty"`

	// How to resolve the issue
	Resolution Resolution `json:"resolution,omitempty"`
}

type RefIssues

type RefIssues struct {
	Ref    string
	Issues []*Issue
}

type Resolution

type Resolution string
const (
	UnknownResolution  Resolution = "unknown"
	ResetPKResolution  Resolution = "resetPK"
	ReingestResolution Resolution = "reingest"
	RemoveResolution   Resolution = "remove"
)

type Tree

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

Tree traverses the entire commit tree to edit and modify individual commits. Traversal happens in 2 phases: 1. Go up from the head commit to the oldest ancestor commit. During this phase, each commit could be diagnosed and a resolution determined. 2. Go down from te oldest ancestor back up to the head. During this phase, each commit is modified, and their parent refs updated.

func NewTree

func NewTree(db objects.Store) (t *Tree)

func (*Tree) Down

func (t *Tree) Down() (*objects.Commit, error)

func (*Tree) EditCommit

func (t *Tree) EditCommit(commit []byte, edit func(com *objects.Commit) (remove, update bool, err error)) error

EditCommit traverse from the current commit to its descendant commits.

func (*Tree) Head

func (t *Tree) Head() (*objects.Commit, error)

Head gets the bottom (head) commit. It returns io.EOF if there are no commit yet

func (*Tree) Position

func (t *Tree) Position(commitSum []byte) (ancestors, descendants int, err error)

Position returns ancestors and children count of a commit

func (*Tree) Reset

func (t *Tree) Reset(headSum []byte) (err error)

Reset repurposes Tree states to traverse a new commit tree

func (*Tree) Up

func (t *Tree) Up() (*objects.Commit, error)

Up returns a parent commit if possible. It returns io.EOF when there are no more ancestor

func (*Tree) UpdateAllDescendants

func (t *Tree) UpdateAllDescendants() ([]byte, error)

Jump to

Keyboard shortcuts

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