Documentation
¶
Index ¶
- type Reader
- func (r *Reader) GetNumber() int64
- func (r *Reader) GetSize() int64
- func (r *Reader) GetSkipped() []string
- func (r *Reader) GetType() string
- func (r *Reader) ListObjects(ctx context.Context, path string) ([]string, error)
- func (r *Reader) SetObjectsToStream(list []string)
- func (r *Reader) StreamFile(ctx context.Context, filename string, readersCh chan<- models.File, ...)
- func (r *Reader) StreamFiles(ctx context.Context, readersCh chan<- models.File, errorsCh chan<- error, ...)
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// Optional parameters.
options.Options
// contains filtered or unexported fields
}
Reader represents local storage reader.
func NewReader ¶
NewReader creates a new local directory/file Reader. Must be called with WithDir(path string) or WithFile(path string) - mandatory. Can be called with WithValidator(v validator) - optional.
func (*Reader) GetNumber ¶
GetNumber returns the number of asb/asbx files/dirs that was initialized.
func (*Reader) GetSkipped ¶ added in v0.8.0
GetSkipped returns a list of file paths that were skipped during the `StreamFlies` with skipPrefix.
func (*Reader) ListObjects ¶
ListObjects list all object in the path.
func (*Reader) SetObjectsToStream ¶
SetObjectsToStream sets objects to stream.
func (*Reader) StreamFile ¶
func (r *Reader) StreamFile( ctx context.Context, filename string, readersCh chan<- models.File, errorsCh chan<- error)
StreamFile opens single file and sends io.Readers to the `readersCh` In case of an error, it is sent to the `errorsCh` channel.
func (*Reader) StreamFiles ¶
func (r *Reader) StreamFiles( ctx context.Context, readersCh chan<- models.File, errorsCh chan<- error, skipPrefixes []string, )
StreamFiles reads file/directory from disk and sends io.Readers to the `readersCh` communication channel for lazy loading. In case of an error, it is sent to the `errorsCh` channel. If `skipPrefix` is set, it will skip files that start with this prefix and save a skipped list of files.
type Writer ¶
type Writer struct {
// Optional parameters.
options.Options
// contains filtered or unexported fields
}
Writer represents a local storage writer.
func NewWriter ¶
NewWriter creates a new writer for local directory/file writes. Must be called with WithDir(path string) or WithFile(path string) - mandatory. Can be called with WithRemoveFiles() - optional.
func (*Writer) NewWriter ¶
NewWriter creates a new backup file in the given directory. The file name is based on the specified fileName.