blob: 81893d871a18a38937859f3765aab4605f62378a [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,
20 const std::string& d_path,
21 const std::string& i_path)
22 : is_full_update(is_full),
23 download_url(url),
24 download_hash(hash),
25 download_path(d_path),
26 install_path(i_path) {}
27 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
32 std::string download_path; // path to downloaded file from Omaha
33 std::string install_path; // path to install device
34
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) &&
39 (download_path == that.download_path) &&
40 (install_path == that.install_path);
41 }
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
49 << ", path: " << download_path
50 << ", install_path: " << install_path;
51 }
52};
53
54} // namespace chromeos_update_engine
55
56#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__