feat: torrent seed config (#599)

This commit is contained in:
Levi authored and GitHub committed 2024-07-30 12:50:06 +08:00
1 parent 473c58796c
commit 3b50465708
22 files changed
+456 -144

No files matched your search

+11 -4
View File
@@ -7,11 +7,8 @@ import (
)
// Fetcher defines the interface for a download protocol.
// One fetcher for each download task
// Each download task will have a corresponding Fetcher instance for the management of the download task
type Fetcher interface {
// Name return the name of the protocol.
Name() string
Setup(ctl *controller.Controller)
// Resolve resource info from request
Resolve(req *base.Request) error
@@ -31,6 +28,12 @@ type Fetcher interface {
Wait() error
}
type Uploader interface {
Upload() error
UploadedBytes() int64
WaitUpload() error
}
// FetcherMeta defines the meta information of a fetcher.
type FetcherMeta struct {
Req *base.Request `json:"req"`
@@ -70,11 +73,15 @@ func (m *FetcherMeta) RootDirPath() string {
// FetcherBuilder defines the interface for a fetcher builder.
type FetcherBuilder interface {
// Name return the name of the protocol.
Name() string
// Schemes returns the schemes supported by the fetcher.
Schemes() []string
// Build returns a new fetcher.
Build() Fetcher
// DefaultConfig returns the default configuration of the protocol.
DefaultConfig() any
// Store fetcher
Store(fetcher Fetcher) (any, error)
// Restore fetcher