Implement update_engine weave commands
The new WeaveServiceInterface abstracs the registration and interaction
with weave whenever present. The compilation and usage of weave is
based on the BRILLO_USE_WEAVE flag.
When enabled, update_engine registers the "_updater" component with
methods to force-check for an update and change channels.
Bug: 24386758
Bug: 24386768
Test: Deployed on edison, weave commands and state available online.
Change-Id: Ic49111772e123b8a2b1971da92fe65785f186ccd
diff --git a/update_attempter.h b/update_attempter.h
index cfe3e32..3a2c30d 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -41,6 +41,7 @@
#include "update_engine/system_state.h"
#include "update_engine/update_manager/policy.h"
#include "update_engine/update_manager/update_manager.h"
+#include "update_engine/weave_service_interface.h"
class MetricsLibraryInterface;
@@ -54,7 +55,8 @@
class UpdateAttempter : public ActionProcessorDelegate,
public DownloadActionDelegate,
- public CertificateChecker::Observer {
+ public CertificateChecker::Observer,
+ public WeaveServiceInterface::DelegateInterface {
public:
using UpdateStatus = update_engine::UpdateStatus;
static const int kMaxDeltaUpdateFailures;
@@ -93,6 +95,16 @@
AbstractAction* action,
ErrorCode code) override;
+ // WeaveServiceInterface::DelegateInterface overrides.
+ bool OnCheckForUpdates(brillo::ErrorPtr* error) override;
+ bool OnTrackChannel(const std::string& channel,
+ brillo::ErrorPtr* error) override;
+ bool GetWeaveState(int64_t* last_checked_time,
+ double* progress,
+ UpdateStatus* update_status,
+ std::string* current_channel,
+ std::string* tracking_channel) override;
+
// Resets the current state to UPDATE_STATUS_IDLE.
// Used by update_engine_client for restarting a new update without
// having to reboot once the previous update has reached