Documentation ¶
Index ¶
- Variables
- type Synchronizer
- func (s *Synchronizer) Connected(connected bool)
- func (s *Synchronizer) HandleResponse(msg *message.Message) ([]*message.Message, error)
- func (s *Synchronizer) RetrieveDesiredPropertiesCommand(thing *model.Thing) *protocol.Envelope
- func (s *Synchronizer) RetrievedProperties(env protocol.Envelope) (map[string]model.Feature, error)
- func (s *Synchronizer) Start() error
- func (s *Synchronizer) Stop()
- func (s *Synchronizer) SyncFeature(thingID string, featureID string) error
- func (s *Synchronizer) SyncThings(thingIDs ...string) error
- func (s *Synchronizer) UpdateLocalDesiredProperties(thingID string, cloudFeatures map[string]model.Feature) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoConnection indicates that there is no hub connection. ErrNoConnection = errors.New("no hub connection") )
Functions ¶
This section is empty.
Types ¶
type Synchronizer ¶
type Synchronizer struct { DeviceInfo commands.DeviceInfo HonoPub message.Publisher MosquittoPub message.Publisher Storage persistence.ThingsStorage Logger logger.Logger // contains filtered or unexported fields }
Synchronizer manages ditto protocol commands using the local digital twins storage.
func (*Synchronizer) Connected ¶
func (s *Synchronizer) Connected(connected bool)
Connected is used to modify the connection state.
func (*Synchronizer) HandleResponse ¶
HandleResponse checks and manages retrieve desired properties commands' responses.
func (*Synchronizer) RetrieveDesiredPropertiesCommand ¶
func (s *Synchronizer) RetrieveDesiredPropertiesCommand(thing *model.Thing) *protocol.Envelope
RetrieveDesiredPropertiesCommand returns a command, which can be used to retrieve the provided thing's desired properties from the cloud.
func (*Synchronizer) RetrievedProperties ¶
RetrievedProperties extracts features' desired properties from an envelope. Returns error if the content is with unexpected topic, path, status or value.
func (*Synchronizer) Start ¶
func (s *Synchronizer) Start() error
Start is used to trigger a new synchronization process. It will start synchronization for each locally persisted thing.
func (*Synchronizer) Stop ¶
func (s *Synchronizer) Stop()
Stop is used to interrupt a started synchronization process, e.g. on hub connection lost.
func (*Synchronizer) SyncFeature ¶
func (s *Synchronizer) SyncFeature(thingID string, featureID string) error
SyncFeature synchronizes a feature of given thing.
func (*Synchronizer) SyncThings ¶
func (s *Synchronizer) SyncThings(thingIDs ...string) error
SyncThings synchronizes all the things with given IDs.
func (*Synchronizer) UpdateLocalDesiredProperties ¶
func (s *Synchronizer) UpdateLocalDesiredProperties( thingID string, cloudFeatures map[string]model.Feature, ) error
UpdateLocalDesiredProperties overwrites the locally persisted desired properties with the provided response value.