mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-10-10 13:03:09 +08:00
893457cd50
* fix(aliyundrive): limit callback concurrency - Share proxy callback admission by Aliyun user identity and hold permits for complete response-body lifetimes. - Retry only verified callback-capacity rejections while preserving direct redirects and server download limiting. - Map exhausted temporary capacity to S3 SlowDown through the merged OpenListTeam gofakes3 module. - Cover shared limits, lifecycle release, cancellation, retry classification, and the S3 HTTP response. Co-authored-by: Codex <267193182+codex@users.noreply.github.com> # Conflicts: # go.mod # go.sum # server/s3/pager.go * fix(op): separate redirect and proxy link cache entries - Include redirect mode in the link cache key for all drivers. - Cover both redirect-to-proxy and proxy-to-redirect cache reuse. Co-authored-by: Codex <267193182+codex@users.noreply.github.com> * fix(proxy): close range bodies before opening next - make ServeHTTP own each range body and preserve cleanup failures - remove the aggregate range closer and pass range readers directly - replace the obsolete callback transport test with focused lifecycle coverage Co-authored-by: Codex <267193182+codex@users.noreply.github.com> --------- Co-authored-by: nostalume <nostalucent@gmail.com> Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
121 lines
2.4 KiB
Go
121 lines
2.4 KiB
Go
package model
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/OpenListTeam/OpenList/v4/pkg/http_range"
|
|
"github.com/OpenListTeam/OpenList/v4/pkg/utils"
|
|
)
|
|
|
|
type ListArgs struct {
|
|
ReqPath string
|
|
S3ShowPlaceholder bool
|
|
Refresh bool
|
|
WithStorageDetails bool
|
|
SkipHook bool
|
|
}
|
|
|
|
type LinkArgs struct {
|
|
IP string
|
|
Header http.Header
|
|
Type string
|
|
Redirect bool
|
|
}
|
|
|
|
type Link struct {
|
|
URL string `json:"url"` // most common way
|
|
Header http.Header `json:"header"` // needed header (for url)
|
|
RangeReader RangeReaderIF `json:"-"` // recommended way if can't use URL
|
|
|
|
Expiration *time.Duration // local cache expiration; not transferred by Clone
|
|
|
|
//for accelerating request, use multi-thread downloading
|
|
Concurrency int `json:"concurrency"`
|
|
PartSize int `json:"part_size"`
|
|
ContentLength int64 `json:"content_length"` // 转码视频、缩略图
|
|
|
|
utils.SyncClosers `json:"-"`
|
|
// 如果SyncClosers中的资源被关闭后Link将不可用,则此值应为 true
|
|
RequireReference bool `json:"-"`
|
|
}
|
|
|
|
// Clone transfers ownership of l without inheriting its cache expiration.
|
|
func (l *Link) Clone() *Link {
|
|
return &Link{
|
|
URL: l.URL,
|
|
Header: l.Header,
|
|
RangeReader: l.RangeReader,
|
|
Concurrency: l.Concurrency,
|
|
PartSize: l.PartSize,
|
|
ContentLength: l.ContentLength,
|
|
SyncClosers: utils.NewSyncClosers(l),
|
|
RequireReference: l.RequireReference,
|
|
}
|
|
}
|
|
|
|
type OtherArgs struct {
|
|
Obj Obj
|
|
Method string
|
|
Data interface{}
|
|
}
|
|
|
|
type FsOtherArgs struct {
|
|
Path string `json:"path" form:"path"`
|
|
Method string `json:"method" form:"method"`
|
|
Data interface{} `json:"data" form:"data"`
|
|
}
|
|
|
|
type ArchiveArgs struct {
|
|
Password string
|
|
LinkArgs
|
|
}
|
|
|
|
type ArchiveInnerArgs struct {
|
|
ArchiveArgs
|
|
InnerPath string
|
|
}
|
|
|
|
type ArchiveMetaArgs struct {
|
|
ArchiveArgs
|
|
Refresh bool
|
|
}
|
|
|
|
type ArchiveListArgs struct {
|
|
ArchiveInnerArgs
|
|
Refresh bool
|
|
}
|
|
|
|
type ArchiveDecompressArgs struct {
|
|
ArchiveInnerArgs
|
|
CacheFull bool
|
|
PutIntoNewDir bool
|
|
Overwrite bool
|
|
}
|
|
|
|
type SharingListArgs struct {
|
|
Refresh bool
|
|
Pwd string
|
|
}
|
|
|
|
type SharingArchiveMetaArgs struct {
|
|
ArchiveMetaArgs
|
|
Pwd string
|
|
}
|
|
|
|
type SharingArchiveListArgs struct {
|
|
ArchiveListArgs
|
|
Pwd string
|
|
}
|
|
|
|
type SharingLinkArgs struct {
|
|
Pwd string
|
|
LinkArgs
|
|
}
|
|
|
|
type RangeReaderIF interface {
|
|
RangeRead(ctx context.Context, httpRange http_range.Range) (io.ReadCloser, error)
|
|
}
|