alist/internal/driver/driver.go

37 lines
988 B
Go
Raw Normal View History

2022-06-06 21:48:53 +08:00
package driver
import (
"context"
"github.com/alist-org/alist/v3/internal/model"
2022-06-06 21:48:53 +08:00
)
type Driver interface {
Reader
Writer
Other
}
type Reader interface {
File(ctx context.Context, path string) (*FileInfo, error)
List(ctx context.Context, path string) ([]FileInfo, error)
Link(ctx context.Context, args LinkArgs) (*Link, error)
}
type Writer interface {
MakeDir(ctx context.Context, path string) error
Move(ctx context.Context, src, dst string) error
Rename(ctx context.Context, src, dst string) error
Copy(ctx context.Context, src, dst string) error
Remove(ctx context.Context, path string) error
2022-06-06 22:31:56 +08:00
Put(ctx context.Context, stream FileStream, parentPath string) error
2022-06-06 21:48:53 +08:00
}
type Other interface {
Init(ctx context.Context, account model.Account) error
Update(ctx context.Context, account model.Account) error
2022-06-06 21:48:53 +08:00
Drop(ctx context.Context) error
// GetAccount transform additional field to string and assign to account's addition
GetAccount() model.Account
2022-06-07 16:31:28 +08:00
Config() Config
2022-06-06 21:48:53 +08:00
}