mirror of
https://github.com/get-drexa/drive.git
synced 2025-12-06 16:21:39 +00:00
feat: impl files endpoints
This commit is contained in:
@@ -10,11 +10,21 @@ type UploadURLOptions struct {
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
type DownloadURLOptions struct {
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
type UpdateOptions struct {
|
||||
ContentType string
|
||||
}
|
||||
|
||||
type Store interface {
|
||||
// SupportsDirectUpload returns true if the store allows files to be uploaded directly to the blob store.
|
||||
SupportsDirectUpload() bool
|
||||
|
||||
// SupportsDirectDownload returns true if the store allows files to be downloaded directly from the blob store.
|
||||
SupportsDirectDownload() bool
|
||||
|
||||
Initialize(ctx context.Context) error
|
||||
Put(ctx context.Context, key Key, reader io.Reader) error
|
||||
Update(ctx context.Context, key Key, opts UpdateOptions) error
|
||||
@@ -25,9 +35,9 @@ type Store interface {
|
||||
ReadRange(ctx context.Context, key Key, offset, length int64) (io.ReadCloser, error)
|
||||
ReadSize(ctx context.Context, key Key) (int64, error)
|
||||
|
||||
// SupportsDirectUpload returns true if the store allows files to be uploaded directly to the blob store.
|
||||
SupportsDirectUpload() bool
|
||||
|
||||
// GenerateUploadURL generates a URL that can be used to upload a file directly to the blob store. If unsupported, returns an empty string with no error.
|
||||
GenerateUploadURL(ctx context.Context, key Key, opts UploadURLOptions) (string, error)
|
||||
|
||||
// GenerateDownloadURL generates a URL that can be used to download a file directly from the blob store. If unsupported, returns an empty string with no error.
|
||||
GenerateDownloadURL(ctx context.Context, key Key, opts DownloadURLOptions) (string, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user