config

package
v0.0.0-...-6f62517 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GETPROPS = "getprops"
	GET      = "get"
	SET      = "set"
	RESET    = "reset"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Command       string      `json:"command"`
	ResponseQueue string      `json:"ReceiveQueue"`
	Property      string      `json:"property,omitempty"`
	Value         interface{} `json:"value,omitempty"`
}

type ConfigClient

type ConfigClient struct {
	Bus           messagebus.Messagebus
	CommandQueue  string
	ResponseQueue string
}

func NewConfigClient

func NewConfigClient(bus messagebus.Messagebus, commandQueue string, responseQueue string) *ConfigClient

func (*ConfigClient) Get

func (d *ConfigClient) Get(name string) (*Response, error)

func (*ConfigClient) GetProperties

func (d *ConfigClient) GetProperties() ([]string, error)

func (*ConfigClient) ReadOneMessage

func (d *ConfigClient) ReadOneMessage() string

func (*ConfigClient) Reset

func (d *ConfigClient) Reset(name string) (*Response, error)

func (*ConfigClient) SendCommand

func (d *ConfigClient) SendCommand(command Command) error

func (*ConfigClient) Set

func (d *ConfigClient) Set(name string, value interface{}) (*Response, error)

type ConfigEntry

type ConfigEntry struct {
	Set     SetFunc
	Get     GetFunc
	Default interface{}
}

type ConfigService

type ConfigService struct {
	Entries      map[string]*ConfigEntry
	CommandQueue string
	Bus          messagebus.Messagebus
}

func NewConfigService

func NewConfigService(bus messagebus.Messagebus, commandQueue string, entries map[string]*ConfigEntry) *ConfigService

func (*ConfigService) Get

func (d *ConfigService) Get(command *Command)

func (*ConfigService) GetProperties

func (d *ConfigService) GetProperties(command *Command)

func (*ConfigService) Reset

func (d *ConfigService) Reset(command *Command)

func (*ConfigService) Run

func (d *ConfigService) Run()

func (*ConfigService) Set

func (d *ConfigService) Set(command *Command)

type GetFunc

type GetFunc func(name string) (interface{}, error)

type Response

type Response struct {
	Command  string      `json:"command"`
	Property string      `json:"property,omitempty"`
	Value    interface{} `json:"value,omitempty"`
	Error    error       `json:"error,omitempty"`
}

type SetFunc

type SetFunc func(name string, value interface{}) error

Jump to

Keyboard shortcuts

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