Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAnnotationError = errors.New("Annotation error") ErrNotAnnotatable = errors.New("object does not implement Annotatable") ErrBufferFull = errors.New("Buffer full") ErrInvalidSink = errors.New("Not a valid row.Sink") )
Errors that may be returned by Buffer functions.
Functions ¶
This section is empty.
Types ¶
type ActiveStats ¶
type ActiveStats struct { Stats // contains filtered or unexported fields }
ActiveStats is a stats object that supports updates.
func (*ActiveStats) Done ¶
func (as *ActiveStats) Done(n int, err error)
Done updates the pending to failed or committed.
func (*ActiveStats) GetStats ¶
func (as *ActiveStats) GetStats() Stats
GetStats implements HasStats()
func (*ActiveStats) MoveToPending ¶
func (as *ActiveStats) MoveToPending(n int)
MoveToPending increments the Pending field.
type Annotatable ¶
type Annotatable interface { GetLogTime() time.Time GetClientIPs() []string // This is a slice to support mutliple hops in traceroute data. GetServerIP() string AnnotateClients(map[string]*api.Annotations) error // Must properly handle missing annotations. AnnotateServer(*api.Annotations) error // Must properly handle nil parameter. }
Annotatable interface enables integration of annotation into parser.Base. The row type should implement the interface, and the annotations will be added prior to insertion.
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base provides common parser functionality. Base is NOT THREAD-SAFE
func NewBase ¶
NewBase creates a new Base. This will generally be embedded in a type specific parser.
func (*Base) Put ¶
func (pb *Base) Put(row Annotatable) error
Put adds a row to the buffer. Iff the buffer is already full the prior buffered rows are annotated and committed to the Sink. NOTE: There is no guarantee about ordering of writes resulting from sequential calls to Put. However, once a block of rows is submitted to pb.commit, it should be written in the same order to the Sink. TODO improve Annotatable architecture.
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer provides all basic functionality generally needed for buffering, annotating, and inserting rows that implement Annotatable. Buffer functions are THREAD-SAFE
type NullAnnotator ¶
type NullAnnotator struct{}
NullAnnotator satisfies the Annotatable interface without actually doing anything.
func (*NullAnnotator) AnnotateClients ¶
func (row *NullAnnotator) AnnotateClients(map[string]*api.Annotations) error
AnnotateClients does nothing.
func (*NullAnnotator) AnnotateServer ¶
func (row *NullAnnotator) AnnotateServer(*api.Annotations) error
AnnotateServer does nothing.
func (*NullAnnotator) GetClientIPs ¶
func (row *NullAnnotator) GetClientIPs() []string
GetClientIPs returns an empty array so nothing is annotated.
func (*NullAnnotator) GetLogTime ¶
func (row *NullAnnotator) GetLogTime() time.Time
GetLogTime returns current time rather than the actual row time.
func (*NullAnnotator) GetServerIP ¶
func (row *NullAnnotator) GetServerIP() string
GetServerIP returns an empty string because there is nothing to annotate.
type Sink ¶
Sink defines the interface for committing rows. Returns the number of rows successfully committed, and error. Implementations should be threadsafe.