s3

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketMetrics

type BucketMetrics struct {
	Objects                       uint64
	ObjectsReadable               string
	ObjectsSize                   uint64
	ObjectsSizeReadable           string
	IncompleteObjects             uint64
	IncompleteObjectsReadable     string
	IncompleteObjectsSize         uint64
	IncompleteObjectsSizeReadable string
}

type S3AO

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

func Init

func Init(endpoint, bucket, region, accessKey, secretKey string, secure bool, presignExpiry, timeout, transferTimeout time.Duration) (S3AO, error)

Initialize S3AO

func (S3AO) CopyObject

func (s S3AO) CopyObject(srcKey, dstKey string) error

CopyObject copies an object from one key to another within the same bucket

func (S3AO) GetBucket

func (s S3AO) GetBucket() string

GetBucket returns the bucket name

func (S3AO) GetBucketMetrics

func (s S3AO) GetBucketMetrics() (metrics BucketMetrics)

func (S3AO) GetClient

func (s S3AO) GetClient() *s3.Client

GetClient returns the underlying S3 client (for advanced operations)

func (S3AO) GetObject

func (s S3AO) GetObject(contentSHA256 string, start int64, end int64) (io.ReadCloser, error)

func (S3AO) GetObjectKey

func (s S3AO) GetObjectKey(bin string, filename string) (key string)

func (S3AO) GetObjectURL

func (s S3AO) GetObjectURL(contentSHA256 string) string

GetObjectURL returns the full S3 URL for a content SHA256

func (S3AO) ListObjects

func (s S3AO) ListObjects() (objects []string, err error)

func (S3AO) ListObjectsWithPrefix

func (s S3AO) ListObjectsWithPrefix(prefix string) ([]types.Object, error)

ListObjectsWithPrefix lists objects with a given prefix

func (S3AO) PresignedGetObject

func (s S3AO) PresignedGetObject(contentSHA256 string, filename string, mime string, clientIP string) (presignedURL *url.URL, err error)

PresignedGetObject generates a presigned URL for downloading an object. If clientIP is provided, the URL will require the X-Forwarded-For header to be set to that value when making the request (the header is included in the signature). This only works with objects that are not encrypted.

func (S3AO) PutObject

func (s S3AO) PutObject(bin string, filename string, data io.Reader, size int64) (err error)

func (S3AO) PutObjectByHash

func (s S3AO) PutObjectByHash(contentSHA256 string, data io.Reader, size int64) (err error)

PutObjectByHash uploads an object using content-addressable storage (SHA256 as key)

func (S3AO) RemoveBucket

func (s S3AO) RemoveBucket() error

func (S3AO) RemoveKey

func (s S3AO) RemoveKey(key string) error

func (S3AO) RemoveObject

func (s S3AO) RemoveObject(bin string, filename string) error

func (S3AO) RemoveObjectByHash

func (s S3AO) RemoveObjectByHash(contentSHA256 string) error

RemoveObjectByHash removes an object using content-addressable storage (SHA256 as key)

func (S3AO) SetTrace

func (s S3AO) SetTrace(trace bool)

func (S3AO) StatObject

func (s S3AO) StatObject(key string) (*s3.HeadObjectOutput, error)

StatObject checks if an object exists and returns its metadata

func (S3AO) Status

func (s S3AO) Status() bool

Jump to

Keyboard shortcuts

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