s3

package
v0.0.0-...-e2e6556 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type S3Downloader

type S3Downloader[I string, O *S3DownloaderOutput] struct {
	// contains filtered or unexported fields
}

S3Downloader is a generic task capable of download a object from AWS S3 based on a given path and bucket name it will receive the bucket name on the constructor function NewS3Downloader and the path must be returned by adaptFN adaptFn will be called with input on method Run()

func NewS3Downloader

func NewS3Downloader[I string, O *S3DownloaderOutput](client s3iface.S3API, bucketName string, logger *slog.Logger) *S3Downloader[I, O]

func (*S3Downloader[I, O]) Run

func (s *S3Downloader[I, O]) Run(_ context.Context, input I, meta map[string]interface{}, _ string) (O, error)

The return from Run() will be a S3DownloaderOutput (containing object as []data) and Metadata No metadata will be added.

type S3DownloaderOutput

type S3DownloaderOutput struct {
	Data []byte
}

type S3Uploader

type S3Uploader[I *S3UploaderInput, O task.Nullable] struct {
	// contains filtered or unexported fields
}

S3Uploader is a task which will upload a given data on the given path (key) of one bucket

func NewS3Uploader

func NewS3Uploader[I *S3UploaderInput, O task.Nullable](client s3iface.S3API, bucketName string, logger *slog.Logger) *S3Uploader[I, O]

func (*S3Uploader[I, O]) Run

func (s *S3Uploader[I, O]) Run(_ context.Context, input I, meta map[string]interface{}, _ string) (O, error)

Run() will be called by worker and should return a pointer to TaskData. It doesn't merge nothing on metadata given and only return errors if any

type S3UploaderInput

type S3UploaderInput struct {
	// Path (Key) to upload the object
	Path string
	// Bytes to be uploaded
	Content []byte
}

S3UploaderInput is a envelope containing all the information needed to upload object to S3 Should be returned by adaptFn

Jump to

Keyboard shortcuts

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