model

package
v0.1.45 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// File contains filename of the file from where the records come
	File string

	// Records are the list of parsed records
	Records []*Record

	// TagsCond information, attached to the list of records
	Meta Meta
	// contains filtered or unexported fields
}

Event is a structure which contains a list of records, parsed from a file. Event has a consumption confirmation mechanism, consumer must call Confirm() as soon as he finished handling the even.

func NewEvent

func NewEvent(file string, recs []*Record, meta Meta, confCh chan struct{}) *Event

func (*Event) Confirm

func (e *Event) Confirm() bool

consumer must call Confirm() as soon as the event is handled

func (*Event) MarshalJSON

func (e *Event) MarshalJSON() ([]byte, error)

func (*Event) String

func (e *Event) String() string

type Meta

type Meta struct {
	Tags   map[string]string
	Fields map[string]string
}

type Record

type Record struct {

	// Raw bytes, representing file entry read
	Data []byte

	// Record date
	Date time.Time

	// Fields contains text in "<key1>=<value1>,<key2>=<value2>,..." format
	Fields string
}

Record is a file entry (e.g. log line) represented as a slice of bytes plus some parsed out (or additional) meta information attached to it. Sometimes it's convenient to parse out the needed info from the file entry on the client side and not sink, it saves sink resources. Also sink may simply not know some information which client knows (e.g. containerId).

func NewRecord

func NewRecord(data []byte, date time.Time) *Record

func (*Record) GetData

func (r *Record) GetData() []byte

func (*Record) GetDate

func (r *Record) GetDate() time.Time

Jump to

Keyboard shortcuts

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