teoapi

package
v0.0.0-...-2e4d9bc Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package teoapi is the Teonet registry service client package.

Index

Constants

This section is empty.

Variables

View Source
var MODULE = teokeys.Color(teokeys.ANSIYellow, "(teoapi)")

MODULE is this package module name

Functions

This section is empty.

Types

type Application

type Application struct {
	UUID    gocql.UUID
	Name    string
	Version string
	Descr   string
	Author  string
	License string
	Goget   string
	Git     string
	Com     []Command
}

Application is the Table 'applications': Teonet applications (services) description.

type Command

type Command struct {
	AppID       gocql.UUID
	Cmd         byte
	Type        uint8
	Descr       string
	TxtF        bool
	TxtNum      uint8
	TxtDescr    string
	JSONF       bool
	JSON        string
	BinaryF     bool
	BinaryDescr string
	Func        func(pac Packet) (err error)
	Message     func(pac Packet) (err error)
	Count       uint64 // Command processed count
}

Command is the Table 'commands': Teonet applications commands description - cmdType values: 0 - input; 1 - input/output (same parameters); 2 - output

type EventData

type EventData struct {
	Event int
	Data  Packet
}

EventData teonet channel data structure

type Packet

type Packet interface {
	Cmd() byte
	From() string
	Data() []byte
	RemoveTrailingZero(data []byte) []byte
}

Packet implements teonet packet interface.

type Stdout

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

Stdout module receiver

func NewStdout

func NewStdout() (s *Stdout)

NewStdout creates stdout module receiver

func (*Stdout) Redirect

func (s *Stdout) Redirect()

Redirect standart output to file

func (*Stdout) Restore

func (s *Stdout) Restore()

Restore standart output

type Teoapi

type Teoapi struct {
	W      *Workers
	NumW   int
	Stdout *Stdout
	// contains filtered or unexported fields
}

Teoapi is api receiver.

func New

func New(app *Application, numWorkers ...interface{}) (api *Teoapi)

New create new Teoregistrycli. App is application name. NumWorkers is number of workers to process incoming teonet commands, if this parameter = 0 than workes pool does not created and commands not processed by Teoapi.

func (*Teoapi) Add

func (api *Teoapi) Add(com *Command) *Teoapi

Add command description.

func (*Teoapi) Cmds

func (api *Teoapi) Cmds() (cmds []byte)

Cmds return slice of added commands.

func (*Teoapi) Count

func (api *Teoapi) Count(cmd byte) (count uint64)

Count return count command processing.

func (*Teoapi) Descr

func (api *Teoapi) Descr(cmd byte) (descr string)

Descr return command description.

func (*Teoapi) Destroy

func (api *Teoapi) Destroy()

Destroy Teoregistrycli

func (*Teoapi) Process

func (api *Teoapi) Process(pac Packet, done func()) (err error)

Process packet commands.

func (*Teoapi) ProcessPacket

func (api *Teoapi) ProcessPacket(p interface{})

ProcessPacket send packet to waorkers channel

func (*Teoapi) String

func (api *Teoapi) String() (str string)

String stringlify added commands to output string.

type Workers

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

Workers receiver

func (*Workers) CommandChan

func (w *Workers) CommandChan() chan Packet

CommandChan returns channel received packet to execute commands

func (*Workers) Statistic

func (w *Workers) Statistic() (count []float64, log *[]string)

Statistic returns workers statistic: num - number of workers, count - count of each worker runs, log - last commands exequted log

Jump to

Keyboard shortcuts

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