operations_generator.h revision aea4c1cea20dda7ae7e85fc8924a2d784f70d806
1// 2// Copyright (C) 2015 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_OPERATIONS_GENERATOR_H_ 18#define UPDATE_ENGINE_PAYLOAD_GENERATOR_OPERATIONS_GENERATOR_H_ 19 20#include <vector> 21 22#include <base/macros.h> 23 24#include "update_engine/payload_generator/annotated_operation.h" 25#include "update_engine/payload_generator/blob_file_writer.h" 26#include "update_engine/payload_generator/payload_generation_config.h" 27 28namespace chromeos_update_engine { 29 30class OperationsGenerator { 31 public: 32 virtual ~OperationsGenerator() = default; 33 34 // This method generates two lists of operations, one for the rootfs and one 35 // for the kernel and stores the generated operations in |rootfs_ops| and 36 // |kernel_ops| respectivelly. These operations are generated based on the 37 // given |config|. The operations should be applied in the order specified in 38 // the list, and they respect the payload version and type (delta or full) 39 // specified in |config|. 40 // The operations generated will refer to offsets in the file |data_file_fd|, 41 // where this function stores the output, but not necessarily in the same 42 // order as they appear in the |rootfs_ops| and |kernel_ops|. 43 // This function stores the amount of data written to |data_file_fd| in 44 // |data_file_size|. 45 virtual bool GenerateOperations( 46 const PayloadGenerationConfig& config, 47 BlobFileWriter* blob_file, 48 std::vector<AnnotatedOperation>* rootfs_ops, 49 std::vector<AnnotatedOperation>* kernel_ops) = 0; 50 51 protected: 52 OperationsGenerator() = default; 53 54 private: 55 DISALLOW_COPY_AND_ASSIGN(OperationsGenerator); 56}; 57 58} // namespace chromeos_update_engine 59 60#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_OPERATIONS_GENERATOR_H_ 61