drivercommon

package
v0.0.0-...-084929d Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSize128KIB = 128 * 1024
	BlockSize256KIB = 256 * 1024
	BlockSize512KIB = 512 * 1024
	BlockSize1MIB   = 1 * 1024 * 1024
	BlockSize2MIB   = 2 * 1024 * 1024
	BlockSize4MIB   = 4 * 1024 * 1024
	BlockSize8MIB   = 8 * 1024 * 1024
	BlockSize16MIB  = 16 * 1024 * 1024
	BlockSize32MIB  = 32 * 1024 * 1024
)

Variables

View Source
var (
	ErrNoFindDriver     = errors.New("不存在驱动")
	ErrNoSuperEncoder   = errors.New("不支持编码器")
	ErrLoginFail        = errors.New("登陆失败")
	ErrNoSuperBlockSize = errors.New("分块大小不支持")
)
View Source
var (
	ErrApiFailure = errors.New("api失效")

	ErrQRCodeGetFail = errors.New("二维码获取失败")
	ErrQRCodeFailure = errors.New("二维码失效")
)
View Source
var (
	ErrMetaUrlFailure = errors.New("metaUrl失效")
)

Functions

This section is empty.

Types

type DriverOption

type DriverOption struct {
	Timeout time.Duration // 超时时间

	Attempt     int           // 重试次数
	WaitTime    time.Duration // 重试等待时间
	MaxWaitTime time.Duration // 重试最长等待时间

	Encoder encodercommon.EncoderPlugin // 编码器

	Crypto cryptocommon.CryptoPlugin // 加密器
}

func (*DriverOption) SetOption

func (b *DriverOption) SetOption(options ...Option) error

type DriverPlugin

type DriverPlugin interface {
	DriverPluginInfo                   // driver信息
	SetOption(options ...Option) error // 设置配置
	DriverPluginAction
}

* * 驱动的插件

type DriverPluginAction

type DriverPluginAction interface {
	Upload(ctx context.Context, data []byte) (metaurl string, err error)   //上传数据
	Download(ctx context.Context, metaurl string) (data []byte, err error) //下载数据
	CheckUrl(ctx context.Context, metaurl string) bool                     // 检查链接是否失效
	UploadUsable() bool                                                    //是否可以上传
	DownloadUsable() bool                                                  //是否可以下载
}

type DriverPluginInfo

type DriverPluginInfo interface {
	Name() string           //名称
	MaxSize() int           //支持最大大小
	SuperEncoder() []string //支持的编码方式
	SpaceSize() SpaceSize   // [0]总空间 [1]使用空间
}

驱动信息

type DriverPluginLogin

type DriverPluginLogin interface {
	IsLogin() bool
	SetAuthorization(auto string) error // 设置授权
}

type EmailLogin

type EmailLogin interface {
	DriverPluginLogin
	EmailLogin(ctx context.Context, show func(ctx context.Context, image image.Image) (string, error)) (auto string, err error)
}

邮箱登陆

type Option

type Option interface {
	Apply(*DriverOption) error
}

func WithAttempt

func WithAttempt(t int) Option

func WithCrypto

func WithCrypto(t cryptocommon.CryptoPlugin) Option

func WithEncoder

func WithEncoder(t encodercommon.EncoderPlugin) Option

func WithMaxWaitTime

func WithMaxWaitTime(t time.Duration) Option

func WithTimeout

func WithTimeout(t time.Duration) Option

func WithWaitTime

func WithWaitTime(t time.Duration) Option

type QRCodeLogin

type QRCodeLogin interface {
	DriverPluginLogin
	QrcodeLogin(ctx context.Context, show func(ctx context.Context, image image.Image) error) (auto string, err error)
}

二维码登陆

type SpaceSize

type SpaceSize struct {
	Total int64
	Usage int64
}

空间大小

Jump to

Keyboard shortcuts

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