qcache_inventory

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2017 License: Apache-2.0 Imports: 10 Imported by: 7

README

cache-inventory

Inventory cache for qframe, to enable queries against an in-memory inventory snapshot.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerRequest

type ContainerRequest struct {
	IssuedAt time.Time
	Source   string
	Timeout  time.Duration
	Name     string
	ID       string
	IP       string
	Back     chan Response
}

func NewContainerRequest

func NewContainerRequest(src string, to time.Duration) ContainerRequest

func NewIDContainerRequest

func NewIDContainerRequest(src, id string) ContainerRequest

func NewIPContainerRequest

func NewIPContainerRequest(src, ip string) ContainerRequest

func NewNameContainerRequest

func NewNameContainerRequest(src, name string) ContainerRequest

func (ContainerRequest) Equal

func (this ContainerRequest) Equal(other types.ContainerJSON) bool

func (*ContainerRequest) TimedOut

func (cr *ContainerRequest) TimedOut() bool

type Inventory

type Inventory struct {
	Version         string
	Data            map[string]types.ContainerJSON
	PendingRequests []ContainerRequest
	// contains filtered or unexported fields
}

func NewInventory

func NewInventory() Inventory

func (*Inventory) CheckRequests

func (inv *Inventory) CheckRequests()

CheckRequests iterates over all requests and responses if the request can be fulfilled

func (*Inventory) GetItem

func (i *Inventory) GetItem(key string) (cntOut types.ContainerJSON, err error)

func (*Inventory) HandleRequest

func (i *Inventory) HandleRequest(req ContainerRequest) (err error)

func (*Inventory) ServeRequest

func (i *Inventory) ServeRequest(req ContainerRequest)

func (*Inventory) SetItem

func (i *Inventory) SetItem(key string, item types.ContainerJSON) (err error)

type Plugin

type Plugin struct {
	qtypes.Plugin
	Inventory Inventory
}

func New

func New(qChan qtypes.QChan, cfg *config.Config, name string) (Plugin, error)

func (*Plugin) Run

func (p *Plugin) Run()

Run fetches everything from the Data channel and flushes it to stdout

type Response

type Response struct {
	Container types.ContainerJSON
	Error     error
}

func NewFAILResponse

func NewFAILResponse(err error) Response

func NewOKResponse

func NewOKResponse(cnt types.ContainerJSON) Response

Jump to

Keyboard shortcuts

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