cloudbackup

package
v5.3.3-pre1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BackupTasks = param.NewMap()
)
View Source
var ErrEmptyConfig = errors.New(`empty config`)
View Source
var ErrUnsupported = errors.New(`unsupported storage engine`)
View Source
var Forms = map[string][]Form{}
View Source
var (
	LevelDBDir = `data/cache/backup-db`
)

Functions

func DownloadFile added in v5.2.6

func DownloadFile(s Storager, ctx context.Context, ppath string, dest string) error

func FileChan

func FileChan() chan *PutFile

func HasForm added in v5.2.1

func HasForm(engineName string, formName string) bool

func LevelDB added in v5.2.3

func LevelDB() *dbPool

func MonitorBackupStop

func MonitorBackupStop(id uint) error

func NewLevelDBPool added in v5.2.3

func NewLevelDBPool() *dbPool

func ParseDBValue added in v5.2.3

func ParseDBValue(val []byte) (md5 string, startTs, endTs, fileModifyTs, fileSize int64)

func RecordLog added in v5.2.1

func RecordLog(ctx echo.Context, err error, cfg *dbschema.NgingCloudBackup,
	filePath string, remotePath string, operation string,
	startTime time.Time, size uint64, backupType ...string)

func Register added in v5.2.1

func Register(name string, constructor Constructor, forms []Form, label string)

func ResetFileChan

func ResetFileChan()

func Restore added in v5.2.6

func Restore(ctx echo.Context, cfg dbschema.NgingCloudBackup, callback func(from, to string), prog notice.Progressor) error

func RetryablePut added in v5.2.1

func RetryablePut(ctx context.Context, mgr Storager, fp io.ReadSeekCloser, objectName string, size int64) error

Types

type Cloudbackup

type Cloudbackup struct {
	SourcePath string
	DestPath   string
	Filter     func(string) bool

	WaitFillCompleted bool
	IgnoreWaitRegexp  *regexp.Regexp
	// contains filtered or unexported fields
}

func New

func (*Cloudbackup) OnCreate

func (c *Cloudbackup) OnCreate(file string)

func (*Cloudbackup) OnDelete

func (c *Cloudbackup) OnDelete(file string)

func (*Cloudbackup) OnModify

func (c *Cloudbackup) OnModify(file string)

func (*Cloudbackup) OnRename

func (c *Cloudbackup) OnRename(file string)

type Constructor added in v5.2.1

type Constructor func(ctx echo.Context, cfg dbschema.NgingCloudBackup) (Storager, error)

type ErrIsAccessDenied added in v5.2.1

type ErrIsAccessDenied interface {
	ErrIsAccessDenied(error) bool
}

type Form added in v5.2.1

type Form struct {
	Type        string
	Label       string
	Name        string
	Required    bool
	Pattern     string
	Placeholder string
}

type ProgressorSetter added in v5.2.6

type ProgressorSetter interface {
	SetProgressor(notice.Progressor)
}

type PutFile

type PutFile struct {
	Manager           Storager
	Config            dbschema.NgingCloudBackup
	ObjectName        string
	FilePath          string
	Operation         string
	WaitFillCompleted bool
}

func (*PutFile) Do

func (mf *PutFile) Do(ctx context.Context) (size int64, lastModtime time.Time, err error)

type StorageFTP added in v5.2.1

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

func (*StorageFTP) Close added in v5.2.1

func (s *StorageFTP) Close() (err error)

func (*StorageFTP) Connect added in v5.2.1

func (s *StorageFTP) Connect() (err error)

func (*StorageFTP) Download added in v5.2.6

func (s *StorageFTP) Download(ctx context.Context, ppath string, w io.Writer) error

func (*StorageFTP) MkdirAll added in v5.2.1

func (s *StorageFTP) MkdirAll(dir string) (err error)

func (*StorageFTP) Put added in v5.2.1

func (s *StorageFTP) Put(ctx context.Context, reader io.Reader, ppath string, size int64) (err error)

func (*StorageFTP) Remove added in v5.2.1

func (s *StorageFTP) Remove(ctx context.Context, ppath string) error

func (*StorageFTP) RemoveDir added in v5.2.1

func (s *StorageFTP) RemoveDir(ctx context.Context, ppath string) error

func (*StorageFTP) Restore added in v5.2.6

func (s *StorageFTP) Restore(ctx context.Context, ppath string, destpath string, callback func(from, to string)) error

func (*StorageFTP) SetProgressor added in v5.2.6

func (s *StorageFTP) SetProgressor(prog notice.Progressor)

type StorageMock added in v5.2.1

type StorageMock struct {
}

func (*StorageMock) Close added in v5.2.1

func (s *StorageMock) Close() (err error)

func (*StorageMock) Connect added in v5.2.1

func (s *StorageMock) Connect() (err error)

func (*StorageMock) Download added in v5.2.6

func (s *StorageMock) Download(ctx context.Context, ppath string, w io.Writer) error

func (*StorageMock) Put added in v5.2.1

func (s *StorageMock) Put(ctx context.Context, reader io.Reader, ppath string, size int64) (err error)

func (*StorageMock) Remove added in v5.2.1

func (s *StorageMock) Remove(ctx context.Context, ppath string) error

func (*StorageMock) RemoveDir added in v5.2.1

func (s *StorageMock) RemoveDir(ctx context.Context, ppath string) error

func (*StorageMock) Restore added in v5.2.6

func (s *StorageMock) Restore(ctx context.Context, ppath string, destpath string, callback func(from, to string)) error

type StorageS3 added in v5.2.1

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

func (*StorageS3) Close added in v5.2.1

func (s *StorageS3) Close() (err error)

func (*StorageS3) Connect added in v5.2.1

func (s *StorageS3) Connect() (err error)

func (*StorageS3) Download added in v5.2.6

func (s *StorageS3) Download(ctx context.Context, ppath string, w io.Writer) error

func (*StorageS3) Put added in v5.2.1

func (s *StorageS3) Put(ctx context.Context, reader io.Reader, ppath string, size int64) (err error)

func (*StorageS3) Remove added in v5.2.1

func (s *StorageS3) Remove(ctx context.Context, ppath string) error

func (*StorageS3) RemoveDir added in v5.2.1

func (s *StorageS3) RemoveDir(ctx context.Context, ppath string) error

func (*StorageS3) Restore added in v5.2.6

func (s *StorageS3) Restore(ctx context.Context, ppath string, destpath string, callback func(from, to string)) error

func (*StorageS3) SetProgressor added in v5.2.6

func (s *StorageS3) SetProgressor(prog notice.Progressor)

type StorageSMB added in v5.2.1

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

func (*StorageSMB) Close added in v5.2.1

func (s *StorageSMB) Close() (err error)

func (*StorageSMB) Connect added in v5.2.1

func (s *StorageSMB) Connect() (err error)

func (*StorageSMB) Download added in v5.2.6

func (s *StorageSMB) Download(ctx context.Context, ppath string, w io.Writer) error

func (*StorageSMB) Put added in v5.2.1

func (s *StorageSMB) Put(ctx context.Context, reader io.Reader, ppath string, size int64) (err error)

func (*StorageSMB) Remove added in v5.2.1

func (s *StorageSMB) Remove(ctx context.Context, ppath string) error

func (*StorageSMB) RemoveDir added in v5.2.1

func (s *StorageSMB) RemoveDir(ctx context.Context, ppath string) error

func (*StorageSMB) Restore added in v5.2.6

func (s *StorageSMB) Restore(ctx context.Context, ppath string, destpath string, callback func(from, to string)) error

func (*StorageSMB) SetProgressor added in v5.2.6

func (s *StorageSMB) SetProgressor(prog notice.Progressor)

type StorageWebDAV added in v5.2.1

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

func (*StorageWebDAV) Close added in v5.2.1

func (s *StorageWebDAV) Close() (err error)

func (*StorageWebDAV) Connect added in v5.2.1

func (s *StorageWebDAV) Connect() (err error)

func (*StorageWebDAV) Download added in v5.2.6

func (s *StorageWebDAV) Download(ctx context.Context, ppath string, w io.Writer) error

func (*StorageWebDAV) Put added in v5.2.1

func (s *StorageWebDAV) Put(ctx context.Context, reader io.Reader, ppath string, size int64) (err error)

func (*StorageWebDAV) Remove added in v5.2.1

func (s *StorageWebDAV) Remove(ctx context.Context, ppath string) error

func (*StorageWebDAV) RemoveDir added in v5.2.1

func (s *StorageWebDAV) RemoveDir(ctx context.Context, ppath string) error

func (*StorageWebDAV) Restore added in v5.2.6

func (s *StorageWebDAV) Restore(ctx context.Context, ppath string, destpath string, callback func(from, to string)) error

func (*StorageWebDAV) SetProgressor added in v5.2.6

func (s *StorageWebDAV) SetProgressor(prog notice.Progressor)

type Storager added in v5.2.1

type Storager interface {
	Connect() (err error)
	Put(ctx context.Context, reader io.Reader, ppath string, size int64) (err error)
	Download(ctx context.Context, ppath string, w io.Writer) error
	RemoveDir(ctx context.Context, ppath string) error
	Remove(ctx context.Context, ppath string) error
	Restore(ctx context.Context, ppath string, destpath string, callback func(from, to string)) error
	Close() (err error)
}

func NewStorage added in v5.2.1

func NewStorage(ctx echo.Context, cfg dbschema.NgingCloudBackup) (Storager, error)

func NewStorageFTP added in v5.2.1

func NewStorageFTP(addr, username, password string) Storager

func NewStorageMock added in v5.2.1

func NewStorageMock() Storager

func NewStorageS3 added in v5.2.1

func NewStorageS3(cfg dbschema.NgingCloudStorage) Storager

func NewStorageSMB added in v5.2.1

func NewStorageSMB(addr, username, password, sharename string) Storager

func NewStorageWebDAV added in v5.2.1

func NewStorageWebDAV(uri, username, password string) Storager

type Task added in v5.2.6

type Task struct {
	Monitor  *com.MonitorEvent
	Storager Storager
}

func NewTask added in v5.2.6

func NewTask(monitor *com.MonitorEvent, storager Storager) *Task

func (*Task) Close added in v5.2.6

func (t *Task) Close()

Jump to

Keyboard shortcuts

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