pusher

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTailTimeout = time.Hour
)

Variables

This section is empty.

Functions

func GetBuffer

func GetBuffer(size int) []byte

func PutBuffer

func PutBuffer(b []byte)

Types

type CreateMsWithShardKeyFunc

type CreateMsWithShardKeyFunc func([]byte) ([]byte, error)

type File

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

func NewFile

func NewFile(conf *FileConfig, compress bool, logger *logger.Logger) *File

func (*File) Push

func (f *File) Push(data []byte) error

func (*File) Stop

func (f *File) Stop()

type FileConfig

type FileConfig struct {
	App  string
	Path string
	// contains filtered or unexported fields
}

func (*FileConfig) GetDir

func (c *FileConfig) GetDir() string

GetDir get directory of the metric file

func (*FileConfig) GetName

func (c *FileConfig) GetName() string

GetName get name of the metric file

func (*FileConfig) GetSavePath

func (c *FileConfig) GetSavePath() string

GetSavePath generate file names by day

func (*FileConfig) GlobPattern

func (c *FileConfig) GlobPattern() string

GlobPattern get pattern to match metric files

func (*FileConfig) Parser

func (c *FileConfig) Parser()

type Http

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

func NewHttp

func NewHttp(conf *HttpConfig, logger *logger.Logger) *Http

func (*Http) Push

func (p *Http) Push(data []byte) error

func (*Http) Stop

func (p *Http) Stop()

type HttpConfig

type HttpConfig struct {
	Username string
	Password string
	Https    bool
	EndPoint string
	Database string
	RP       string
	Duration time.Duration
	RepN     int
	Gzipped  bool
}

func (*HttpConfig) BasicAuth

func (c *HttpConfig) BasicAuth() (string, string)

func (*HttpConfig) CreateURL

func (c *HttpConfig) CreateURL() string

func (*HttpConfig) PushURL

func (c *HttpConfig) PushURL() string

type Pusher

type Pusher interface {
	Push([]byte) error
	Stop()
}

type SnappyReader

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

func NewSnappyReader

func NewSnappyReader() *SnappyReader

func (*SnappyReader) Close

func (r *SnappyReader) Close() error

func (*SnappyReader) EnableCompress

func (r *SnappyReader) EnableCompress()

func (*SnappyReader) Location

func (r *SnappyReader) Location() int64

func (*SnappyReader) OpenFile

func (r *SnappyReader) OpenFile(file string) error

func (*SnappyReader) ReadBlock

func (r *SnappyReader) ReadBlock() ([]byte, error)

func (*SnappyReader) SeekStart

func (r *SnappyReader) SeekStart(location int64) error

func (*SnappyReader) Stat

func (r *SnappyReader) Stat() (os.FileInfo, error)

type SnappyTail

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

func NewSnappyTail

func NewSnappyTail(timeout time.Duration, compress bool) *SnappyTail

func (*SnappyTail) Close

func (t *SnappyTail) Close()

func (*SnappyTail) Tail

func (t *SnappyTail) Tail(file string, handle func(data []byte)) error

type SnappyWriter

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

func NewSnappyWriter

func NewSnappyWriter() *SnappyWriter

func (*SnappyWriter) Close

func (w *SnappyWriter) Close() error

func (*SnappyWriter) EnableCompress

func (w *SnappyWriter) EnableCompress()

func (*SnappyWriter) File

func (w *SnappyWriter) File() *os.File

func (*SnappyWriter) OpenFile

func (w *SnappyWriter) OpenFile(file string) error

func (*SnappyWriter) WriteBlock

func (w *SnappyWriter) WriteBlock(b []byte) error

WriteBlock consists: |4-byte data size|data| 1. write 4-byte data length after compression 2. write data 3. write size=0, indicating EOF

Jump to

Keyboard shortcuts

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