chore: move some types to model
This commit is contained in:
@ -2,6 +2,7 @@ package driver
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
)
|
||||
|
||||
@ -28,8 +29,8 @@ type Other interface {
|
||||
}
|
||||
|
||||
type Reader interface {
|
||||
List(ctx context.Context, path string) ([]FileInfo, error)
|
||||
Link(ctx context.Context, path string, args LinkArgs) (*Link, error)
|
||||
List(ctx context.Context, path string) ([]model.FileInfo, error)
|
||||
Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, error)
|
||||
//Get(ctx context.Context, path string) (FileInfo, error) // maybe not need
|
||||
}
|
||||
|
||||
@ -39,5 +40,5 @@ type Writer interface {
|
||||
Rename(ctx context.Context, srcPath, dstName string) error
|
||||
Copy(ctx context.Context, srcPath, dstPath string) error
|
||||
Remove(ctx context.Context, path string) error
|
||||
Put(ctx context.Context, parentPath string, stream FileStream) error
|
||||
Put(ctx context.Context, parentPath string, stream model.FileStreamer) error
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
package driver
|
||||
|
||||
import (
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
type FileInfo interface {
|
||||
GetSize() uint64
|
||||
GetName() string
|
||||
ModTime() time.Time
|
||||
IsDir() bool
|
||||
}
|
||||
|
||||
type FileStream interface {
|
||||
io.ReadCloser
|
||||
FileInfo
|
||||
GetMimetype() string
|
||||
}
|
||||
|
||||
type URL interface {
|
||||
URL() string
|
||||
}
|
||||
|
||||
type Thumbnail interface {
|
||||
Thumbnail() string
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package driver
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LinkArgs struct {
|
||||
IP string
|
||||
Header http.Header
|
||||
}
|
||||
|
||||
type Link struct {
|
||||
URL string
|
||||
Header http.Header // needed header
|
||||
Data io.ReadCloser // return file reader directly
|
||||
Status int // status maybe 200 or 206, etc
|
||||
FilePath string // local file, return the filepath
|
||||
Expiration *time.Duration // url expiration time
|
||||
}
|
Reference in New Issue
Block a user