Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyCommonCfgToRW(rw RW, cfg *RWCommonCfg)
- func FileExtFromCompressCfg(c *CompressRWCfg) string
- func NewCmdRWCfg() *cmd.Cfg
- func NewGzipReader(r io.ReadCloser, cfg *CompressRWCfg) io.ReadCloser
- func NewGzipWritter(w io.WriteCloser, cfg *CompressRWCfg) io.WriteCloser
- func NewSnappyReader(r io.ReadCloser, _ *CompressRWCfg) io.ReadCloser
- func NewSnappyWriter(w io.WriteCloser, cfg *CompressRWCfg) io.WriteCloser
- func NewZstdReader(r io.ReadCloser, cfg *CompressRWCfg) io.ReadCloser
- func NewZstdWriter(w io.WriteCloser, cfg *CompressRWCfg) io.WriteCloser
- type Cfg
- type CmdRW
- type CompressLevel
- type CompressRW
- type CompressRWCfg
- type CompressType
- type CopyRW
- type CopyRWCfg
- type FileRW
- type FileRWCfg
- type FtpRW
- type FtpRWCfg
- type NopRW
- type NopRWCfg
- type NullRW
- type NullRWCfg
- type OssRW
- type OssRWCfg
- type Pipeline
- type RW
- type RWCfg
- type RWCommonCfg
- type RWGroup
- type RWGroupCfg
- type RWRole
- type RWType
- type ReadHook
- type Result
- type SSHRW
- type SSHRWCfg
- type TailRW
- type TailRWCfg
- type WriteHook
Constants ¶
View Source
const ( RWTypeCompress RWType = "compress" CompressTypeNop CompressType = "nop" CompressTypeGzip CompressType = "gzip" CompressTypeSnappy CompressType = "snappy" CompressTypeZstd CompressType = "zstd" CompressLevelFast CompressLevel = "fast" CompressLevelBetter CompressLevel = "better" CompressLevelBest CompressLevel = "best" )
View Source
const PluginTypePipeline plugin.Type = "pipeline"
View Source
const PluginTypeRWGroup plugin.Type = "rwgroup"
Variables ¶
View Source
var ( ErrStoppedManually = errors.New("RW stopped manually") ErrChecksumNotMatch = errors.New("checksum not match") CreateBaseRW = newBaseRW )
Functions ¶
func ApplyCommonCfgToRW ¶
func ApplyCommonCfgToRW(rw RW, cfg *RWCommonCfg)
func FileExtFromCompressCfg ¶
func FileExtFromCompressCfg(c *CompressRWCfg) string
func NewCmdRWCfg ¶
func NewGzipReader ¶
func NewGzipReader(r io.ReadCloser, cfg *CompressRWCfg) io.ReadCloser
func NewGzipWritter ¶
func NewGzipWritter(w io.WriteCloser, cfg *CompressRWCfg) io.WriteCloser
func NewSnappyReader ¶
func NewSnappyReader(r io.ReadCloser, _ *CompressRWCfg) io.ReadCloser
func NewSnappyWriter ¶
func NewSnappyWriter(w io.WriteCloser, cfg *CompressRWCfg) io.WriteCloser
func NewZstdReader ¶
func NewZstdReader(r io.ReadCloser, cfg *CompressRWCfg) io.ReadCloser
func NewZstdWriter ¶
func NewZstdWriter(w io.WriteCloser, cfg *CompressRWCfg) io.WriteCloser
Types ¶
type Cfg ¶
type Cfg struct {
RWs []*RWCfg `json:"rws" validate:"required" yaml:"rws"`
}
type CompressLevel ¶
type CompressLevel string
type CompressRW ¶
type CompressRW struct {
RW
*CompressRWCfg
// contains filtered or unexported fields
}
func NewCompressRW ¶
func NewCompressRW() *CompressRW
func (*CompressRW) Close ¶ added in v0.9.10
func (c *CompressRW) Close() error
func (*CompressRW) GetCfg ¶
func (c *CompressRW) GetCfg() interface{}
func (*CompressRW) Init ¶
func (c *CompressRW) Init() error
func (*CompressRW) NestReader ¶
func (c *CompressRW) NestReader(r io.ReadCloser) error
func (*CompressRW) NestWriter ¶
func (c *CompressRW) NestWriter(w io.WriteCloser) error
func (*CompressRW) Type ¶
func (c *CompressRW) Type() interface{}
type CompressRWCfg ¶
type CompressRWCfg struct {
Type CompressType `json:"type" validate:"required" yaml:"type"`
Level CompressLevel `json:"level" validate:"required" yaml:"level"`
Concurrency int `json:"concurrency" yaml:"concurrency"`
}
func NewCompressRWCfg ¶
func NewCompressRWCfg() *CompressRWCfg
type CompressType ¶
type CompressType string
type CopyRWCfg ¶
type CopyRWCfg struct {
BufSize int `json:"bufSize" yaml:"bufSize"`
}
func NewCopyRWCfg ¶
func NewCopyRWCfg() *CopyRWCfg
type FileRWCfg ¶
type FileRWCfg struct {
Path string `json:"path" yaml:"path"`
Perm uint32 `json:"perm" yaml:"perm"`
}
func NewFileRWCfg ¶
func NewFileRWCfg() *FileRWCfg
type FtpRWCfg ¶ added in v0.8.2
type FtpRWCfg struct {
Addr string `json:"addr" validate:"required" yaml:"addr"`
User string `json:"user" validate:"required" yaml:"user"`
Pwd string `json:"pwd" validate:"required" yaml:"pwd"`
Path string `json:"path" validate:"required" yaml:"path"`
Timeout int `json:"timeout" yaml:"timeout"`
Retry int `json:"retry" yaml:"retry"`
}
func NewFtpRWCfg ¶ added in v0.8.2
func NewFtpRWCfg() *FtpRWCfg
type NullRWCfg ¶ added in v0.8.7
type NullRWCfg struct {
}
func NewNullRWCfg ¶ added in v0.8.7
func NewNullRWCfg() *NullRWCfg
type OssRWCfg ¶ added in v0.8.2
type OssRWCfg struct {
URL string `json:"url" validate:"required" yaml:"url"`
Ak string `json:"ak" validate:"required" yaml:"ak"`
Sk string `json:"sk" validate:"required" yaml:"sk"`
Region string `json:"region" yaml:"region"`
Append bool `json:"append" yaml:"append"`
Timeout int `json:"timeout" yaml:"timeout"`
Retry int `json:"retry" yaml:"retry"`
}
func NewOssRWCfg ¶ added in v0.8.2
func NewOssRWCfg() *OssRWCfg
type RW ¶
type RW interface {
runner.Runner
io.ReadWriteCloser
plugin.Plugin
NestReader(io.ReadCloser) error
NestWriter(io.WriteCloser) error
Reader() io.ReadCloser
Writer() io.WriteCloser
Flush() error
HookRead(...ReadHook)
HookWrite(...WriteHook)
Nwrite() uint64
Nread() uint64
Hash() string
EnableMonitorSpeed()
EnableCalcHash(hashAlgo string)
EnableChecksum(checksum string, hashAlgo string)
EnableRateLimit(ratelimit.RxTxRateLimiter)
EnableWriteBuf(bufSize int, deadline int, async bool, asyncChanBufSize int)
EnableReadBuf(bufSize int, async bool, asyncChanBufSize int)
IsAsyncOrDeadline() bool
AsyncChanLen() int
AsyncChanCap() int
AsStarter()
IsStarter() bool
AsReader()
IsReader() bool
AsWriter()
IsWriter() bool
As(RWRole)
Is(RWRole) bool
Role() RWRole
}
type RWCfg ¶
type RWCfg struct {
Type RWType `json:"type" validate:"required" yaml:"type"`
Cfg interface{} `json:"cfg" validate:"required" yaml:"cfg"`
CommonCfg *RWCommonCfg `json:"commonCfg" yaml:"commonCfg"`
Role RWRole `json:"role" validate:"required" yaml:"role"`
}
type RWCommonCfg ¶
type RWCommonCfg struct {
RateLimiterCfg *ratelimit.RateLimiterCfg `json:"rateLimiterCfg" yaml:"rateLimiterCfg"`
BufSize int `json:"bufSize" yaml:"bufSize"`
Deadline int `json:"deadline" yaml:"deadline"`
AsyncChanBufSize int `json:"asyncChanBufSize" yaml:"asyncChanBufSize"`
EnableMonitorSpeed bool `json:"enableMonitorSpeed" yaml:"enableMonitorSpeed"`
EnableCalcHash bool `json:"enableCalcHash" yaml:"enableCalcHash"`
EnableRateLimit bool `json:"enableRateLimit" yaml:"enableRateLimit"`
EnableAsync bool `json:"enableAsync" yaml:"enableAsync"`
Checksum string `json:"checksum" yaml:"checksum"`
HashAlgo string `json:"hashAlgo" yaml:"hashAlgo"`
}
type RWGroup ¶
type RWGroup struct {
runner.Runner
*RWGroupCfg
// contains filtered or unexported fields
}
func NewRWGroup ¶
func NewRWGroup() *RWGroup
func (*RWGroup) FirstReader ¶
func (*RWGroup) LastWriter ¶
type RWGroupCfg ¶
type RWGroupCfg struct {
Readers []*RWCfg `json:"readers" yaml:"readers"`
Starter *RWCfg `json:"starter" yaml:"starter"`
Writers []*RWCfg `json:"writers" yaml:"writers"`
}
func NewRWGroupCfg ¶
func NewRWGroupCfg() *RWGroupCfg
func (*RWGroupCfg) FromReader ¶
func (c *RWGroupCfg) FromReader(typ RWType, cfg interface{}, commonCfg *RWCommonCfg) *RWGroupCfg
func (*RWGroupCfg) SetStarter ¶
func (c *RWGroupCfg) SetStarter(typ RWType, cfg interface{}, commonCfg *RWCommonCfg) *RWGroupCfg
func (*RWGroupCfg) ToWriter ¶
func (c *RWGroupCfg) ToWriter(typ RWType, cfg interface{}, commonCfg *RWCommonCfg) *RWGroupCfg
type RWType ¶
type RWType string
const RWTypeCmd RWType = "cmd"
const RWTypeCopy RWType = "copy"
const RWTypeFile RWType = "file"
const (
RWTypeFtp RWType = "ftp"
)
const RWTypeNop RWType = "nop"
const RWTypeNull RWType = "null"
const (
RWTypeOss RWType = "oss"
)
const (
RWTypeSSH RWType = "ssh"
)
const RWTypeTail RWType = "tail"
type SSHRWCfg ¶ added in v0.8.2
type SSHRWCfg struct {
Addr string `json:"addr" validate:"required" yaml:"addr"`
User string `json:"user" validate:"required" yaml:"user"`
Pwd string `json:"pwd" yaml:"pwd"`
PrivateKey string `json:"privateKey" yaml:"privateKey"`
Timeout int `json:"timeout" yaml:"timeout"`
Path string `json:"path" validate:"required" yaml:"path"`
}
func NewSSHRWCfg ¶ added in v0.8.2
func NewSSHRWCfg() *SSHRWCfg
type TailRWCfg ¶
func NewTailRWCfg ¶
func NewTailRWCfg() *TailRWCfg
Click to show internal directories.
Click to hide internal directories.