objectify

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyString = ""
)

Variables

This section is empty.

Functions

func FileSizeString

func FileSizeString(size int64) string

func GetChecksumSHA256

func GetChecksumSHA256(ap string) (cs string, err error)

GetChecksumSHA256 takes an absolute path (`ap`) to a file as a string and returns the SHA-256 checksum of the file content as a base64 encoded string. It opens the file, calculates the checksum by reading the file content, then base64 encodes the checksum and returns it along with any error encountered during the process. If an error occurs at any step (like during file opening, reading, or closing), it returns the error and an empty checksum string.

func GetChecksumSHA256Reader

func GetChecksumSHA256Reader(r io.Reader) (cs string, err error)

Types

type FileObj

type FileObj struct {
	OriginPath string
	OriginDir  string
	Base       string
	RelRoot    string
	AbsPath    string

	FileSize       int64
	ChecksumSHA256 string

	FName    string
	FPseudoP string
	TagsMap  map[string]string

	Ignore          bool
	IgnoreString    string
	IsDirectoryPart bool
	IsFailed        bool
	IsFailedString  string
	IsUploaded      bool

	Group int
	// contains filtered or unexported fields
}

func NewFileObj

func NewFileObj(ac *conf.AppConfig, p, rel string, grp int) (fo *FileObj, err error)

func (*FileObj) FKey

func (fo *FileObj) FKey() string

FKey method concatenates the `FPseudoP` and `FName` fields of the `FileObj` instance with a '/' in between. `FPseudoP` represents the pseudo path of the file, while `FName` is the sanitized file name.

func (*FileObj) Values

func (fo *FileObj) Values()

type FileObjList

type FileObjList []*FileObj

func NewFileObjList

func NewFileObjList(ac *conf.AppConfig, files []string, rel string) (fol FileObjList, err error)

func (FileObjList) GetStats

func (fol FileObjList) GetStats() (stats Stats)

func (FileObjList) MaxGroup

func (fol FileObjList) MaxGroup() (max int)

func (FileObjList) Values

func (fol FileObjList) Values()

type RootList

type RootList []FileObjList

RootList is a list of FileObjLists. When you call NewRootList and specify a list of paths, it determines all the subdirectories of those paths and creates a FileObjList for each subdirectory.

func NewRootList

func NewRootList(ac *conf.AppConfig, paths []string) (rl RootList, err error)

func (RootList) GetStats

func (rl RootList) GetStats() (stats *Stats)

func (RootList) Values

func (rl RootList) Values()

type Stats

type Stats struct {
	Bytes    int64
	Uploaded int
	Ignored  int
	Failed   int
	Objects  int
	Discrep  int
}

func (*Stats) Add

func (s *Stats) Add(s2 Stats)

Jump to

Keyboard shortcuts

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