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 {
2022-06-07 18:13:55 +08:00
Other
2022-06-06 21:48:53 +08:00
Reader
Writer
2022-06-07 18:13:55 +08:00
}
type Other interface {
Config() Config
Init(ctx context.Context, account model.Account) error
Update(ctx context.Context, account model.Account) error
Drop(ctx context.Context) error
// GetAccount transform additional field to string and assign to account's addition
GetAccount() model.Account
2022-06-06 21:48:53 +08:00
}
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
}