module

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 5 Imported by: 9

README

Tinysystems module

Collection of structs and interfaces to be used by module implementations

Documentation

Index

Constants

View Source
const (
	SaveStatePort string = "_save-state"
	GetStatePort  string = "_get-state"
	SettingsPort  string = "_settings"
	StatusPort    string = "_status"
)

Variables

This section is empty.

Functions

func GetNodeFullName

func GetNodeFullName(module string, component string) string

func ParseFullName

func ParseFullName(fullName string) (module string, component string, err error)

Types

type Component

type Component interface {
	GetInfo() ComponentInfo
	//Handle handles incoming requests
	Handle(ctx context.Context, output Handler, port string, message interface{}) error
	//Ports gets list of ports
	Ports() []NodePort
	//Instance creates new instance with default settings
	Instance() Component
}

type ComponentInfo

type ComponentInfo struct {
	Name        string
	Description string
	Info        string
	Tags        []string
}

func (ComponentInfo) GetResourceName

func (c ComponentInfo) GetResourceName() string

type Emitter

type Emitter interface {
	Emit(ctx context.Context, handler Handler) error
}

type HTTPService

type HTTPService interface {
	HTTPService(getter ListenAddressGetter)
}

type Handler

type Handler func(port string, data interface{}) error

type Info

type Info struct {
	Name      string
	VersionID string // if module's build is registered
	Version   string
	Addr      string //listed address
}

func (Info) GetFullName

func (i Info) GetFullName() string

GetFullName Container image full name

func (Info) GetMajorName

func (i Info) GetMajorName() string

func (Info) GetMajorNameSanitised

func (i Info) GetMajorNameSanitised() string

type ListenAddressGetter

type ListenAddressGetter func(port int) (public string, err error)

type NodePort

type NodePort struct {
	Source        bool
	Status        bool
	Settings      bool
	Position      Position
	Name          string
	Label         string
	Configuration interface{}
}

type Position

type Position int
const (
	Top Position = iota
	Right
	Bottom
	Left
)

type StatefulComponent

type StatefulComponent interface {
	GetState() ([]byte, error)
	SetState(state []byte) error
}

StatefulComponent WIP

Jump to

Keyboard shortcuts

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