s3

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// Optional parameters.
	ioStorage.Options
	// contains filtered or unexported fields
}

Reader represents S3 storage reader.

func NewReader

func NewReader(
	ctx context.Context,
	client *s3.Client,
	bucketName string,
	opts ...ioStorage.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) GetNumber

func (r *Reader) GetNumber() int64

GetNumber returns the number of asb/asbx files/dirs that was initialized.

func (*Reader) GetSize

func (r *Reader) GetSize() int64

GetSize returns the size of asb/asbx file/dir that was initialized.

func (*Reader) GetType

func (r *Reader) GetType() string

GetType return `s3type` type of storage. Used in logging.

func (*Reader) ListObjects

func (r *Reader) ListObjects(ctx context.Context, path string) ([]string, error)

ListObjects list all object in the path.

func (*Reader) SetObjectsToStream

func (r *Reader) SetObjectsToStream(list []string)

SetObjectsToStream set 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 from s3 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,
)

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 {
	// Optional parameters.
	ioStorage.Options
	// contains filtered or unexported fields
}

Writer represents a s3 storage writer.

func NewWriter

func NewWriter(
	ctx context.Context,
	client *s3.Client,
	bucketName string,
	opts ...ioStorage.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 != ""

func (*Writer) GetType

func (w *Writer) GetType() string

GetType returns the type of the writer.

func (*Writer) NewWriter

func (w *Writer) NewWriter(ctx context.Context, filename string) (io.WriteCloser, error)

NewWriter returns a new S3 writer to the specified path.

func (*Writer) Remove

func (w *Writer) Remove(ctx context.Context, targetPath string) error

Remove deletes the file or directory contents specified by path.

func (*Writer) RemoveFiles

func (w *Writer) RemoveFiles(ctx context.Context) error

RemoveFiles removes a backup file or files from directory.

Jump to

Keyboard shortcuts

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