module

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 6 Imported by: 39

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 AddressUpgrade added in v0.1.25

type AddressUpgrade func(port int) (string, error)

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) GetMajorNameHashed added in v0.1.22

func (i Info) GetMajorNameHashed() string

func (Info) GetMajorNameSanitised

func (i Info) GetMajorNameSanitised() string

type ListenAddressGetter

type ListenAddressGetter func() (port int, upgrade AddressUpgrade)

ListenAddressGetter gets listen port address

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