feat(url-tree): support url tree driver writing (#7779 close #5166)

* feat: support url tree writing

* fix: meta writable

* feat: disable writable via addition
This commit is contained in:
KirCute_ECT
2025-01-10 20:50:56 +08:00
committed by GitHub
parent 25b4b55ee1
commit 51bcf83511
8 changed files with 338 additions and 15 deletions

View File

@ -80,6 +80,13 @@ type Put interface {
Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up UpdateProgress) error
}
type PutURL interface {
// PutURL directly put a URL into the storage
// Applicable to index-based drivers like URL-Tree or drivers that support uploading files as URLs
// Called when using SimpleHttp for offline downloading, skipping creating a download task
PutURL(ctx context.Context, dstDir model.Obj, name, url string) error
}
//type WriteResult interface {
// MkdirResult
// MoveResult
@ -109,6 +116,13 @@ type PutResult interface {
Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up UpdateProgress) (model.Obj, error)
}
type PutURLResult interface {
// PutURL directly put a URL into the storage
// Applicable to index-based drivers like URL-Tree or drivers that support uploading files as URLs
// Called when using SimpleHttp for offline downloading, skipping creating a download task
PutURL(ctx context.Context, dstDir model.Obj, name, url string) (model.Obj, error)
}
type UpdateProgress func(percentage float64)
type Progress struct {