2022-06-06 13:48:53 +00:00
|
|
|
package driver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-06-15 10:06:42 +00:00
|
|
|
|
2022-06-06 14:54:03 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/model"
|
2022-06-06 13:48:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Driver interface {
|
2022-06-07 14:02:41 +00:00
|
|
|
Meta
|
2022-06-06 13:48:53 +00:00
|
|
|
Reader
|
|
|
|
Writer
|
2022-06-07 14:02:41 +00:00
|
|
|
Other
|
2022-06-07 10:13:55 +00:00
|
|
|
}
|
|
|
|
|
2022-06-07 14:02:41 +00:00
|
|
|
type Meta interface {
|
2022-06-07 10:13:55 +00:00
|
|
|
Config() Config
|
2022-06-09 09:11:46 +00:00
|
|
|
// Init If already initialized, drop first
|
|
|
|
// need to unmarshal string to addition first
|
2022-06-07 10:13:55 +00:00
|
|
|
Init(ctx context.Context, account model.Account) error
|
|
|
|
Drop(ctx context.Context) error
|
2022-06-09 09:11:46 +00:00
|
|
|
// GetAccount just get raw account
|
2022-06-07 10:13:55 +00:00
|
|
|
GetAccount() model.Account
|
2022-06-08 08:20:58 +00:00
|
|
|
GetAddition() Additional
|
2022-06-06 13:48:53 +00:00
|
|
|
}
|
|
|
|
|
2022-06-07 14:02:41 +00:00
|
|
|
type Other interface {
|
|
|
|
Other(ctx context.Context, data interface{}) (interface{}, error)
|
|
|
|
}
|
|
|
|
|
2022-06-06 13:48:53 +00:00
|
|
|
type Reader interface {
|
2022-06-15 10:06:42 +00:00
|
|
|
List(ctx context.Context, path string) ([]model.FileInfo, error)
|
|
|
|
Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, error)
|
2022-06-11 06:43:03 +00:00
|
|
|
//Get(ctx context.Context, path string) (FileInfo, error) // maybe not need
|
2022-06-06 13:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Writer interface {
|
|
|
|
MakeDir(ctx context.Context, path string) error
|
2022-06-10 13:00:51 +00:00
|
|
|
Move(ctx context.Context, srcPath, dstPath string) error
|
|
|
|
Rename(ctx context.Context, srcPath, dstName string) error
|
|
|
|
Copy(ctx context.Context, srcPath, dstPath string) error
|
2022-06-06 13:48:53 +00:00
|
|
|
Remove(ctx context.Context, path string) error
|
2022-06-15 10:06:42 +00:00
|
|
|
Put(ctx context.Context, parentPath string, stream model.FileStreamer) error
|
2022-06-06 13:48:53 +00:00
|
|
|
}
|