awsutil

package
v0.0.0-...-d09764e Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// S3Concurrency parallels parts download/upload limit
	S3Concurrency = 5
	// S3PartSize size of part to download/upload
	S3PartSize = 5 * 1024 * 1024
	// S3PartLeaveError leaves parts to manual resolve errors on uploads
	S3PartLeaveError = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomReader

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

CustomReader contains the details of Chunks being downloaded

func (*CustomReader) Read

func (r *CustomReader) Read(p []byte) (int, error)

func (*CustomReader) ReadAt

func (r *CustomReader) ReadAt(p []byte, off int64) (int, error)

func (*CustomReader) Seek

func (r *CustomReader) Seek(offset int64, whence int) (int64, error)

type CustomWriter

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

func (*CustomWriter) Seek

func (r *CustomWriter) Seek(offset int64, whence int) (int64, error)

func (*CustomWriter) Write

func (r *CustomWriter) Write(p []byte) (int, error)

func (*CustomWriter) WriteAt

func (r *CustomWriter) WriteAt(p []byte, off int64) (int, error)

type S3ctx

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

func NewAwsCtx

func NewAwsCtx(id, secret, region string, useIPv6 bool, endpointOverride string, hctx *http.Client) (*S3ctx, error)

NewAwsCtx initializes AWS S3 context using SDK v2

func (*S3ctx) CompleteUploadedParts

func (s *S3ctx) CompleteUploadedParts(bname, bkey, uploadID string, parts []string) error

CompleteUploadedParts is used to complete the multiple uploaded parts

func (*S3ctx) CreateBucket

func (s *S3ctx) CreateBucket(bname string) error

CreateBucket creates a new S3 bucket

func (*S3ctx) DeleteBucket

func (s *S3ctx) DeleteBucket(bname string) error

DeleteBucket deletes an S3 bucket

func (*S3ctx) DeleteObject

func (s *S3ctx) DeleteObject(bname, bkey string) error

DeleteObject removes an object from a bucket

func (*S3ctx) DownloadFile

func (s *S3ctx) DownloadFile(fname, bname, bkey string,
	objMaxSize int64, doneParts types.DownloadedParts, prgNotify types.StatsNotifChan) (types.DownloadedParts, error)

func (*S3ctx) DownloadFileByChunks

func (s *S3ctx) DownloadFileByChunks(fname, bname, bkey string) (io.ReadCloser, int64, error)

DownloadFileByChunks downloads the file from s3 chunk by chunk and passes it to the caller

func (*S3ctx) GetObjectMD5

func (s *S3ctx) GetObjectMD5(bname, bkey string) (string, error)

GetObjectMD5 retrieves the ETag (often MD5) of an object

func (*S3ctx) GetObjectMetaData

func (s *S3ctx) GetObjectMetaData(bname, bkey string) (int64, string, error)

func (*S3ctx) GetObjectSize

func (s *S3ctx) GetObjectSize(bname, bkey string) (int64, error)

GetObjectSize retrieves the size (ContentLength) of an object

func (*S3ctx) GetObjectURL

func (s *S3ctx) GetObjectURL(bname, bkey string) (string, error)

GetObjectURL generates a pre-signed GET URL valid for 1 minute

func (*S3ctx) GetSignedURL

func (s *S3ctx) GetSignedURL(bname, bkey string, duration time.Duration) (string, error)

GetSignedURL is used to generate the URI which can be used to access the resource until the URI expries

func (*S3ctx) IsBucketAvailable

func (s *S3ctx) IsBucketAvailable(bname string) (bool, error)

IsBucketAvailable checks if a bucket exists in the account

func (*S3ctx) ListImages

func (s *S3ctx) ListImages(bname string, prgNotify types.StatsNotifChan) ([]string, error)

func (*S3ctx) UploadFile

func (s *S3ctx) UploadFile(fname, bname, bkey string, compression bool, prgNotify types.StatsNotifChan) (string, error)

func (*S3ctx) UploadPart

func (s *S3ctx) UploadPart(bname, bkey string, chunk []byte, partNumber int64, uploadID string) (string, string, error)

UploadPart is used to upload the given chunk of data into the Multipart file

func (*S3ctx) WaitUntilBucketExists

func (s *S3ctx) WaitUntilBucketExists(bname string) bool

WaitUntilBucketExists waits until the bucket exists or times out

func (*S3ctx) WithContext

func (s *S3ctx) WithContext(ctx context.Context) *S3ctx

WithContext sets a custom context (e.g., for cancellation)

func (*S3ctx) WithLogger

func (s *S3ctx) WithLogger(logger types.Logger) *S3ctx

WithLogger attaches a logger

Jump to

Keyboard shortcuts

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