filestore

package
v0.11.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 12 Imported by: 44

Documentation

Overview

Package filestore provides local file uploads and downloads for cookbook uploading and downloading. All access to the files is through the checksum, rather than the file name.

If config.Config.LocalFstoreDir is != "", the content of the files will be stored in that directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteHashes added in v0.5.0

func DeleteHashes(fileHashes []string)

DeleteHashes deletes all the checksum hashes given from the filestore.

func GetList

func GetList() []string

GetList gets a list of files that have been uploaded.

Types

type FileStore

type FileStore struct {
	Chksum string
	Data   *[]byte
}

FileStore is an individual file in the filestore. Note that there is no actual name for the file used, but it is identified by the file's checksum. The file's data is stored as a pointer to an array of bytes.

func AllFilestores added in v0.5.2

func AllFilestores() []*FileStore

AllFilestores returns all file checksums and their contents, for exporting.

func Get

func Get(chksum string) (*FileStore, error)

Get the file with this checksum.

func New

func New(chksum string, data io.ReadCloser, dataLength int64) (*FileStore, error)

New creates a new filestore item with the given checksum, io.ReadCloser holding the file's data, and the length of the file. If the file data's checksum does not match the provided checksum an error will be trhown.

func (*FileStore) Delete

func (f *FileStore) Delete() error

Delete a file store item.

func (*FileStore) Save

func (f *FileStore) Save() error

Save a file store item.

Jump to

Keyboard shortcuts

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