blob: 9911d3253bf6efece545291eab017850690c0d12 [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>
Darin Petkov698d0412010-10-13 10:59:44 -07009#include <vector>
10
Chris Masone790e62e2010-08-12 10:41:18 -070011#include "base/logging.h"
adlr@google.com3defe6a2009-12-04 20:57:17 +000012
13// InstallPlan is a simple struct that contains relevant info for many
14// parts of the update system about the install that should happen.
15
16namespace chromeos_update_engine {
17
18struct InstallPlan {
19 InstallPlan(bool is_full,
Darin Petkov0406e402010-10-06 21:33:11 -070020 bool is_resume,
adlr@google.com3defe6a2009-12-04 20:57:17 +000021 const std::string& url,
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070022 uint64_t size,
adlr@google.com3defe6a2009-12-04 20:57:17 +000023 const std::string& hash,
Andrew de los Reyesf9185172010-05-03 11:07:05 -070024 const std::string& install_path,
25 const std::string& kernel_install_path)
adlr@google.com3defe6a2009-12-04 20:57:17 +000026 : is_full_update(is_full),
Darin Petkov0406e402010-10-06 21:33:11 -070027 is_resume(is_resume),
adlr@google.com3defe6a2009-12-04 20:57:17 +000028 download_url(url),
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070029 size(size),
adlr@google.com3defe6a2009-12-04 20:57:17 +000030 download_hash(hash),
Andrew de los Reyesf9185172010-05-03 11:07:05 -070031 install_path(install_path),
32 kernel_install_path(kernel_install_path) {}
Darin Petkov0406e402010-10-06 21:33:11 -070033 InstallPlan() : is_full_update(false), is_resume(false), size(0) {}
adlr@google.com3defe6a2009-12-04 20:57:17 +000034
35 bool is_full_update;
Darin Petkov0406e402010-10-06 21:33:11 -070036 bool is_resume;
adlr@google.com3defe6a2009-12-04 20:57:17 +000037 std::string download_url; // url to download from
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070038 uint64_t size; // size of the download url's data
adlr@google.com3defe6a2009-12-04 20:57:17 +000039 std::string download_hash; // hash of the data at the url
adlr@google.com3defe6a2009-12-04 20:57:17 +000040 std::string install_path; // path to install device
Andrew de los Reyesf9185172010-05-03 11:07:05 -070041 std::string kernel_install_path; // path to kernel install device
Darin Petkov698d0412010-10-13 10:59:44 -070042 std::vector<char> current_kernel_hash; // computed by FileSystemCopierAction
43 std::vector<char> current_rootfs_hash; // computed by FileSystemCopierAction
adlr@google.com3defe6a2009-12-04 20:57:17 +000044
45 bool operator==(const InstallPlan& that) const {
46 return (is_full_update == that.is_full_update) &&
Darin Petkov0406e402010-10-06 21:33:11 -070047 (is_resume == that.is_resume) &&
48 (download_url == that.download_url) &&
49 (size == that.size) &&
50 (download_hash == that.download_hash) &&
51 (install_path == that.install_path) &&
52 (kernel_install_path == that.kernel_install_path);
adlr@google.com3defe6a2009-12-04 20:57:17 +000053 }
54 bool operator!=(const InstallPlan& that) const {
55 return !((*this) == that);
56 }
57 void Dump() const {
58 LOG(INFO) << "InstallPlan: "
59 << (is_full_update ? "full_update" : "delta_update")
Darin Petkov0406e402010-10-06 21:33:11 -070060 << (is_resume ? ", resume" : ", new_update")
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070061 << ", url: " << download_url
62 << ", size: " << size
63 << ", hash: " << download_hash
Andrew de los Reyesf9185172010-05-03 11:07:05 -070064 << ", install_path: " << install_path
65 << ", kernel_install_path: " << kernel_install_path;
adlr@google.com3defe6a2009-12-04 20:57:17 +000066 }
67};
68
69} // namespace chromeos_update_engine
70
71#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__