gobackup

package
v0.0.0-...-5788fb6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildData

func BuildData(a *Data1) string

write data to disk for a maximum of 100 MB

func BuildData2

func BuildData2(a *Data1) ([]byte, error)

write data in a stream-like fashion

func DataFile2

func DataFile2(file string, dat *Data1)

create a data file from data struct

func DownloadKV

func DownloadKV(cf *Account, dataKey string, filepath string) string

implementation of the workers kv download

func GetKVkeys

func GetKVkeys(cf *Account)

get the stored keys on the account

func GetMetadata

func GetMetadata(d Metadata) string

func Md5file

func Md5file(in string) string

run md5 hash on a file

func UploadKV

func UploadKV(cf *Account, dat *Data1, filename string) bool

implementation of the workers kv upload filename is a string with the drive location of a file to be uploaded

func ValidateCF

func ValidateCF(cloud *Account) bool

validate that the preferences file has all the correct fields

func ZipFile

func ZipFile(filename string, zipname string)

creates a zip file named zipname using filename as the source file

func ZipPipe

func ZipPipe(pr *io.PipeReader, pw *io.PipeWriter, filename string)

zips a file named filename to the provided pipes pr and pw

Types

type Account

type Account struct {
	Account, Data, Email, Namespace, Key, Token, Location, Zip, Backup string
}

******* This struct contains the data needed to access the cloudflare infrastructure. It is stored on drive in the file preferences.toml *****

type ByHash

type ByHash []Metadata

ByHash Implements sort.Interface for []Metadata based on the Hash field.

func (ByHash) Len

func (h ByHash) Len() int

func (ByHash) Less

func (h ByHash) Less(i, j int) bool

func (ByHash) Swap

func (h ByHash) Swap(i, j int)

type Data1

type Data1 struct {
	DataSize           int64 //keeps track of the byte size of the uploads
	Count              int   //keeps track of the number of uploads
	CF_MAX_UPLOAD      int   //max number of files for upload
	CF_MAX_DATA_UPLOAD int64 //max data uploaded at a time
	CF_MAX_DATA_FILE   int64 //max data per file

	TheMetadata []Metadata
}

******* This struct contains the data tracking uploads***** Redo: Datasize will be size of files

remove hash, use only Metadata => add hash to Metadata

type Metadata

type Metadata struct {
	//f1o1 = file 1 of 1
	//note: = notes
	//modified timestamp
	//permissions
	//folder structure
	//Metadata filename:
	//
	//Metadata example test.txt:f2o4:ph#:fh#:
	FileNum, Notes, Permissions, Filepath, Hash string
	FileName                                    Stream
	Atime                                       time.Time
	Size                                        int64
}

this struct stores the Metadata that will be uploaded with each file

func CreateMeta

func CreateMeta(file string) Metadata

extracts the Metadata from a file

type Stream

type Stream string

func (Stream) MarshalJSON

func (a Stream) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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