s3browser-backend/internal/s3/s3.go

38 lines
874 B
Go
Raw Permalink Normal View History

package s3
import (
"context"
"io"
2021-11-23 19:12:24 +00:00
"time"
"git.kapelle.org/niklas/s3browser/internal/types"
)
2021-11-23 19:12:24 +00:00
type ObjectReader interface {
io.Reader
io.Seeker
io.ReaderAt
io.Closer
}
2021-11-23 19:12:24 +00:00
type Object struct {
ID types.ID
Size int64
LastModified time.Time
ContentType string
ETag string
}
type S3Service interface {
2021-11-23 19:12:24 +00:00
ListBuckets(ctx context.Context) ([]string, error)
2021-11-23 19:12:24 +00:00
GetObject(ctx context.Context, id types.ID) (ObjectReader, error)
PutObject(ctx context.Context, id types.ID, reader io.Reader, objectSize int64) error
2021-11-23 19:12:24 +00:00
ListObjects(ctx context.Context, id types.ID) ([]Object, error)
ListObjectsRecursive(ctx context.Context, id types.ID) ([]Object, error)
CopyObject(ctx context.Context, src types.ID, dest types.ID) error
2021-11-23 19:12:24 +00:00
StatObject(ctx context.Context, id types.ID) (*Object, error)
RemoveObject(ctx context.Context, id types.ID) error
}