blob: 19fee8a2add02312b6cc583cb3552c83043bf3ef [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>
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,
18 const std::string& url,
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070019 uint64_t size,
adlr@google.com3defe6a2009-12-04 20:57:17 +000020 const std::string& hash,
Andrew de los Reyesf9185172010-05-03 11:07:05 -070021 const std::string& install_path,
22 const std::string& kernel_install_path)
adlr@google.com3defe6a2009-12-04 20:57:17 +000023 : is_full_update(is_full),
24 download_url(url),
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070025 size(size),
adlr@google.com3defe6a2009-12-04 20:57:17 +000026 download_hash(hash),
Andrew de los Reyesf9185172010-05-03 11:07:05 -070027 install_path(install_path),
28 kernel_install_path(kernel_install_path) {}
adlr@google.com3defe6a2009-12-04 20:57:17 +000029 InstallPlan() : is_full_update(false) {}
30
31 bool is_full_update;
32 std::string download_url; // url to download from
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070033 uint64_t size; // size of the download url's data
adlr@google.com3defe6a2009-12-04 20:57:17 +000034 std::string download_hash; // hash of the data at the url
adlr@google.com3defe6a2009-12-04 20:57:17 +000035 std::string install_path; // path to install device
Andrew de los Reyesf9185172010-05-03 11:07:05 -070036 std::string kernel_install_path; // path to kernel install device
adlr@google.com3defe6a2009-12-04 20:57:17 +000037
38 bool operator==(const InstallPlan& that) const {
39 return (is_full_update == that.is_full_update) &&
40 (download_url == that.download_url) &&
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070041 (size == that.size) &&
adlr@google.com3defe6a2009-12-04 20:57:17 +000042 (download_hash == that.download_hash) &&
Andrew de los Reyesf9185172010-05-03 11:07:05 -070043 (install_path == that.install_path) &&
44 (kernel_install_path == that.kernel_install_path);
adlr@google.com3defe6a2009-12-04 20:57:17 +000045 }
46 bool operator!=(const InstallPlan& that) const {
47 return !((*this) == that);
48 }
49 void Dump() const {
50 LOG(INFO) << "InstallPlan: "
51 << (is_full_update ? "full_update" : "delta_update")
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070052 << ", url: " << download_url
53 << ", size: " << size
54 << ", hash: " << download_hash
Andrew de los Reyesf9185172010-05-03 11:07:05 -070055 << ", install_path: " << install_path
56 << ", kernel_install_path: " << kernel_install_path;
adlr@google.com3defe6a2009-12-04 20:57:17 +000057 }
58};
59
60} // namespace chromeos_update_engine
61
62#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__