collect

package
v0.0.0-...-a3b0457 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context) error

func WritePacket

func WritePacket(w io.Writer, p Packet, encoder func(interface{}) ([]byte, error)) (int, error)

Types

type DirWriter

type DirWriter struct {
	// SplitAtBytes indicates when to split (actual split point might be after it)
	SplitAtBytes int
	// Basedir used to store files
	Basedir string
	// NewBasename returns the name of the next chunk based on the given time
	NewBasename func(time.Time) string
	// contains filtered or unexported fields
}

DirWriter splits files in sequential chunks

Each chunk uses compression to reduce the disk footprint

func (*DirWriter) Close

func (d *DirWriter) Close() error

func (*DirWriter) Flush

func (d *DirWriter) Flush() error

func (*DirWriter) Init

func (d *DirWriter) Init() error

func (*DirWriter) Write

func (d *DirWriter) Write(b []byte) (int, error)

type Packet

type Packet struct {
	Type string
	Buf  []byte
}

func NewPacket

func NewPacket(tp string, value interface{}, encoder func(interface{}) ([]byte, error)) (Packet, error)

type PacketVisitor

type PacketVisitor func(Packet) (bool, error)

type Stream

type Stream struct {
	// Glob pattern to select files from a directory
	Glob string
}

Stream all tweets available on a given directory (see multi-writer)

func (*Stream) Stream

func (s *Stream) Stream(visitor PacketVisitor) error

type TweetBatch

type TweetBatch struct {
	Items []*twitter.Tweet
}

Jump to

Keyboard shortcuts

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