Documentation
¶
Index ¶
Constants ¶
const DefaultPollWarmDuration = time.Minute
DefaultPollWarmDuration is the interval between requests to cloud providers, to get file status during files restore.
Variables ¶
var ( ErrEmptyStorage = errors.New("empty storage") ErrArchivedObject = errors.New("archived object") )
ErrEmptyStorage describes the empty storage error for the restore operation.
Functions ¶
func CleanPath ¶
CleanPath sanitizes the input path string based on the storage type (S3 or non-S3). For S3 storage, it removes the root path "/" as S3 uses empty string for root. For all storage types, it ensures proper trailing slash format except for empty or root paths. Returns the cleaned path string.
func ErrToChan ¶
ErrToChan checks context before sending an error to errors chan. If context is already canceled and the reader must be stopped, no need to send error to errors chan.
func IsDirectory ¶
IsDirectory determines if a given file name represents a directory within the specified prefix. It considers three cases:
- File name ends with "/" (definite directory)
- File name is within a prefix and contains "/" after the prefix
- File name contains "/" (general case)
Returns true if the file name represents a directory, false otherwise.
func PreSort ¶
PreSort performs pre-processing of backup files by sorting them before reading. It retrieves a list of objects from the specified path, sorts them according to the backup file naming conventions, and configures the reader to stream the sorted list. Returns an error if listing objects fails or if the sorting operation fails.
Types ¶
type RetryableReader ¶
type RetryableReader struct {
// contains filtered or unexported fields
}
RetryableReader is a wrapper around the s3 reader that implements the retryable interface.
func NewRetryableReader ¶
func NewRetryableReader( ctx context.Context, rangeReader rangeReader, retryPolicy *models.RetryPolicy, logger *slog.Logger, ) (*RetryableReader, error)
NewRetryableReader returns a new retryable reader.
type SkippedFiles ¶
type SkippedFiles struct {
// contains filtered or unexported fields
}
SkippedFiles collects information about files that were not processed during an operation.
func NewSkippedFiles ¶
func NewSkippedFiles(prefixes []string) *SkippedFiles
NewSkippedFiles returns new SkippedFiles instance, to track skipped files.
func (*SkippedFiles) GetSkipped ¶
func (s *SkippedFiles) GetSkipped() []string
GetSkipped returns a list of file paths that were skipped during the `StreamFlies` with skipPrefix.
func (*SkippedFiles) Skip ¶
func (s *SkippedFiles) Skip(path string) bool
Skip check if file must be skipped. If yes, it will be added to filePaths.