1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00

Reaper decides if a device is present or not. Allows devices to "come back to life" if they start beating again.

This commit is contained in:
Simo Kinnunen 2015-06-03 18:49:42 +09:00
parent 2b84476c42
commit 736b6f769e
8 changed files with 149 additions and 26 deletions

View file

@ -120,14 +120,15 @@ dbapi.saveDeviceLog = function(serial, entry) {
}))
}
dbapi.saveDevice = function(serial, device) {
dbapi.saveDeviceInitialState = function(serial, device) {
var data = {
present: true
present: false
, presenceChangedAt: r.now()
, provider: device.provider
, owner: null
, status: device.status
, ready: false
, statusChangedAt: r.now()
, ready: false
, reverseForwards: []
}
return db.run(r.table('devices').get(serial).update(data))
@ -160,10 +161,17 @@ dbapi.unsetDeviceOwner = function(serial) {
}))
}
dbapi.setDevicePresent = function(serial) {
return db.run(r.table('devices').get(serial).update({
present: true
, presenceChangedAt: r.now()
}))
}
dbapi.setDeviceAbsent = function(serial) {
return db.run(r.table('devices').get(serial).update({
present: false
, ready: false
, presenceChangedAt: r.now()
}))
}