sender

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 19 Imported by: 62

Documentation

Index

Constants

View Source
const (
	DefaultSplitSize = 64 * 1024 // 默认分割为 64 kb
	// TypeMarshalError 表示marshal出错
	TypeMarshalError = reqerr.SendErrorType("Data Marshal failed")
)

Variables

This section is empty.

Functions

func ConvertDatas added in v1.2.2

func ConvertDatas(ins []map[string]interface{}) []Data

func ConvertDatasBack added in v1.2.2

func ConvertDatasBack(ins []Data) []map[string]interface{}

func RegisterConstructor added in v1.5.0

func RegisterConstructor(typ string, c Constructor)

RegisterConstructor adds a new constructor for a given type of reader.

func SplitData added in v1.5.1

func SplitData(data string) (valArray []string)

优先使用'\n'对数据进行切分,切分后单个分片仍大于batchsize再按指定大小进行切分

func SplitDataWithSplitSize added in v1.5.4

func SplitDataWithSplitSize(data string, splitSize int64) (valArray []string)

Types

type Constructor added in v1.5.0

type Constructor func(conf.MapConf) (Sender, error)

type FtOption added in v1.2.2

type FtOption struct {
	// contains filtered or unexported fields
}

type FtSender

type FtSender struct {
	BackupQueue queue.BackendQueue
	// contains filtered or unexported fields
}

FtSender fault tolerance sender wrapper

func NewFtSender

func NewFtSender(innerSender Sender, conf conf.MapConf, ftSaveLogPath string) (*FtSender, error)

NewFtSender Fault tolerant sender constructor

func (*FtSender) Close

func (ft *FtSender) Close() error

func (*FtSender) Name

func (ft *FtSender) Name() string

func (*FtSender) RawSend added in v1.5.4

func (ft *FtSender) RawSend(datas []string) error

func (*FtSender) Reset added in v1.3.1

func (ft *FtSender) Reset() error

func (*FtSender) Restore added in v1.3.5

func (ft *FtSender) Restore(info *StatsInfo)

func (*FtSender) Send

func (ft *FtSender) Send(datas []Data) error

func (*FtSender) SkipDeepCopy added in v1.5.1

func (ft *FtSender) SkipDeepCopy() bool

func (*FtSender) Stats added in v1.3.0

func (ft *FtSender) Stats() StatsInfo

func (*FtSender) TokenRefresh added in v1.4.4

func (ft *FtSender) TokenRefresh(mapConf conf.MapConf) (err error)

type RawSender added in v1.5.4

type RawSender interface {
	RawSend([]string) error
}

RawSender used for optimize runner, without parse data

type Registry added in v1.5.0

type Registry struct {
	// contains filtered or unexported fields
}

SenderRegistry sender 的工厂类。可以注册自定义sender

func NewRegistry added in v1.5.0

func NewRegistry() *Registry

func (*Registry) NewSender added in v1.5.0

func (r *Registry) NewSender(conf conf.MapConf, ftSaveLogPath string) (sender Sender, err error)

func (*Registry) RegisterSender added in v1.5.0

func (r *Registry) RegisterSender(senderType string, constructor func(conf.MapConf) (Sender, error)) error

type Sender

type Sender interface {
	Name() string
	// send data, error if failed
	Send([]Data) error
	Close() error
}

Sender send data to pandora, prometheus such different destinations

type SkipDeepCopySender added in v1.5.1

type SkipDeepCopySender interface {
	// SkipDeepCopy 需要返回值是因为如果一个 sender 封装了其它 sender,需要根据实际封装的类型返回是否忽略深度拷贝
	SkipDeepCopy() bool
}

SkipDeepCopySender 表示该 sender 不会对传入数据进行污染,凡是有次保证的 sender 需要实现该接口提升发送效率

type StatsSender added in v1.3.0

type StatsSender interface {
	Name() string
	// send data, error if failed
	Send([]Data) error
	Close() error
	Stats() StatsInfo
	// 恢复 sender 停止之前的状态
	Restore(*StatsInfo)
}

type TokenRefreshable added in v1.4.4

type TokenRefreshable interface {
	TokenRefresh(conf.MapConf) error
}

Jump to

Keyboard shortcuts

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