Documentation ¶
Index ¶
- func EditDeviceFromEvent(e sd.State, device sd.StaticDevice) (sd.StaticDevice, bool, *nerr.E)
- func ForwardAndStoreEvent(v events.Event, c Cache) (bool, *nerr.E)
- func ForwardDevice(device sd.StaticDevice, changes bool, c Cache) *nerr.E
- func ForwardRoom(room sd.StaticRoom, changes bool, c Cache) *nerr.E
- func GetDeviceTypeByID(id string) string
- func GetNewDevice(id string) (sd.StaticDevice, *nerr.E)
- func GetNewRoom(id string) (sd.StaticRoom, *nerr.E)
- func HasTag(toCheck string, tags []string) bool
- func PushAllDevices(c Cache)
- func SetDeviceField(key string, value interface{}, updateTime time.Time, t sd.StaticDevice) (bool, sd.StaticDevice, *nerr.E)
- type Cache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EditDeviceFromEvent ¶
func EditDeviceFromEvent(e sd.State, device sd.StaticDevice) (sd.StaticDevice, bool, *nerr.E)
func ForwardDevice ¶
func ForwardRoom ¶
func GetDeviceTypeByID ¶
func GetNewDevice ¶
func GetNewDevice(id string) (sd.StaticDevice, *nerr.E)
func GetNewRoom ¶
func GetNewRoom(id string) (sd.StaticRoom, *nerr.E)
func PushAllDevices ¶
func PushAllDevices(c Cache)
func SetDeviceField ¶
func SetDeviceField(key string, value interface{}, updateTime time.Time, t sd.StaticDevice) (bool, sd.StaticDevice, *nerr.E)
SetDeviceField returns the new device, as well as a boolean denoting if the field was already set to the provided value.
If passing in an alert, we assume that the value is a statdefinition.Alert. Alerts are denoted by alert.<alertName>. Alerts always return true.
NOTE: If in the code you can formulate a separate StaticDevice and compare it, defer to that approach, as the performance gain is quite significant.
Types ¶
type Cache ¶
type Cache interface { CheckAndStoreDevice(device sd.StaticDevice) (bool, sd.StaticDevice, *nerr.E) CheckAndStoreRoom(room sd.StaticRoom) (bool, sd.StaticRoom, *nerr.E) GetDeviceRecord(deviceID string) (sd.StaticDevice, *nerr.E) GetRoomRecord(roomID string) (sd.StaticRoom, *nerr.E) GetAllDeviceRecords() ([]sd.StaticDevice, *nerr.E) GetAllRoomRecords() ([]sd.StaticRoom, *nerr.E) StoreDeviceEvent(toSave sd.State) (bool, sd.StaticDevice, *nerr.E) StoreAndForwardEvent(event events.Event) (bool, *nerr.E) RemoveDevice(deviceID string) *nerr.E //Removes a specific device record RemoveRoom(roomID string) *nerr.E //Removes a specific room record NukeRoom(roomID string) ([]string, *nerr.E) //Removes a room and all of it's devices GetCacheType() string GetCacheName() string }
Cache is our state cache - it's meant to be a representation of the static indexes
Click to show internal directories.
Click to hide internal directories.