storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileAlreadyExists = errors.New("file already exists")
)

Functions

This section is empty.

Types

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage is a file system storage

func New

func New(conf *config.Storage, log *zerolog.Logger) (*Storage, error)

New checks config and creates new Storage

func (*Storage) CopyFromTmpToPrefixStorage

func (s *Storage) CopyFromTmpToPrefixStorage(tmpFileNameOrPath string) (string, error)

CopyFromTmpToPrefixStorage moves file from tmp to prefix storage returns name of the saved file in prefix storage

func (*Storage) GenerateNewPathToTmpFile

func (s *Storage) GenerateNewPathToTmpFile(ext string) string

GenerateNewPathToTmpFile generetes full path to the new tmp file

func (*Storage) GenerateNewTmpFileName

func (s *Storage) GenerateNewTmpFileName(ext string) string

GenerateNewTmpFileName generetes name of the new tmp file

func (*Storage) GetPrefixPathToFile

func (s *Storage) GetPrefixPathToFile(fileName string) (string, error)

GetPrefixPathToFile returns full path of the prefix file

func (*Storage) GetTmpPathToFile

func (s *Storage) GetTmpPathToFile(fileName string) string

GetTmpPathToFile returns full path of the tmp file

func (*Storage) Init

func (s *Storage) Init() error

Init checks the storage path and prepares it

func (*Storage) RemovePrefixFile

func (s *Storage) RemovePrefixFile(fileName string) error

RemovePrefixFile removes file in the prefix storage

func (*Storage) RemoveTmpFile

func (s *Storage) RemoveTmpFile(file string) error

RemoveTmpFile removes file in the tmp storage

func (*Storage) SaveToTmp

func (s *Storage) SaveToTmp(src io.Reader, ext string) (string, error)

SaveToTmp saves file to tmp dir returns name of the new file and error

Jump to

Keyboard shortcuts

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