operations_generator.h revision 8cc502dacbccdab96824d42287f230ce04004784
1// Copyright 2015 The Chromium OS 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 UPDATE_ENGINE_PAYLOAD_GENERATOR_OPERATIONS_GENERATOR_H_ 6#define UPDATE_ENGINE_PAYLOAD_GENERATOR_OPERATIONS_GENERATOR_H_ 7 8#include <vector> 9 10#include <base/macros.h> 11 12#include "update_engine/payload_generator/annotated_operation.h" 13#include "update_engine/payload_generator/blob_file_writer.h" 14#include "update_engine/payload_generator/payload_generation_config.h" 15 16namespace chromeos_update_engine { 17 18class OperationsGenerator { 19 public: 20 virtual ~OperationsGenerator() = default; 21 22 // This method generates two lists of operations, one for the rootfs and one 23 // for the kernel and stores the generated operations in |rootfs_ops| and 24 // |kernel_ops| respectivelly. These operations are generated based on the 25 // given |config|. The operations should be applied in the order specified in 26 // the list, and they respect the payload version and type (delta or full) 27 // specified in |config|. 28 // The operations generated will refer to offsets in the file |data_file_fd|, 29 // where this function stores the output, but not necessarily in the same 30 // order as they appear in the |rootfs_ops| and |kernel_ops|. 31 // This function stores the amount of data written to |data_file_fd| in 32 // |data_file_size|. 33 virtual bool GenerateOperations( 34 const PayloadGenerationConfig& config, 35 BlobFileWriter* blob_file, 36 std::vector<AnnotatedOperation>* rootfs_ops, 37 std::vector<AnnotatedOperation>* kernel_ops) = 0; 38 39 protected: 40 OperationsGenerator() = default; 41 42 private: 43 DISALLOW_COPY_AND_ASSIGN(OperationsGenerator); 44}; 45 46} // namespace chromeos_update_engine 47 48#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_OPERATIONS_GENERATOR_H_ 49