versioner

package
v0.0.0-...-b5ba5ed Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package versioner implements common interfaces for file versioning and a simple default versioning scheme.

Index

Constants

View Source
const (
	DefaultPath = ".stversions"
)
View Source
const (
	TimeFormat = "20060102-150405"
)

Variables

View Source
var (
	ErrDirectory = errors.New("cannot restore on top of a directory")
)
View Source
var ErrRestorationNotSupported = errors.New("version restoration not supported with the current versioner")

Functions

func TagFilename

func TagFilename(name, tag string) string

TagFilename inserts ~tag just before the extension of the filename.

func UntagFilename

func UntagFilename(path string) (string, string)

UntagFilename returns the filename without tag, and the extracted tag

Types

type FileVersion

type FileVersion struct {
	VersionTime time.Time `json:"versionTime"`
	ModTime     time.Time `json:"modTime"`
	Size        int64     `json:"size"`
}

type Versioner

type Versioner interface {
	Archive(filePath string) error
	GetVersions() (map[string][]FileVersion, error)
	Restore(filePath string, versionTime time.Time) error
	Clean(context.Context) error
}

Jump to

Keyboard shortcuts

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