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 28 namespace chromeos_update_engine { 29 30 class OperationsGenerator { 31 public: 32 virtual ~OperationsGenerator() = default; 33 34 // This method generates a list of operations to update from the partition 35 // |old_part| to |new_part| and stores the generated operations in |aops|. 36 // These operations are generated based on the given |config|. 37 // The operations should be applied in the order specified in the list, and 38 // they respect the payload version and type (delta or full) specified in 39 // |config|. 40 // The operations generated will refer to offsets in the file |blob_file|, 41 // where this function stores the output, but not necessarily in the same 42 // order as they appear in the |aops|. 43 virtual bool GenerateOperations( 44 const PayloadGenerationConfig& config, 45 const PartitionConfig& old_part, 46 const PartitionConfig& new_part, 47 BlobFileWriter* blob_file, 48 std::vector<AnnotatedOperation>* aops) = 0; 49 50 protected: 51 OperationsGenerator() = default; 52 53 private: 54 DISALLOW_COPY_AND_ASSIGN(OperationsGenerator); 55 }; 56 57 } // namespace chromeos_update_engine 58 59 #endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_OPERATIONS_GENERATOR_H_ 60