GetDevice retrieves device info by name from database
(ctx context.Context, name string)
| 257 | |
| 258 | // GetDevice retrieves device info by name from database |
| 259 | func (m *PoolMetadata) GetDevice(ctx context.Context, name string) (*DeviceInfo, error) { |
| 260 | var ( |
| 261 | dev DeviceInfo |
| 262 | err error |
| 263 | ) |
| 264 | |
| 265 | err = m.db.View(func(tx *bolt.Tx) error { |
| 266 | bucket := tx.Bucket(devicesBucketName) |
| 267 | return getObject(bucket, name, &dev) |
| 268 | }) |
| 269 | |
| 270 | return &dev, err |
| 271 | } |
| 272 | |
| 273 | // RemoveDevice removes device info from store. |
| 274 | func (m *PoolMetadata) RemoveDevice(ctx context.Context, name string) error { |