Documentation ¶
Index ¶
- Constants
- Variables
- func NewDataReader(c core.Ctx, h core.Handler, bktID int64, d *core.DataInfo, endecKey string) *dataReader
- type Config
- type DummyArchiver
- type Fanout
- func (c *Fanout) Close() error
- func (c *Fanout) Do(ctx core.Ctx, f func(ctx core.Ctx)) (err error)
- func (c *Fanout) DoRetry(ctx core.Ctx, f func(ctx core.Ctx) error, maxRetry int) (err error)
- func (c *Fanout) DoWait(ctx core.Ctx, f func(ctx core.Ctx), timeout time.Duration) (err error)
- func (c *Fanout) DoWhen(ctx core.Ctx, f func(ctx core.Ctx), cond bool) (err error)
- func (c *Fanout) MustDo(ctx core.Ctx, f func(ctx core.Ctx)) (err error)
- func (c *Fanout) Shutdown(timeout time.Duration)
- func (c *Fanout) TunePool(n int)
- func (c *Fanout) TuneWorker(n int)
- func (c *Fanout) Wait() error
- type Option
- type OrcasSDK
- type OrcasSDKImpl
- func (osi *OrcasSDKImpl) Close()
- func (osi *OrcasSDKImpl) Download(c core.Ctx, bktID, id int64, lpath string) error
- func (osi *OrcasSDKImpl) H() core.Handler
- func (osi *OrcasSDKImpl) ID2Path(c core.Ctx, bktID, id int64) (rpath string, err error)
- func (osi *OrcasSDKImpl) Login(cfg Config) (core.Ctx, *core.UserInfo, []*core.BucketInfo, error)
- func (osi *OrcasSDKImpl) Path2ID(c core.Ctx, bktID, pid int64, rpath string) (int64, error)
- func (osi *OrcasSDKImpl) Upload(c core.Ctx, bktID, pid int64, lpath string) error
Constants ¶
View Source
const ( UPLOAD_DATA = 1 << iota CRC32_MD5 HDR_CRC32 )
View Source
const ( PKG_ALIGN = 4096 PKG_SIZE = 4194304 HDR_SIZE = 102400 )
View Source
const ( OFF = iota // OFF FULL // 整个文件读取 FAST // 头部检查成功再整个文件读取 )
秒传级别设置 对应 Config.RefLevel
View Source
const ( COVER = iota // 合并或覆盖 RENAME // 重命名 THROW // 报错 SKIP // 跳过 )
同名冲突解决方式
View Source
const PathSeparator = "/"
Variables ¶
View Source
var ( // ErrFull chan full. ErrFull = errors.New("fanout: chan full") ErrTimeout = errors.New("fanout: chan full, wait timeout") )
Functions ¶
Types ¶
type Config ¶
type Config struct { UserName string // 用户名 Password string // 密码 DataSync bool // 断电保护策略(Power-off Protection Policy),强制每次写入数据后刷到磁盘 RefLevel uint32 // 秒传级别设置:OFF(默认) / FULL: Ref / FAST: TryRef+Ref PkgThres uint32 // 打包个数限制,不设置默认1000个 WiseCmpr uint32 // 智能压缩,根据文件类型决定是否压缩,取值见core.DATA_CMPR_MASK CmprQlty uint32 // 压缩级别,br:[0,11],gzip:[-3,9],zstd:[0,10] EndecWay uint32 // 加密方式,取值见core.DATA_ENDEC_MASK EndecKey string // 加密KEY,SM4需要固定为16个字符,AES256需要大于16个字符 DontSync string // 不同步的文件名通配符(https://pkg.go.dev/path/filepath#Match),用分号分隔 Conflict uint32 // 同名冲突解决方式,COVER:合并或覆盖 / RENAME:重命名 / THROW:报错 / SKIP:跳过 NameTmpl string // 重命名尾巴,"%s的副本" WorkersN uint32 // 并发池大小,不小于16 }
type DummyArchiver ¶
type DummyArchiver struct{}
func (DummyArchiver) CheckExt ¶
func (DummyArchiver) CheckExt(string) error
func (DummyArchiver) Decompress ¶
type Fanout ¶
type Fanout struct {
// contains filtered or unexported fields
}
Fanout async consume data from chan.
func (*Fanout) DoRetry ¶
DoRetry Auto retry call func with back off, if return err Notice: no retry if panic
func (*Fanout) TuneWorker ¶
TuneWorker Dynamically adjust the worker number
type OrcasSDK ¶
type OrcasSDK interface { H() core.Handler Close() Login(cfg Config) (core.Ctx, *core.UserInfo, []*core.BucketInfo, error) Path2ID(c core.Ctx, bktID, pid int64, rpath string) (id int64, err error) ID2Path(c core.Ctx, bktID, id int64) (rpath string, err error) Upload(c core.Ctx, bktID, pid int64, lpath string) error Download(c core.Ctx, bktID, pid int64, lpath string) error }
type OrcasSDKImpl ¶
type OrcasSDKImpl struct {
// contains filtered or unexported fields
}
func (*OrcasSDKImpl) Close ¶
func (osi *OrcasSDKImpl) Close()
func (*OrcasSDKImpl) H ¶
func (osi *OrcasSDKImpl) H() core.Handler
func (*OrcasSDKImpl) Login ¶
func (osi *OrcasSDKImpl) Login(cfg Config) (core.Ctx, *core.UserInfo, []*core.BucketInfo, error)
Click to show internal directories.
Click to hide internal directories.