2022-05-09 12:52:18 +00:00
|
|
|
package s3
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
2022-05-10 10:49:34 +00:00
|
|
|
|
|
|
|
"git.kapelle.org/niklas/s3share/internal/types"
|
2022-05-09 12:52:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ObjectReader interface {
|
|
|
|
io.Reader
|
|
|
|
io.Seeker
|
|
|
|
io.ReaderAt
|
|
|
|
io.Closer
|
|
|
|
}
|
|
|
|
|
|
|
|
type S3 interface {
|
2022-06-01 09:55:57 +00:00
|
|
|
// Get the object from the S3 bucket. Returns an error if the object does not exist.
|
2022-05-09 12:52:18 +00:00
|
|
|
GetObject(ctx context.Context, key string) (ObjectReader, error)
|
2022-06-01 09:55:57 +00:00
|
|
|
|
|
|
|
// Check if the given key exists
|
2022-05-09 13:24:42 +00:00
|
|
|
KeyExists(ctx context.Context, key string) (bool, error)
|
2022-06-01 09:55:57 +00:00
|
|
|
|
|
|
|
// Get object metadata. The `Filename` field is optional. Returns nil if the object does not exist.
|
2022-05-10 10:49:34 +00:00
|
|
|
GetObjectMetadata(ctx context.Context, key string) (*types.Metadata, error)
|
2022-05-09 12:52:18 +00:00
|
|
|
}
|