blob: 9151e1b88546559fd43ab3061693d04799dd2309 [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 Reyes1e338b82010-01-22 14:57:27 -080020 const std::string& install_path)
adlr@google.com3defe6a2009-12-04 20:57:17 +000021 : is_full_update(is_full),
22 download_url(url),
23 download_hash(hash),
Andrew de los Reyes1e338b82010-01-22 14:57:27 -080024 install_path(install_path) {}
adlr@google.com3defe6a2009-12-04 20:57:17 +000025 InstallPlan() : is_full_update(false) {}
26
27 bool is_full_update;
28 std::string download_url; // url to download from
29 std::string download_hash; // hash of the data at the url
adlr@google.com3defe6a2009-12-04 20:57:17 +000030 std::string install_path; // path to install device
31
32 bool operator==(const InstallPlan& that) const {
33 return (is_full_update == that.is_full_update) &&
34 (download_url == that.download_url) &&
35 (download_hash == that.download_hash) &&
adlr@google.com3defe6a2009-12-04 20:57:17 +000036 (install_path == that.install_path);
37 }
38 bool operator!=(const InstallPlan& that) const {
39 return !((*this) == that);
40 }
41 void Dump() const {
42 LOG(INFO) << "InstallPlan: "
43 << (is_full_update ? "full_update" : "delta_update")
44 << ", url: " << download_url << ", hash: " << download_hash
adlr@google.com3defe6a2009-12-04 20:57:17 +000045 << ", install_path: " << install_path;
46 }
47};
48
49} // namespace chromeos_update_engine
50
51#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__