rpcmonitor

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2017 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultRPCAddress is the default Linux socket for the RPC monitor
	DefaultRPCAddress = "/var/run/trireme.sock"
)

Variables

This section is empty.

Functions

func DefaultRPCMetadataExtractor

func DefaultRPCMetadataExtractor(event *EventInfo) (*policy.PURuntime, error)

DefaultRPCMetadataExtractor is a default RPC metadata extractor for testing

Types

type EventInfo

type EventInfo struct {

	// EventType refers to one of the standard events that Trireme handles.
	EventType monitor.Event

	// PUType is the the type of the PU
	PUType constants.PUType

	// The PUID is a unique value for the Processing Unit. Ideally this should be the UUID.
	PUID string

	// The Name is a user-friendly name for the Processing Unit.
	Name string

	// Tags represents the set of MetadataTags associated with this PUID.
	Tags map[string]string

	// The PID is the PID on the system where this Processing Unit is running.
	PID string

	// IPs is a map of all the IPs that fully belong to this processing Unit.
	IPs map[string]string
}

EventInfo is a generic structure that defines all the information related to a PU event. EventInfo should be used as a normalized struct container that

type MonitorProcessor

type MonitorProcessor interface {

	// Start processes PU start events
	Start(eventInfo *EventInfo) error

	// Event processes PU stop events
	Stop(eventInfo *EventInfo) error

	// Create process a PU create event
	Create(eventInfo *EventInfo) error

	// Event process a PU destroy event
	Destroy(eventInfo *EventInfo) error

	// Event processes a pause event
	Pause(eventInfo *EventInfo) error
}

MonitorProcessor is a generic interface that processes monitor events using a normalized event structure.

type RPCEventHandler

type RPCEventHandler func(*EventInfo) error

A RPCEventHandler is type of docker event handler functions.

type RPCMetadataExtractor

type RPCMetadataExtractor func(*EventInfo) (*policy.PURuntime, error)

RPCMetadataExtractor is a function used to extract a *policy.PURuntime from a given EventInfo.

type RPCMonitor

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

RPCMonitor implements the RPC connection

func NewRPCMonitor

func NewRPCMonitor(rpcAddress string, puHandler monitor.ProcessingUnitsHandler, collector collector.EventCollector) (*RPCMonitor, error)

NewRPCMonitor returns a base RPC monitor. Processors must be registered externally

func (*RPCMonitor) RegisterProcessor

func (r *RPCMonitor) RegisterProcessor(puType constants.PUType, processor MonitorProcessor) error

RegisterProcessor registers an event processor for a given PUTYpe. Only one processor is allowed for a given PU Type.

func (*RPCMonitor) Start

func (r *RPCMonitor) Start() error

Start starts the RPC monitoring.

func (*RPCMonitor) Stop

func (r *RPCMonitor) Stop() error

Stop monitoring RPC events.

type RPCResponse

type RPCResponse struct {
	Error string
}

RPCResponse encapsulate the error response if any.

type Server

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

Server represents the Monitor RPC Server implementation

func (*Server) HandleEvent

func (s *Server) HandleEvent(eventInfo *EventInfo, result *RPCResponse) error

HandleEvent Gets called when clients generate events.

Jump to

Keyboard shortcuts

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