schema

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitCodeSuccess        int = 0
	ExitCodePartialFailure int = 1 // ErrExitPartialFailure
	ExitCodeBadInvocation  int = 2 // ErrExitBadInvocation
	ExitCodeRepairable     int = 3 // ErrExitRepairable
	ExitCodeUnrepairable   int = 4 // ErrExitUnrepairable
	ExitCodeUnclassified   int = 5 // ErrExitUnclassified

	Par2ExitCodeSuccess          int = 0
	Par2ExitCodeRepairPossible   int = 1
	Par2ExitCodeRepairImpossible int = 2

	Par2Extension     string = ".par2" // used as par2Extension
	LockExtension     string = ".lock" // used as par2Extension+lockExtension
	ManifestExtension string = ".json" // used as par2Extension+manifestExtension

	IgnoreFile    string = ".par2cron-ignore"
	IgnoreAllFile string = ".par2cron-ignore-all"

	CreateFileMode      string = "file"
	CreateFolderMode    string = "folder"
	CreateRecursiveMode string = "recursive"
)
View Source
const (
	PosKey  ctxKey = iota
	MposKey ctxKey = iota
	PrioKey ctxKey = iota
)
View Source
const (
	ManifestVersion = "2"
)

Variables

View Source
var (
	ErrExitPartialFailure = errors.New("partial failure")                       // [ExitCodePartialFailure]
	ErrExitBadInvocation  = errors.New("bad invocation")                        // [ExitCodeBadInvocation]
	ErrExitRepairable     = errors.New("files are corrupted, but repairable")   // [ExitCodeRepairable]
	ErrExitUnrepairable   = errors.New("files are corrupted, but unrepairable") // [ExitCodeUnrepairable]
	ErrExitUnclassified   = errors.New("unclassified error")                    // [ExitCodeUnclassified]

	ErrAlreadyExists    = errors.New("file exists")
	ErrFileIsLocked     = errors.New("file is locked")
	ErrNonFatal         = errors.New("non-fatal error")
	ErrSilentSkip       = errors.New("skip without error")
	ErrManifestMismatch = errors.New("manifest mismatch")
)
View Source
var ProgramVersion = "devel"

ProgramVersion is the program version as filled in by the Makefile.

Functions

func ExitCodeFor

func ExitCodeFor(err error) int

Types

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, cmd string, args []string, workingDir string, stdout io.Writer, stderr io.Writer) error
}

type CreationManifest

type CreationManifest struct {
	Time     time.Time     `json:"time"`
	Args     []string      `json:"args"`
	Duration time.Duration `json:"duration_ns"`
	Elements []FsElement   `json:"elements"`
}

func (*CreationManifest) UnmarshalJSON added in v0.1.5

func (c *CreationManifest) UnmarshalJSON(data []byte) error

type FilesystemWalker

type FilesystemWalker interface {
	WalkDir(root string, fn fs.WalkDirFunc) error
}

FilesystemWalker is an interface describing a filesystem walking function.

type FsElement added in v0.1.5

type FsElement struct {
	Path string `json:"-"` // Excluded from JSON (not to leak absolute paths)

	Name    string      `json:"name"`
	Size    int64       `json:"size"`
	Mode    fs.FileMode `json:"mode"`
	IsDir   bool        `json:"is_dir"`
	ModTime time.Time   `json:"mod_time"`
}

type Manifest

type Manifest struct {
	ProgramVersion  string `json:"program_version"`
	ManifestVersion string `json:"manifest_version"`

	Name     string            `json:"name"`
	SHA256   string            `json:"sha256"`
	Par2Data *Par2DataManifest `json:"par2_data,omitempty"`

	Creation     *CreationManifest     `json:"creation,omitempty"`
	Verification *VerificationManifest `json:"verification,omitempty"`
	Repair       *RepairManifest       `json:"repair,omitempty"`
}

func NewManifest

func NewManifest(par2Name string) *Manifest

type Par2DataManifest added in v0.1.5

type Par2DataManifest struct {
	Time    time.Time     `json:"time"`
	FileSet *par2.FileSet `json:"file_set,omitempty"`
}

type RepairManifest

type RepairManifest struct {
	Count    int           `json:"count"`
	Time     time.Time     `json:"time"`
	Args     []string      `json:"args"`
	ExitCode int           `json:"exit_code"`
	Duration time.Duration `json:"duration_ns"`
}

type VerificationManifest

type VerificationManifest struct {
	Count          int           `json:"count"`
	CountCorrupted int           `json:"count_corrupted"`
	Time           time.Time     `json:"time"`
	Args           []string      `json:"args"`
	ExitCode       int           `json:"exit_code"`
	RepairNeeded   bool          `json:"repair_needed"`
	RepairPossible bool          `json:"repair_possible"`
	Duration       time.Duration `json:"duration_ns"`
}

Jump to

Keyboard shortcuts

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