persistence

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LabelRegexp = regexp.MustCompile(`^[[:alnum:]][[:alnum:]_.+-]*$`)

LabelRegexp is the regular expression controlling the allowed characters for the package label.

Functions

func ValidateLabel

func ValidateLabel(label string) error

ValidateLabel return an error if the provided label contains any invalid characters, as determined by LabelRegexp.

Types

type FilesystemIO

type FilesystemIO struct {
}

FilesystemIO is the production implementation of the IOWriter interface

func (*FilesystemIO) Exists

func (*FilesystemIO) Exists(path string) (bool, error)

Exists checks whether a file exists

func (*FilesystemIO) MakeDir

func (f *FilesystemIO) MakeDir(dirname string, mode os.FileMode) error

MakeDir makes a directory on the filesystem (and any necessary parent directories).

func (*FilesystemIO) ReadDir

func (f *FilesystemIO) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads a directory from the filesystem

func (*FilesystemIO) ReadFile

func (f *FilesystemIO) ReadFile(filename string) ([]byte, error)

ReadFile reads a file from the filesystem

func (*FilesystemIO) Remove

func (f *FilesystemIO) Remove(name string) error

Remove removes a file from the filesystem - used for rolling back an in-flight Save operation upon a failure

func (*FilesystemIO) WriteFile

func (f *FilesystemIO) WriteFile(path, name string, data []byte) error

WriteFile writes a file to the filesystem; it does so atomically by first writing to a temp file and then renaming the file so that if the operation crashes midway we're not stuck with a bad package

Jump to

Keyboard shortcuts

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