blob: fba89fe7bd18a3087abdad3c737b4e07d146db56 [file] [log] [blame]
adlr@google.com3defe6a2009-12-04 20:57:17 +00001// Copyright (c) 2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__
7
8#include <string>
9#include "chromeos/obsolete_logging.h"
10
11// InstallPlan is a simple struct that contains relevant info for many
12// parts of the update system about the install that should happen.
13
14namespace chromeos_update_engine {
15
16struct InstallPlan {
17 InstallPlan(bool is_full,
18 const std::string& url,
19 const std::string& hash,
Andrew de los Reyesf9185172010-05-03 11:07:05 -070020 const std::string& install_path,
21 const std::string& kernel_install_path)
adlr@google.com3defe6a2009-12-04 20:57:17 +000022 : is_full_update(is_full),
23 download_url(url),
24 download_hash(hash),
Andrew de los Reyesf9185172010-05-03 11:07:05 -070025 install_path(install_path),
26 kernel_install_path(kernel_install_path) {}
adlr@google.com3defe6a2009-12-04 20:57:17 +000027 InstallPlan() : is_full_update(false) {}
28
29 bool is_full_update;
30 std::string download_url; // url to download from
31 std::string download_hash; // hash of the data at the url
adlr@google.com3defe6a2009-12-04 20:57:17 +000032 std::string install_path; // path to install device
Andrew de los Reyesf9185172010-05-03 11:07:05 -070033 std::string kernel_install_path; // path to kernel install device
adlr@google.com3defe6a2009-12-04 20:57:17 +000034
35 bool operator==(const InstallPlan& that) const {
36 return (is_full_update == that.is_full_update) &&
37 (download_url == that.download_url) &&
38 (download_hash == that.download_hash) &&
Andrew de los Reyesf9185172010-05-03 11:07:05 -070039 (install_path == that.install_path) &&
40 (kernel_install_path == that.kernel_install_path);
adlr@google.com3defe6a2009-12-04 20:57:17 +000041 }
42 bool operator!=(const InstallPlan& that) const {
43 return !((*this) == that);
44 }
45 void Dump() const {
46 LOG(INFO) << "InstallPlan: "
47 << (is_full_update ? "full_update" : "delta_update")
48 << ", url: " << download_url << ", hash: " << download_hash
Andrew de los Reyesf9185172010-05-03 11:07:05 -070049 << ", install_path: " << install_path
50 << ", kernel_install_path: " << kernel_install_path;
adlr@google.com3defe6a2009-12-04 20:57:17 +000051 }
52};
53
54} // namespace chromeos_update_engine
55
56#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__