vapor-ware / synse-sdk

SDK for Synse Plugins in Go
https://synse.readthedocs.io/en/latest/sdk/intro/
GNU General Public License v3.0
3 stars 4 forks source link

Put the pointer to the device in the read context. #462

Closed MatthewHink closed 4 years ago

MatthewHink commented 4 years ago

https://github.com/vapor-ware/synse-sdk/blob/e02a597a82dafb0fb6562ecd588b88c179a5c988/sdk/models.go#L42

I will strongly +1 this fixme. It associates all information about the device with the reading. I'll take a crack at it.

MatthewHink commented 4 years ago

Ran into this when writing bulk read tests. Creating my devices is a bit hacky because not everything is public* and there are no friends in golang. I was looking to write a validation function and have the device association in my test, but it's way cleaner to get it from the ReadContext. The ReadContext is not passed out over the web interface, so while this may affect plugins that do bulk read, it should not affect customers.