aws

package
v1.70.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package aws provides an S3 client for AWS

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultClient

type DefaultClient struct {
	// contains filtered or unexported fields
}

DefaultClient is an implementation of the S3Client for AWS

func (*DefaultClient) DeleteObject added in v1.69.0

func (a *DefaultClient) DeleteObject(ctx context.Context, bucket string, key string) error

DeleteObject deletes the object with the given key in the specified bucket

func (*DefaultClient) DownloadObject

func (a *DefaultClient) DownloadObject(ctx context.Context, bucket, key string, buf []byte) (int64, error)

DownloadObject downloads the contents of the object.

func (*DefaultClient) StreamObjects added in v1.69.0

func (a *DefaultClient) StreamObjects(ctx context.Context, bucket, prefix string, objectChan chan *ObjectResults, errChan chan error, doneChan chan struct{})

StreamObjects continuously pulls & batches ObjectInfo from S3 before sending down the objectChan.

type ObjectInfo

type ObjectInfo struct {
	Name string
	Size int64
}

ObjectInfo contains necessary info to process S3 objects

type ObjectResults added in v1.69.0

type ObjectResults struct {
	Objects []*ObjectInfo
}

ObjectResults contain a batch of ObjectInfo

type S3Client

type S3Client interface {
	// StreamObjects continuously pulls & batches ObjectInfo from S3 before sending down the objectChan.
	// Errors are sent down the errChan and stop the process. When no more objects are retrieved from S3, the doneChan is closed.
	StreamObjects(ctx context.Context, bucket, prefix string, objectChan chan *ObjectResults, errChan chan error, doneChan chan struct{})
	// DownloadObject downloads the contents of the object into the buffer.
	DownloadObject(ctx context.Context, bucket, key string, buf []byte) (int64, error)
	// DeleteObject deletes the object with the given key in the specified bucket
	DeleteObject(ctx context.Context, bucket string, key string) error
}

S3Client provides a client for S3 object operations

func NewAWSClient

func NewAWSClient(logger *zap.Logger, region string, pollSize, batchSize int) (S3Client, error)

NewAWSClient creates a new AWS Client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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