Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opt ¶ added in v0.2.0
type Opt func(*options)
func WithDirList ¶ added in v0.3.0
WithDirList adds a directory list to read files from. Is used only for Reader.
func WithFileList ¶ added in v0.3.0
WithFileList adds a file list to read from. Is used only for Reader.
func WithNestedDir ¶ added in v0.2.0
func WithNestedDir() Opt
WithNestedDir adds withNestedDir = true parameter. That means that we won't skip nested folders.
func WithRemoveFiles ¶ added in v0.2.0
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 WithSkipDirCheck ¶ added in v0.2.0
func WithSkipDirCheck() Opt
WithSkipDirCheck adds skip dir check flags. Which means that backup directory won't be checked for emptiness.
func WithStartAfter ¶ added in v0.2.0
WithStartAfter adds start after parameter to list request. Is used only for Reader.
func WithValidator ¶ added in v0.2.0
func WithValidator(v validator) Opt
WithValidator adds validator to Reader, so files will be validated before reading. Is used only for Reader.
type Reader ¶ added in v0.2.0
type Reader struct {
// contains filtered or unexported fields
}
Reader represents S3 storage reader.
func NewReader ¶ added in v0.2.0
func NewReader( ctx context.Context, client *s3.Client, bucketName string, opts ...Opt, ) (*Reader, error)
NewReader returns new S3 storage reader. Must be called with WithDir(path string) or WithFile(path string) - mandatory. Can be called with WithValidator(v validator) - optional. For S3 client next parameters must be set:
- o.UsePathStyle = true
- o.BaseEndpoint = &endpoint - if endpoint != ""
func (*Reader) StreamFile ¶ added in v0.2.0
func (r *Reader) StreamFile( ctx context.Context, filename string, readersCh chan<- io.ReadCloser, errorsCh chan<- error)
StreamFile opens single file from s3 and sends io.Readers to the `readersCh` In case of an error, it is sent to the `errorsCh` channel.
func (*Reader) StreamFiles ¶ added in v0.2.0
func (r *Reader) StreamFiles( ctx context.Context, readersCh chan<- io.ReadCloser, errorsCh chan<- error, )
StreamFiles read files form s3 and send io.Readers to `readersCh` communication chan for lazy loading. In case of error we send error to `errorsCh` channel.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer represents a s3 storage writer.
func NewWriter ¶
func NewWriter( ctx context.Context, client *s3.Client, bucketName string, opts ...Opt, ) (*Writer, error)
NewWriter creates a new writer for S3 storage directory/file writes. Must be called with WithDir(path string) or WithFile(path string) - mandatory. Can be called with WithRemoveFiles() - optional. For S3 client next parameters must be set:
- o.UsePathStyle = true
- o.BaseEndpoint = &endpoint - if endpoint != ""