common

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Errors
	ErrEmptyAbsPath = errors.New("empty file path")
	ErrEmptyRelPath = errors.New("empty file relative path")
	ErrEmptyHash    = errors.New("empty file hash")
	ErrEmptySize    = errors.New("empty file size")
)

Functions

This section is empty.

Types

type File

type File struct {
	// AbsPath represents the actual path in the filesystem
	AbsPath string `json:"-"`

	// RelPath represents the relative path of the file in the backup structure
	RelPath string `json:"path"`

	// Hash is an hexadecimal representation of the hash of the file
	Hash string `json:"hash"`

	// Size represent the size of the file in bytes
	Size int64 `json:"size"`
}

File is the gkup internal representation of a file. It is NOT guaranteed that all of any of its fields have data, so if you don't trust its source you should check for its zero value.

Also, if you implement this type, you should return the specified zero value in each file you left empty.

The zero values of each field are:

  • AbsPath: ""
  • RelPath: ""
  • Hash: ""
  • Size: Any value below 0 (0 itself excluded, it's a valid size)

func (*File) CheckAbsPath added in v0.3.0

func (f *File) CheckAbsPath() error

CheckAbsPath returns ErrEmptyAbsPath if the AbsPath property of the object provided has a zero-value

func (*File) CheckHash added in v0.3.0

func (f *File) CheckHash() error

CheckHash returns ErrEmptyHash if the Hash property of the object provided has a zero-value

func (*File) CheckRelPath added in v0.3.0

func (f *File) CheckRelPath() error

CheckRelPath returns ErrEmptyRelPath if the RelPath property of the object provided has a zero-value

func (*File) CheckSize added in v0.3.0

func (f *File) CheckSize() error

CheckSize returns ErrEmptySize if the Size property of the object provided has a zero-value

type SafeFileList

type SafeFileList struct {
	List []*File
	// contains filtered or unexported fields
}

SafeFileList represents a list of File safe for concurrent use.

func (*SafeFileList) Next

func (sfl *SafeFileList) Next() *File

Next will return the next value, or nil if no more values are found.

Jump to

Keyboard shortcuts

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