s3browser-backend/internal/s3/s3.go

38 lines
874 B
Go

package s3
import (
"context"
"io"
"time"
"git.kapelle.org/niklas/s3browser/internal/types"
)
type ObjectReader interface {
io.Reader
io.Seeker
io.ReaderAt
io.Closer
}
type Object struct {
ID types.ID
Size int64
LastModified time.Time
ContentType string
ETag string
}
type S3Service interface {
ListBuckets(ctx context.Context) ([]string, error)
GetObject(ctx context.Context, id types.ID) (ObjectReader, error)
PutObject(ctx context.Context, id types.ID, reader io.Reader, objectSize int64) error
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
StatObject(ctx context.Context, id types.ID) (*Object, error)
RemoveObject(ctx context.Context, id types.ID) error
}