blob: 8dc42aa722f973d29226ed3a73c0651f41023be5 [file] [log] [blame]
Darin Petkov0406e402010-10-06 21:33:11 -07001// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
adlr@google.com3defe6a2009-12-04 20:57:17 +00002// 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>
Chris Masone790e62e2010-08-12 10:41:18 -07009#include "base/logging.h"
adlr@google.com3defe6a2009-12-04 20:57:17 +000010
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,
Darin Petkov0406e402010-10-06 21:33:11 -070018 bool is_resume,
adlr@google.com3defe6a2009-12-04 20:57:17 +000019 const std::string& url,
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070020 uint64_t size,
adlr@google.com3defe6a2009-12-04 20:57:17 +000021 const std::string& hash,
Andrew de los Reyesf9185172010-05-03 11:07:05 -070022 const std::string& install_path,
23 const std::string& kernel_install_path)
adlr@google.com3defe6a2009-12-04 20:57:17 +000024 : is_full_update(is_full),
Darin Petkov0406e402010-10-06 21:33:11 -070025 is_resume(is_resume),
adlr@google.com3defe6a2009-12-04 20:57:17 +000026 download_url(url),
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070027 size(size),
adlr@google.com3defe6a2009-12-04 20:57:17 +000028 download_hash(hash),
Andrew de los Reyesf9185172010-05-03 11:07:05 -070029 install_path(install_path),
30 kernel_install_path(kernel_install_path) {}
Darin Petkov0406e402010-10-06 21:33:11 -070031 InstallPlan() : is_full_update(false), is_resume(false), size(0) {}
adlr@google.com3defe6a2009-12-04 20:57:17 +000032
33 bool is_full_update;
Darin Petkov0406e402010-10-06 21:33:11 -070034 bool is_resume;
adlr@google.com3defe6a2009-12-04 20:57:17 +000035 std::string download_url; // url to download from
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070036 uint64_t size; // size of the download url's data
adlr@google.com3defe6a2009-12-04 20:57:17 +000037 std::string download_hash; // hash of the data at the url
adlr@google.com3defe6a2009-12-04 20:57:17 +000038 std::string install_path; // path to install device
Andrew de los Reyesf9185172010-05-03 11:07:05 -070039 std::string kernel_install_path; // path to kernel install device
adlr@google.com3defe6a2009-12-04 20:57:17 +000040
41 bool operator==(const InstallPlan& that) const {
42 return (is_full_update == that.is_full_update) &&
Darin Petkov0406e402010-10-06 21:33:11 -070043 (is_resume == that.is_resume) &&
44 (download_url == that.download_url) &&
45 (size == that.size) &&
46 (download_hash == that.download_hash) &&
47 (install_path == that.install_path) &&
48 (kernel_install_path == that.kernel_install_path);
adlr@google.com3defe6a2009-12-04 20:57:17 +000049 }
50 bool operator!=(const InstallPlan& that) const {
51 return !((*this) == that);
52 }
53 void Dump() const {
54 LOG(INFO) << "InstallPlan: "
55 << (is_full_update ? "full_update" : "delta_update")
Darin Petkov0406e402010-10-06 21:33:11 -070056 << (is_resume ? ", resume" : ", new_update")
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070057 << ", url: " << download_url
58 << ", size: " << size
59 << ", hash: " << download_hash
Andrew de los Reyesf9185172010-05-03 11:07:05 -070060 << ", install_path: " << install_path
61 << ", kernel_install_path: " << kernel_install_path;
adlr@google.com3defe6a2009-12-04 20:57:17 +000062 }
63};
64
65} // namespace chromeos_update_engine
66
67#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__