Documentation ¶
Overview ¶
Package types contains the types and associated methods for the state service.
Index ¶
Constants ¶
const ( // SerdeDomain is a copy of the state service's serde domain, from // orc8r/cloud/go/services/state/doc.go. SerdeDomain = "state" )
Variables ¶
This section is empty.
Functions ¶
func MakeProtoState ¶
MakeProtoState converts a state and ID to a proto state.
func MakeProtoStateErrors ¶
func MakeProtoStateErrors(errs StateErrors) []*protos.IDAndError
MakeProtoStateErrors converts state errors to proto state errors.
func MakeProtoStates ¶
func MakeProtoStates(states StatesByID) ([]*protos.State, error)
MakeProtoStates converts states by ID to proto states.
Types ¶
type ID ¶
type ID struct { // Type determines how the value is deserialized and validated on the cloud service side. Type string // DeviceID is the ID of the entity with which the state is associated (IMSI, serial number, etc). DeviceID string }
ID identifies a piece of state. A piece of state is uniquely identified by the triplet {network ID, device ID, type}.
type IDsByNetwork ¶
IDsByNetwork are a set of state IDs, keyed by network ID.
type SerializedStateWithMeta ¶
type SerializedStateWithMeta struct { ReporterID string TimeMs uint64 CertExpirationTime int64 SerializedReportedState []byte Version uint64 }
SerializedStateWithMeta includes reported operational states and additional info
type State ¶
type State struct { // ReportedState is the actual state reported by the device. ReportedState interface{} // Type determines how the reported state value is deserialized and validated on the cloud service side. Type string // Version is the reported version of the state. Version uint64 // ReporterID is the hardware ID of the gateway which reported the state. ReporterID string // TimeMs is the time the state was received in milliseconds. TimeMs uint64 // CertExpirationTime is the expiration time in milliseconds. CertExpirationTime int64 }
State includes reported operational state and additional info about the reporter.
type StateErrors ¶
StateErrors is a mapping of state ID to error experienced handling the state.
func MakeStateErrors ¶
func MakeStateErrors(errs []*protos.IDAndError) StateErrors
MakeStateErrors converts proto state errors to native state errors.
type StatesByID ¶
StatesByID maps state IDs to state. A state and its ID collectively contains all information for a piece of state.
func MakeStatesByID ¶
func MakeStatesByID(states []*protos.State) (StatesByID, error)
MakeStatesByID converts proto states to native states keyed by state ID.