restore

package
v8.24.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile added in v8.13.5

func DownloadFile(ctx context.Context, cfgPath string) (path string, errOK bool, err error)

DownloadFile downloads the auto-restore file from the given URL, and returns the path to the downloaded file. If the download fails, and the config is marked as continue-on-failure, then the error is returned, but errOK is set to true. If the download fails, and the file is not marked as continue-on-failure, then the error is returned, and errOK is set to false.

func ReadConfigFile

func ReadConfigFile(filename string) ([]byte, error)

ReadConfigFile reads the config file and returns the data. It also expands any environment variables in the config file.

func ResetStats

func ResetStats()

ResetStats resets the expvar stats for this module. Mostly for test purposes.

Types

type Config

type Config struct {
	Version           int              `json:"version"`
	Type              auto.StorageType `json:"type"`
	Timeout           auto.Duration    `json:"timeout,omitempty"`
	ContinueOnFailure bool             `json:"continue_on_failure,omitempty"`
	Sub               json.RawMessage  `json:"sub"`
}

Config is the config file format for the upload service

func Unmarshal

func Unmarshal(data []byte) (*Config, *aws.S3Config, error)

Unmarshal unmarshals the config file and returns the config and subconfig

type Downloader

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

func NewDownloader

func NewDownloader(storageClient StorageClient) *Downloader

func (*Downloader) Do

func (d *Downloader) Do(ctx context.Context, w io.Writer, timeout time.Duration) (err error)

type StorageClient

type StorageClient interface {
	Download(ctx context.Context, writer io.WriterAt) error
	fmt.Stringer
}

StorageClient is an interface for downloading data from a storage service.

Jump to

Keyboard shortcuts

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