Documentation
¶
Index ¶
- func IsNoSuchKey(err error) bool
- type Client
- type Config
- type ErrS3Operation
- type MultiReader
- type S3Client
- func (c *S3Client) Download(ctx context.Context, key string) ([]byte, error)
- func (c *S3Client) DownloadRange(ctx context.Context, key string, start, end int64) ([]byte, error)
- func (c *S3Client) ObjectExists(ctx context.Context, key string) (bool, error)
- func (c *S3Client) ObjectSize(ctx context.Context, key string) (int64, error)
- func (c *S3Client) Upload(ctx context.Context, key string, data []byte) error
- func (c *S3Client) UploadReader(ctx context.Context, key string, reader io.ReaderAt, size int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNoSuchKey ¶
IsNoSuchKey checks if the error is a missing object error.
Types ¶
type Client ¶
type Client interface {
Upload(ctx context.Context, key string, data []byte) error
UploadReader(ctx context.Context, key string, reader io.ReaderAt, size int64) error
Download(ctx context.Context, key string) ([]byte, error)
DownloadRange(ctx context.Context, key string, start, end int64) ([]byte, error)
ObjectExists(ctx context.Context, key string) (bool, error)
ObjectSize(ctx context.Context, key string) (int64, error)
}
Client interface abstracts S3 operations for easier testing and mocking This matches the previous AWS SDK based implementation.
type Config ¶
type Config struct {
Bucket string // S3 bucket name (required)
Region string // AWS region (required for mock)
Prefix string // S3 key prefix (optional)
Service string // S3 service (optional)
Key *aws.SigningKey // Optional signing key
}
Config represents the S3-specific configuration.
type ErrS3Operation ¶
ErrS3Operation represents an S3 operation error.
func (ErrS3Operation) Error ¶
func (e ErrS3Operation) Error() string
func (ErrS3Operation) Unwrap ¶
func (e ErrS3Operation) Unwrap() error
type MultiReader ¶
type MultiReader struct {
// contains filtered or unexported fields
}
MultiReader implements io.ReaderAt for multiple byte slices concatenated together. This avoids expensive memory allocations and copies when combining multiple data sources.
func NewMultiReader ¶
func NewMultiReader(sections ...[]byte) *MultiReader
NewMultiReader creates a new MultiReaderAt from multiple byte slices.
func (*MultiReader) Read ¶
func (m *MultiReader) Read(p []byte) (n int, err error)
Read implements io.Reader interface for compatibility.
func (*MultiReader) ReadAt ¶
func (m *MultiReader) ReadAt(p []byte, off int64) (n int, err error)
ReadAt implements io.ReaderAt interface.
func (*MultiReader) Size ¶
func (m *MultiReader) Size() int64
Size returns the total size of all sections combined.
type S3Client ¶
type S3Client struct {
// contains filtered or unexported fields
}
S3Client wraps the kelindar/s3 bucket with convenience methods.
func (*S3Client) DownloadRange ¶
DownloadRange downloads a byte range from S3.
func (*S3Client) ObjectExists ¶
ObjectExists checks if an object exists.
func (*S3Client) ObjectSize ¶
ObjectSize returns the size of an object.