driver

package
v0.4.3-alpha3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

* @Author: a624669980@163.com a624669980@163.com * @Date: 2022-12-13 11:05:05 * @LastEditors: a624669980@163.com a624669980@163.com * @LastEditTime: 2022-12-13 11:05:13 * @FilePath: /drive/internal/driver/config.go * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE

* @Author: a624669980@163.com a624669980@163.com * @Date: 2022-12-13 11:05:47 * @LastEditors: a624669980@163.com a624669980@163.com * @LastEditTime: 2022-12-13 11:05:54 * @FilePath: /drive/internal/driver/item.go * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE

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
}

func (Config) MustProxy

func (c Config) MustProxy() bool

type Copy

type Copy interface {
	Copy(ctx context.Context, srcObj, dstDir model.Obj) error
}

type CopyResult

type CopyResult interface {
	Copy(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)
}

type Driver

type Driver interface {
	Meta
	Reader
	User
}

type Getter

type Getter interface {
	GetRoot(ctx context.Context) (model.Obj, error)
}

type IRootId

type IRootId interface {
	GetRootId() string
}

type IRootPath

type IRootPath interface {
	GetRootPath() string
}

type Info

type Info struct {
	Common     []Item `json:"common"`
	Additional []Item `json:"additional"`
	Config     Config `json:"config"`
}

type Item

type Item struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Default  string `json:"default"`
	Options  string `json:"options"`
	Required bool   `json:"required"`
	Help     string `json:"help"`
}

type Meta

type Meta interface {
	Config() Config
	// GetStorage just get raw storage, no need to implement, because model.Storage have implemented
	GetStorage() *model.StorageA
	SetStorage(model.StorageA)
	// GetAddition Additional is used for unmarshal of JSON, so need return pointer
	GetAddition() Additional
	// Init If already initialized, drop first
	Init(ctx context.Context) error
	Drop(ctx context.Context) error
}

type Mkdir

type Mkdir interface {
	MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error
}

type MkdirResult

type MkdirResult interface {
	MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error)
}

type Move

type Move interface {
	Move(ctx context.Context, srcObj, dstDir model.Obj) error
}

type MoveResult

type MoveResult interface {
	Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)
}

type Other

type Other interface {
	Other(ctx context.Context, args model.OtherArgs) (interface{}, error)
}

type Progress

type Progress struct {
	Total int64
	Done  int64
	// contains filtered or unexported fields
}

func NewProgress

func NewProgress(total int64, up UpdateProgress) *Progress

func (*Progress) Write

func (p *Progress) Write(b []byte) (n int, err error)

type Put

type Put interface {
	Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up UpdateProgress) error
}

type PutResult

type PutResult interface {
	Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up UpdateProgress) (model.Obj, 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 Remove

type Remove interface {
	Remove(ctx context.Context, obj model.Obj) error
}

type Rename

type Rename interface {
	Rename(ctx context.Context, srcObj model.Obj, newName string) error
}

type RenameResult

type RenameResult interface {
	Rename(ctx context.Context, srcObj model.Obj, newName string) (model.Obj, error)
}

type RootID

type RootID struct {
	RootFolderID string `json:"root_folder_id" omit:"true"`
}

func (RootID) GetRootId

func (r RootID) GetRootId() string

type RootPath

type RootPath struct {
	RootFolderPath string `json:"root_folder_path"`
}

func (RootPath) GetRootPath

func (r RootPath) GetRootPath() string

func (*RootPath) SetRootPath

func (r *RootPath) SetRootPath(path string)

type Select

type Select string

type UpdateProgress

type UpdateProgress func(percentage int)

type User

type User interface {
	// GetRoot get root directory of user
	GetUserInfo(ctx context.Context) (string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL