drain

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: MPL-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Package drain handles the storing and publishing of logs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Publisher PublisherDrain // default publish drain
	Archiver  ArchiverDrain  // default archive drain
)
View Source
var (
	// How often to clean, exported for testing
	CleanFreq = 60
)

Functions

func Init

func Init() error

Init initializes the archiver and publisher drains if configured

Types

type ArchiverDrain

type ArchiverDrain interface {
	// Init initializes the archiver drain
	Init() error
	// Slice returns a slice of logs based on the name, offset, limit, and log-level
	Slice(name, host, tag string, offset, end, limit int64, level int) ([]logvac.Message, error)
	// Write writes the message to database
	Write(msg logvac.Message)
	// Expire cleans up old logs
	Expire()
}

Archiver defines a storage type drain

type BoltArchive

type BoltArchive struct {
	Done chan bool
	// contains filtered or unexported fields
}

BoltArchive is a boltDB archiver

func NewBoltArchive

func NewBoltArchive(path string) (*BoltArchive, error)

NewBoltArchive creates a new boltDB archiver

func (BoltArchive) Close

func (a BoltArchive) Close()

Close closes the bolt db

func (BoltArchive) Expire

func (a BoltArchive) Expire()

Expire cleans up old logs

func (BoltArchive) Init

func (a BoltArchive) Init() error

Init initializes the archiver drain

func (BoltArchive) Slice

func (a BoltArchive) Slice(name, host, tag string, offset, end, limit int64, level int) ([]logvac.Message, error)

Slice returns a slice of logs based on the name, offset, limit, and log-level

func (BoltArchive) Write

func (a BoltArchive) Write(msg logvac.Message)

Write writes the message to database

type Mist

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

Mist is a mist publisher

func NewMistClient

func NewMistClient(address string) (*Mist, error)

NewMistClient creates a new mist publisher

func (*Mist) Close added in v0.0.1

func (m *Mist) Close()

Close cleanly closes the mist client

func (Mist) Init

func (m Mist) Init() error

Init initializes a connection to mist

func (*Mist) Publish

func (m *Mist) Publish(msg logvac.Message)

Publish utilizes mist's Publish to "drain" a log message

type PublisherDrain

type PublisherDrain interface {
	// Init initializes the publish drain
	Init() error
	// Publish publishes the tagged data
	Publish(msg logvac.Message)
}

Publisher defines a pub-sub type drain

Jump to

Keyboard shortcuts

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