producer

package
v1.0.139 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TimeoutException = "TimeoutException"

	MaxLogSize = 10 * 1024 * 1024
)

Variables

This section is empty.

Functions

func GenerateLog

func GenerateLog(logTime int64, addLogMap map[string]string) *pb.Log

func GetLogListSize

func GetLogListSize(logList []*pb.Log) int

func GetLogSize

func GetLogSize(log *pb.Log) int

func GetTimeMs

func GetTimeMs(t int64) int64

func WithRecover

func WithRecover(fn func())

Types

type Attempt

type Attempt struct {
	SuccessFlag  bool
	RequestId    string
	ErrorCode    string
	ErrorMessage string
	TimestampMs  int64
}

type Batch

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

type BatchKey

type BatchKey struct {
	Topic       string
	Source      string
	ShardHash   string
	FileName    string
	CallBackFun CallBack
}

type BatchLog

type BatchLog struct {
	Key BatchKey
	Log *pb.Log
}

type CallBack

type CallBack interface {
	Success(result *Result)
	Fail(result *Result)
}

type Config

type Config struct {
	TotalSizeLnBytes      int64
	MaxSenderCount        int64
	MaxBlockSec           int
	MaxBatchSize          int64
	MaxBatchCount         int
	LingerTime            time.Duration
	Retries               int
	MaxReservedAttempts   int
	BaseRetryBackoffMs    int64
	MaxRetryBackoffMs     int64
	AdjustShardHashFlag   bool
	ShardCount            int
	NoRetryStatusCodeList []int

	common.LoggerConfig
	common.ClientConfig
}

func GetDefaultProducerConfig

func GetDefaultProducerConfig() *Config

type Dispatcher

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

func (*Dispatcher) RetryQueueElegantQuit

func (dispatcher *Dispatcher) RetryQueueElegantQuit()

type Producer

type Producer interface {
	SendLog(shardHash, topic, source, filename string, log *pb.Log, callBack CallBack) error
	SendLogs(shardHash, topic, source, filename string, logs *pb.LogGroup, callBack CallBack) error
	ResetAccessKeyToken(accessKeyID, accessKeySecret, securityToken string)
	Start()
	Close()
	ForceClose()
}

func NewProducer

func NewProducer(config *Config) Producer

type Result

type Result struct {
	Attempts    []*Attempt
	SuccessFlag bool
}

type RetryQueue

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

func (*RetryQueue) Len

func (q *RetryQueue) Len() int

func (*RetryQueue) Less

func (q *RetryQueue) Less(i, j int) bool

func (*RetryQueue) Pop

func (q *RetryQueue) Pop() interface{}

func (*RetryQueue) Push

func (q *RetryQueue) Push(x interface{})

func (*RetryQueue) Swap

func (q *RetryQueue) Swap(i, j int)

type Sender

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

func (*Sender) FailedCallback

func (sender *Sender) FailedCallback(batch *Batch)

func (*Sender) IsShutDown

func (sender *Sender) IsShutDown() bool

type ThreadPool

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

Jump to

Keyboard shortcuts

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