versioner

package
v1.18.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: MPL-2.0 Imports: 19 Imported by: 2

Documentation

Overview

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

Index

Constants

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 added in v0.14.44

func TagFilename(name, tag string) string

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

func UntagFilename added in v0.14.44

func UntagFilename(path string) (string, string)

UntagFilename returns the filename without tag, and the extracted tag

Types

type FileVersion added in v0.14.44

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
}

func New added in v1.3.3

Jump to

Keyboard shortcuts

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