| Kelvin Zhang | 9b10dba | 2020-09-25 17:09:11 -0400 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2020 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 | // | 
| Kelvin Zhang | 9754f17 | 2020-09-25 15:22:35 -0400 | [diff] [blame] | 16 |  | 
| Kelvin Zhang | 433d6c4 | 2021-03-31 22:26:59 -0400 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_SNAPSHOT_EXTENT_WRITER_H_ | 
|  | 18 | #define UPDATE_ENGINE_SNAPSHOT_EXTENT_WRITER_H_ | 
|  | 19 |  | 
| Kelvin Zhang | 9b10dba | 2020-09-25 17:09:11 -0400 | [diff] [blame] | 20 | #include <cstdint> | 
|  | 21 | #include <vector> | 
|  | 22 |  | 
|  | 23 | #include <libsnapshot/cow_writer.h> | 
|  | 24 |  | 
| Kelvin Zhang | b170676 | 2021-06-25 15:05:22 -0400 | [diff] [blame] | 25 | #include "update_engine/payload_consumer/block_extent_writer.h" | 
| Kelvin Zhang | 9754f17 | 2020-09-25 15:22:35 -0400 | [diff] [blame] | 26 | #include "update_engine/update_metadata.pb.h" | 
| Kelvin Zhang | 9b10dba | 2020-09-25 17:09:11 -0400 | [diff] [blame] | 27 |  | 
|  | 28 | namespace chromeos_update_engine { | 
| Kelvin Zhang | 9754f17 | 2020-09-25 15:22:35 -0400 | [diff] [blame] | 29 |  | 
| Kelvin Zhang | b170676 | 2021-06-25 15:05:22 -0400 | [diff] [blame] | 30 | class SnapshotExtentWriter final : public BlockExtentWriter { | 
| Kelvin Zhang | 9b10dba | 2020-09-25 17:09:11 -0400 | [diff] [blame] | 31 | public: | 
| Kelvin Zhang | b170676 | 2021-06-25 15:05:22 -0400 | [diff] [blame] | 32 | explicit SnapshotExtentWriter(android::snapshot::ICowWriter* cow_writer) | 
|  | 33 | : cow_writer_(cow_writer) {} | 
|  | 34 | bool WriteExtent(const void* bytes, | 
|  | 35 | const Extent& extent, | 
|  | 36 | size_t block_size) override; | 
| Kelvin Zhang | 9b10dba | 2020-09-25 17:09:11 -0400 | [diff] [blame] | 37 |  | 
|  | 38 | private: | 
| Kelvin Zhang | 9754f17 | 2020-09-25 15:22:35 -0400 | [diff] [blame] | 39 | android::snapshot::ICowWriter* cow_writer_; | 
| Kelvin Zhang | 9b10dba | 2020-09-25 17:09:11 -0400 | [diff] [blame] | 40 | }; | 
| Kelvin Zhang | 9754f17 | 2020-09-25 15:22:35 -0400 | [diff] [blame] | 41 |  | 
| Kelvin Zhang | 9b10dba | 2020-09-25 17:09:11 -0400 | [diff] [blame] | 42 | }  // namespace chromeos_update_engine | 
| Kelvin Zhang | 433d6c4 | 2021-03-31 22:26:59 -0400 | [diff] [blame] | 43 |  | 
|  | 44 | #endif |