einfo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package einfo provides primitives for searching and processing data in Info files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleAll

func HandleAll(im *info.ZInfoMsg, ds []*ZInfoMsgInterface) bool

HandleAll runs for all Info's selected by InfoWatch

func HandleFirst

func HandleFirst(im *info.ZInfoMsg, ds []*ZInfoMsgInterface) bool

HandleFirst runs once and interrupts the workflow of InfoWatch

func InfoChecker

func InfoChecker(loader loaders.Loader, devUUID uuid.UUID, query map[string]string, handler HandlerFunc, mode InfoCheckerMode, timeout time.Duration) (err error)

InfoChecker checks the information in the regular expression pattern 'query' and processes the info.ZInfoMsg found by the function 'handler' from existing files (mode=InfoExist), new files (mode=InfoNew) or any of them (mode=InfoAny) with timeout (0 for infinite).

func InfoFind

func InfoFind(im *info.ZInfoMsg, query map[string]string) int

InfoFind find ZInfoMsg records by reqexps in 'query' corresponded to devId and ZInfoDevSW structure.

func InfoLast

func InfoLast(loader loaders.Loader, query map[string]string, qhandler QHandlerFunc, handler HandlerFunc) error

InfoLast search Info files in the 'filepath' directory according to the 'query' parameters accepted by the 'qhandler' function and subsequent process using the 'handler' function.

func InfoPrn

func InfoPrn(im *info.ZInfoMsg)

InfoPrn print data from ZInfoMsg structure

func InfoWatch

func InfoWatch(loader loaders.Loader, query map[string]string, qhandler QHandlerFunc, handler HandlerFunc, timeoutSeconds time.Duration) error

InfoWatch monitors the change of Info files in the 'filepath' directory according to the 'query' parameters accepted by the 'qhandler' function and subsequent processing using the 'handler' function with 'timeoutSeconds'.

func ParseZInfoMsg

func ParseZInfoMsg(data []byte) (ZInfoMsg *info.ZInfoMsg, err error)

ParseZInfoMsg unmarshal ZInfoMsg

func ZInfoPrint

func ZInfoPrint(im *info.ZInfoMsg, query []string) *types.PrintResult

ZInfoPrint finds ZInfoMsg records by path in 'query'

func ZInfoPrn

func ZInfoPrn(im *info.ZInfoMsg, ds []*ZInfoMsgInterface)

ZInfoPrn print data from ZInfoMsg structure

Types

type HandlerFunc

type HandlerFunc func(im *info.ZInfoMsg, ds []*ZInfoMsgInterface) bool

HandlerFunc must process info.ZInfoMsg and return true to exit or false to continue

type InfoCheckerMode

type InfoCheckerMode int

InfoCheckerMode is InfoExist, InfoNew and InfoAny

const (
	InfoExist InfoCheckerMode = -3 // just look to existing files
	InfoNew   InfoCheckerMode = -2 // wait for new files
	InfoAny   InfoCheckerMode = -1 // use both mechanisms
)

InfoChecker modes InfoExist, InfoNew and InfoAny.

func InfoTail

func InfoTail(count uint) InfoCheckerMode

InfoTail returns InfoCheckerMode for process only defined count of last messages

type QHandlerFunc

type QHandlerFunc func(im *info.ZInfoMsg, query map[string]string) []*ZInfoMsgInterface

QHandlerFunc must process info.ZInfoMsg with query parameters and return true to exit or false to continue

type ZInfoMsgInterface

type ZInfoMsgInterface interface{}

ZInfoMsgInterface is an interface to pass between handlers

func ZInfoFind

func ZInfoFind(im *info.ZInfoMsg, query map[string]string) []*ZInfoMsgInterface

ZInfoFind finds ZInfoMsg records with 'devid' and ZInfoDevSWF structure fields by reqexps in 'query'

Jump to

Keyboard shortcuts

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