options

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(*Options)

func WithAccessTier

func WithAccessTier(tier string) Opt

WithAccessTier sets the access tier for archived files. For readers, archived files are restored to the specified tier.

func WithCalculateTotalSize

func WithCalculateTotalSize() Opt

WithCalculateTotalSize determines whether we need to calculate the total size of all files in a path. Is used only for Reader.

func WithChunkSize

func WithChunkSize(bytes int) Opt

WithChunkSize sets the chunk size for uploading files. Is used only for Writer.

func WithDir

func WithDir(path string) Opt

WithDir adds the directory to reading/writing files from/to.

func WithDirList

func WithDirList(pathList []string) Opt

WithDirList adds the directory list to read files from. Is used only for Reader.

func WithFile

func WithFile(path string) Opt

WithFile adds the file path to reading/writing from/to.

func WithFileList

func WithFileList(pathList []string) Opt

WithFileList adds the file list to read from. Is used only for Reader.

func WithLogger

func WithLogger(logger *slog.Logger) Opt

WithLogger sets the logger.

func WithNestedDir

func WithNestedDir() Opt

WithNestedDir adds WithNestedDir = true parameter. That means that we won't skip nested folders.

func WithRemoveFiles

func WithRemoveFiles() Opt

WithRemoveFiles adds remove files flag, so all files will be removed from backup folder before backup. Is used only for Writer.

func WithRetryPolicy

func WithRetryPolicy(policy *models.RetryPolicy) Opt

WithRetryPolicy sets the retry policy. Is used only for S3 Reader.

func WithSkipDirCheck

func WithSkipDirCheck() Opt

WithSkipDirCheck adds skip dir check flags. Which means that backup directory won't be checked for emptiness.

func WithSorting

func WithSorting() Opt

WithSorting adds a sorting flag. Which means that files will be read from directory in the sorted order. Is used only for Reader.

func WithStartAfter

func WithStartAfter(v string) Opt

WithStartAfter adds start after parameter to list request. Is used only for Reader.

func WithStorageClass

func WithStorageClass(class string) Opt

WithStorageClass sets the storage class. For writers, files are saved to the specified class (in case of Azure it will be tier).

func WithUploadConcurrency

func WithUploadConcurrency(v int) Opt

WithUploadConcurrency defines max number of concurrent uploads to be performed to upload the file. Is used only for Azure Writer.

func WithValidator

func WithValidator(v validator) Opt

WithValidator adds the Validator to Reader, so files will be validated before reading. Is used only for Reader.

func WithWarmPollDuration

func WithWarmPollDuration(duration time.Duration) Opt

WithWarmPollDuration sets the restore status polling interval.

type Options

type Options struct {
	// PathList contains a list of files or directories.
	PathList []string
	// IsDir flag determines whether the path is a directory.
	IsDir bool
	// IsRemovingFiles flag specifies whether to clear the backup folder.
	IsRemovingFiles bool
	// Validator contains files Validator that is applied to files if IsDir is true.
	Validator validator
	// WithNestedDir determines whether the read/write operations should treat objects
	// identified as directories like regular files.
	// When we stream files or delete files in folder, we skip directories. Setting
	// WithNestedDir to true disables this directory skipping behavior.
	// Default: false
	WithNestedDir bool
	// StartAfter is an artificial parameter. Used to skip objects in the storage.
	// The Result will not include an object specified in startAfter.
	// If it is set, then we compare the names received from the storage lexicographically,
	// and if the name is less than the specified parameter, we skip this object.
	StartAfter string
	// SkipDirCheck, if true, the backup directory won't be checked.
	SkipDirCheck bool
	// SortFiles determines whether we need to sort files before reading.
	SortFiles bool

	// UploadConcurrency defines the max number of concurrent uploads to be performed to
	// upload the file. Each concurrent upload will create a buffer of size BlockSize.
	UploadConcurrency int

	// StorageClass specifies the type of storage class.
	// Supported values depend on the cloud provider being used.
	StorageClass string

	// The access tier that will be applied to back up files.
	AccessTier string

	// Logger contains logger.
	Logger *slog.Logger

	// How often restore status will be polled from cloud provider.
	PollWarmDuration time.Duration

	// Size of chunk to upload.
	ChunkSize int

	// RetryPolicy is used to control the number of retries for failed requests.
	// At the moment supported only for S3 Reader.
	RetryPolicy *models.RetryPolicy

	// CalculateTotalSize determines whether we need to calculate the total size of all files in a path on Reader creation.
	CalculateTotalSize bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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