backup

package
v0.0.0-...-5a94a59 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup

func Backup(rawPaths []string, serviceCh UploadServiceFactory)

func BackupDB

func BackupDB()

func DBKey

func DBKey() []byte

func DryBackup

func DryBackup(rawPaths []string)

func Mnemonic

func Mnemonic(key []byte)

Types

type BlobPlan

type BlobPlan []Planned

type File

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

type FileStatus

type FileStatus struct {

	// no enums lol
	Modified bool
	New      bool

	Hash []byte
	// contains filtered or unexported fields
}

func CompareFileToDb

func CompareFileToDb(path string, info os.FileInfo, tx *sql.Tx, debugPrint bool) FileStatus

type HashPlan

type HashPlan struct {
	File
	// contains filtered or unexported fields
}

type Planned

type Planned struct {
	File
	// contains filtered or unexported fields
}

type ScannerTransactionContext

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

func (*ScannerTransactionContext) Close

func (ctx *ScannerTransactionContext) Close()

func (*ScannerTransactionContext) Tx

func (ctx *ScannerTransactionContext) Tx() *sql.Tx

leaving a single transaction open for the entire backup process causes the WAL to grow unboundedly see issue #31 this fixes that issue by committing and reopening the transaction once a second

type Stats

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

func (*Stats) Add

func (s *Stats) Add(hs *utils.HasherSizer)

func (*Stats) AddCurrentlyUploading

func (s *Stats) AddCurrentlyUploading(path string, sizer *utils.HasherSizer)

func (*Stats) CurrentlyUploading

func (s *Stats) CurrentlyUploading() []string

func (*Stats) FinishedUploading

func (s *Stats) FinishedUploading(path string)

func (*Stats) Total

func (s *Stats) Total() int64

type UploadService

type UploadService interface {
	Begin(blobID []byte) io.Writer
	End(sha256 []byte, size int64) []storage_base.UploadedBlob
}

an abstraction over uploading to our storage destinations can either be a direct upload, or go through a gb relay (see the relay package) stateful, End must be called after Begin (so, obviously, cannot be used from multiple threads) can be reused sequentially, though

func BeginDirectUpload

func BeginDirectUpload(storages []storage_base.Storage) UploadService

type UploadServiceFactory

type UploadServiceFactory chan UploadService

since only one UploadService can be used per uploader thread, this provides however many are needed (aka: the number of configured uploader threads)

func MakeDefaultServiceFactory

func MakeDefaultServiceFactory() UploadServiceFactory

Jump to

Keyboard shortcuts

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