metadata

package
v0.0.0-...-d2fa2ec Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MetadataFileExtension string = "cfile"

Variables

View Source
var (
	ErrFileExtensionEmpty          = fmt.Errorf("options.MetadatafileExtension cannot be %q", "")
	ErrRetrieveFailureHashMismatch = errors.New("hashes don't match, Retrieve aborted")
)

Functions

func HashFromCfileMatches

func HashFromCfileMatches(fsys afero.Fs, cfile string, expected string) (bool, error)

func SHA256FromReader

func SHA256FromReader(r io.Reader) (string, error)

func WriteToFsys

func WriteToFsys(req FsysWriteRequest) (err error)

WriteToFsys generates Cavorite metadata for req.Object and writes it to req.Fsys

Types

type CfileMetadataMap

type CfileMetadataMap map[string]ObjectMetaData

type FsysWriteRequest

type FsysWriteRequest struct {
	Object       string
	Fsys         afero.Fs
	Fi           afero.File
	MetadataPath string
	Extension    string
}

type ObjectMetaData

type ObjectMetaData struct {
	Name         string    `json:"name"`
	Checksum     string    `json:"checksum"`
	DateModified time.Time `json:"date_modified"`
}

func GenerateFromFile

func GenerateFromFile(f afero.File, key string) (*ObjectMetaData, error)

func GenerateFromReader

func GenerateFromReader(name string, modTime time.Time, r io.Reader) (*ObjectMetaData, error)

func ParseCfile

func ParseCfile(fsys afero.Fs, obj string) (*ObjectMetaData, error)

func ParseCfileWithExtension

func ParseCfileWithExtension(fsys afero.Fs, obj, ext string) (*ObjectMetaData, error)

Jump to

Keyboard shortcuts

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