Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Additional ¶
type Additional interface{}
type Config ¶
type Config struct {
Name string `json:"name"`
LocalSort bool `json:"local_sort"`
OnlyLocal bool `json:"only_local"`
OnlyProxy bool `json:"only_proxy"`
NoCache bool `json:"no_cache"`
NoUpload bool `json:"no_upload"`
NeedMs bool `json:"need_ms"` // if need get message from user, such as validate code
DefaultRoot string `json:"default_root"`
CheckStatus bool
}
type Meta ¶
type Meta interface {
Config() Config
// GetStorage just get raw storage, no need to implement, because model.Storage have implemented
GetStorage() *model.Storage
// GetAddition Additional can't be modified externally, so needn't return pointer
GetAddition() Additional
// Init If already initialized, drop first
// need to unmarshal string to addition first
Init(ctx context.Context, storage model.Storage) error
Drop(ctx context.Context) error
}
type Reader ¶
type Reader interface {
// List files in the path
// if identify files by path, need to set ID with path,like path.Join(dir.GetID(), obj.GetName())
// if identify files by id, need to set ID with corresponding id
List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)
// Link get url/filepath/reader of file
Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)
}
type RootPath ¶
type RootPath struct {
RootFolderPath string `json:"root_folder_path"`
}
func (RootPath) GetRootPath ¶
func (*RootPath) SetRootPath ¶
type UpdateProgress ¶
type UpdateProgress func(percentage int)
type Writer ¶
type Writer interface {
// MakeDir make a folder named `dirName` in `parentDir`
MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error
// Move `srcObject` to `dstDir`
Move(ctx context.Context, srcObj, dstDir model.Obj) error
// Rename rename `srcObject` to `newName`
Rename(ctx context.Context, srcObj model.Obj, newName string) error
// Copy `srcObject` to `dstDir`
Copy(ctx context.Context, srcObj, dstDir model.Obj) error
// Remove remove `object`
Remove(ctx context.Context, obj model.Obj) error
// Put upload `stream` to `parentDir`
Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up UpdateProgress) error
}
Click to show internal directories.
Click to hide internal directories.