checkpointpolicy

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CheckpointVersionBranchV1 = "branch-v1"

CheckpointVersionBranchV1 identifies the branch-backed checkpoint format.

View Source
const PolicyFileName = "policy.json"
View Source
const RefName = plumbing.ReferenceName("refs/entire/policies/checkpoint")

Variables

This section is empty.

Functions

func CanRead

func CanRead(format CheckpointFormat) bool

func CanSatisfyPolicy added in v0.8.0

func CanSatisfyPolicy(policy Policy) bool

func CanWrite

func CanWrite(format CheckpointFormat) bool

func Compare

func Compare(a, b CheckpointFormat) int

func DefaultCheckpointVersion added in v0.8.0

func DefaultCheckpointVersion() string

func Push

func Push(ctx context.Context, target Target) error

func RequiresUpgrade

func RequiresUpgrade(policy Policy) bool

func SetRef

func SetRef(repo *git.Repository, ref plumbing.ReferenceName, hash plumbing.Hash) error

func UnsupportedPolicyMessage added in v0.8.0

func UnsupportedPolicyMessage(policy Policy, updateCommand string) string

func UnsupportedWrite

func UnsupportedWrite(policy Policy) bool

func ValidatePolicy

func ValidatePolicy(policy Policy) error

func WriteLocal

func WriteLocal(ctx context.Context, repo *git.Repository, parent plumbing.Hash, policy Policy) (plumbing.Hash, error)

Types

type CheckpointFamily

type CheckpointFamily string
const (
	CheckpointFamilyBranch CheckpointFamily = "branch"
	CheckpointFamilyRefs   CheckpointFamily = "refs"
)

type CheckpointFormat

type CheckpointFormat struct {
	Family CheckpointFamily
	Major  int
}

func ParseFormat

func ParseFormat(raw string) (CheckpointFormat, error)

func (CheckpointFormat) String

func (f CheckpointFormat) String() string

type Policy

type Policy struct {
	CheckpointVersion    string `json:"checkpoint_version,omitempty"`
	CheckpointMinVersion string `json:"checkpoint_min_version,omitempty"`
}

func DefaultPolicy

func DefaultPolicy() Policy

func Normalize

func Normalize(policy Policy) Policy

type RemoteState

type RemoteState struct {
	Exists bool
	Hash   plumbing.Hash
}

func CheckRemote

func CheckRemote(ctx context.Context, target Target) (RemoteState, error)

type Source

type Source string
const (
	SourceDefaults      Source = "defaults"
	SourceLocal         Source = "local"
	SourceRemote        Source = "remote"
	SourceLocalDiverged Source = "local-diverged"
)

type State

type State struct {
	Policy     Policy
	Source     Source
	Hash       plumbing.Hash
	RemoteHash plumbing.Hash
}

func ReadFromRef

func ReadFromRef(ctx context.Context, repo *git.Repository, refName plumbing.ReferenceName, source Source) (State, error)

func ReadLocal

func ReadLocal(ctx context.Context, repo *git.Repository) (State, error)

func Sync

func Sync(ctx context.Context, repo *git.Repository, target Target) (State, error)

func Update

func Update(ctx context.Context, repo *git.Repository, target Target, opts UpdateOptions) (State, error)

type Target

type Target struct {
	Remote string
	Dir    string
}

func ResolveTarget

func ResolveTarget(ctx context.Context) (Target, error)

type UpdateOptions

type UpdateOptions struct {
	CheckpointVersion       string
	CheckpointVersionSet    bool
	CheckpointMinVersion    string
	CheckpointMinVersionSet bool
	Force                   bool
}

Jump to

Keyboard shortcuts

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