This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
2018-09-21 12:31:52 +02:00
|
|
|
package updater
|
|
|
|
|
2018-09-26 12:05:55 +02:00
|
|
|
import "context"
|
|
|
|
|
2018-09-21 12:31:52 +02:00
|
|
|
const (
|
|
|
|
eventIsReceiverUpgradeAvailable = "is receiver upgrade available"
|
|
|
|
eventReceiverUpgradeAvailable = "receiver upgrade available"
|
|
|
|
)
|
|
|
|
|
|
|
|
type receiverUpgreAvailable struct {
|
|
|
|
Available bool `json:"available"`
|
|
|
|
Running bool `json:"running"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// ReceiverUpgradeAvailable checks if an upgrade is avaialable/running for the ReachRS module
|
2018-09-26 12:05:55 +02:00
|
|
|
func (c *Client) ReceiverUpgradeAvailable(ctx context.Context) (bool, bool, error) {
|
2018-09-21 12:31:52 +02:00
|
|
|
res := &receiverUpgreAvailable{}
|
2018-09-26 12:05:55 +02:00
|
|
|
if err := c.ReqResp(ctx, eventIsReceiverUpgradeAvailable, nil, eventReceiverUpgradeAvailable, res); err != nil {
|
2018-09-21 12:31:52 +02:00
|
|
|
return false, false, err
|
|
|
|
}
|
|
|
|
c.Logf("receiver upgrade result: available: %v, running: %v", res.Available, res.Running)
|
|
|
|
return res.Available, res.Running, nil
|
|
|
|
}
|