first
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package media
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
)
|
||||
|
||||
// Storage is the pluggable backend that actually persists uploaded bytes.
|
||||
// The service/handler layers never know whether files end up on local disk
|
||||
// or in an S3 bucket -- only main.go decides which implementation to wire
|
||||
// in, based on MEDIA_STORAGE_DRIVER.
|
||||
type Storage interface {
|
||||
// Save persists the content under the given key and returns the
|
||||
// publicly reachable URL for it.
|
||||
Save(ctx context.Context, key string, reader io.Reader, size int64, contentType string) (url string, err error)
|
||||
// Delete removes the object identified by key. Deleting a
|
||||
// already-removed key must not be treated as an error.
|
||||
Delete(ctx context.Context, key string) error
|
||||
}
|
||||
Reference in New Issue
Block a user