factd

package
v0.0.0-...-c603b20 Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Formatter formatter.Formatter
	Plugins   map[string]plugin.Plugin
	Output    *io.Writer
}

Config struct serves to pass Factd configuration

func NewConfig

func NewConfig() *Config

NewConfig returns a new config object with some default values

type Factd

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

Factd struct holds Factd-related attributes

func New

func New(userConf Config) *Factd

New returns new instance of Factd

func (*Factd) AddFact

func (f *Factd) AddFact(group string, id string, fact interface{})

AddFact sets fact in group at key id

func (*Factd) Collect

func (f *Factd) Collect()

Collect facts from each active plugin and add them to the plugin result array

func (*Factd) Delete

func (f *Factd) Delete(k string)

Delete deletes given fact

func (*Factd) Format

func (f *Factd) Format() (*bytes.Buffer, error)

Format returns the formatted result of the facts as a pointer to a bytes.Buffer

func (*Factd) Get

func (f *Factd) Get(group string, k string) (interface{}, bool)

Get returns value of given fact, if it exists

func (*Factd) GetConfig

func (f *Factd) GetConfig() Config

GetConfig returns the current config for factd

func (*Factd) MergeSet

func (f *Factd) MergeSet(k string, v common.FactList)

MergeSet adds a fact set, merging it with existing fact data

func (*Factd) Print

func (f *Factd) Print() error

Print facts by calling selected formatter and printing returned buffer to f.Config.Output as a string

func (*Factd) ReplaceSet

func (f *Factd) ReplaceSet(k string, v common.FactList)

ReplaceSet replaces all facts for key k

func (*Factd) ReporterProcessor

func (f *Factd) ReporterProcessor()

ReporterProcessor is responsible for acting on information passed to the report channel it will trigger the listeners with the provided fact BEFORE it merges the new fact into the parent set

func (*Factd) RunReporters

func (f *Factd) RunReporters()

RunReporters starts all of the activeReporters in goroutines It additionally starts the reporter processor which will listen for channel input and merge it with existing reports

func (*Factd) SetConfig

func (f *Factd) SetConfig(c Config)

SetConfig sets the factd config to the provided struct

func (*Factd) StopReporters

func (f *Factd) StopReporters()

StopReporters will close the report channel

Jump to

Keyboard shortcuts

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