state

package
v0.0.0-...-89602ce Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: BSD-3-Clause Imports: 11 Imported by: 4

Documentation

Overview

Package state contains the state service, an orchestrator microservice which manages device-reported state.

Index

Constants

View Source
const (
	ServiceName = "STATE"
	SerdeDomain = "state"
	DBTableName = "states"
)
View Source
const StringMapSerdeType = "string_map"

Variables

This section is empty.

Functions

func DeleteStates

func DeleteStates(networkID string, stateIDs []state_types.ID) error

DeleteStates deletes states specified by the networkID and a list of type and key.

func GetGatewayStatus

func GetGatewayStatus(networkID string, deviceID string) (*models.GatewayStatus, error)

GetGatewayStatus returns the status for an indicated gateway.

func GetGatewayStatuses

func GetGatewayStatuses(networkID string, deviceIDs []string) (map[string]*models.GatewayStatus, error)

GetGatewayStatuses returns the status for indicated gateways, keyed by device ID.

func GetState

func GetState(networkID string, typeVal string, hwID string) (state_types.State, error)

GetState returns the state specified by the networkID, typeVal, and hwID

func GetStateClient

func GetStateClient() (protos.StateServiceClient, error)

GetStateClient returns a client to the state service.

func GetStates

func GetStates(networkID string, stateIDs []state_types.ID) (state_types.StatesByID, error)

GetStates returns a map of states specified by the networkID and a list of type and key

func NewStateSerde

func NewStateSerde(stateType string, modelPtr serde.ValidateableBinaryConvertible) serde.Serde

func SearchStates

func SearchStates(networkID string, typeFilter []string, keyFilter []string, keyPrefix *string) (state_types.StatesByID, error)

SearchStates returns all states matching the filter arguments. typeFilter and keyFilter are both OR clauses, and the final predicate applied to the search will be the AND of both filters. If keyPrefix is defined (non-nil and non-empty), it will take precedence the keyFilter argument. e.g.: ["t1", "t2"], ["k1", "k2"] => (t1 OR t2) AND (k1 OR k2)

Types

type ArbitraryJSON

type ArbitraryJSON map[string]interface{}

ArbitraryJSON is a generic map[string]interface{} destination to unmarshal any JSON payload into which implements ValidateableBinaryConvertible. This is used for replicated gateway states which are serialized as protos on the gateway side to avoid double-defining structs in proto and swagger for the time being.

func (*ArbitraryJSON) MarshalBinary

func (j *ArbitraryJSON) MarshalBinary() ([]byte, error)

func (*ArbitraryJSON) UnmarshalBinary

func (j *ArbitraryJSON) UnmarshalBinary(data []byte) error

func (*ArbitraryJSON) ValidateModel

func (j *ArbitraryJSON) ValidateModel() error

type StringToStringMap

type StringToStringMap map[string]string

StringToStringMap is a generic map that holds key value pair both of type string. This is used on the gateway side in checkin_cli.py to simply test the connection between the cloud and the gateway.

func (*StringToStringMap) MarshalBinary

func (m *StringToStringMap) MarshalBinary() (data []byte, err error)

func (*StringToStringMap) UnmarshalBinary

func (m *StringToStringMap) UnmarshalBinary(data []byte) error

func (*StringToStringMap) ValidateModel

func (m *StringToStringMap) ValidateModel() error

Directories

Path Synopsis
Package indexer provides tools to define, use, and update state indexers.
Package indexer provides tools to define, use, and update state indexers.
Package types contains the types and associated methods for the state service.
Package types contains the types and associated methods for the state service.

Jump to

Keyboard shortcuts

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