Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c757b578 authored by Alessio Balsini's avatar Alessio Balsini Committed by Automerger Merge Worker
Browse files

libsnapshot: Export COW image size am: 02e639d1

Change-Id: Icb741f3a9454a4e54cbb31e444272b6042a1340c
parents aa5ee421 02e639d1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -140,4 +140,7 @@ message SnapshotMergeReport {
    // Number of reboots that occurred after issuing and before completeing the
    // merge of all the snapshot devices.
    int32 resume_count = 2;

    // Total size of all the COW images before the update.
    uint64 cow_file_size = 4;
}
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class MockSnapshotManager : public ISnapshotManager {
    MOCK_METHOD(bool, BeginUpdate, (), (override));
    MOCK_METHOD(bool, CancelUpdate, (), (override));
    MOCK_METHOD(bool, FinishedSnapshotWrites, (bool wipe), (override));
    MOCK_METHOD(bool, InitiateMerge, (), (override));
    MOCK_METHOD(bool, InitiateMerge, (uint64_t * cow_file_size), (override));

    MOCK_METHOD(UpdateState, ProcessUpdateState,
                (const std::function<bool()>& callback, const std::function<bool()>& before_cancel),
+2 −2
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ class ISnapshotManager {

    // Initiate a merge on all snapshot devices. This should only be used after an
    // update has been marked successful after booting.
    virtual bool InitiateMerge() = 0;
    virtual bool InitiateMerge(uint64_t* cow_file_size = nullptr) = 0;

    // Perform any necessary post-boot actions. This should be run soon after
    // /data is mounted.
@@ -281,7 +281,7 @@ class SnapshotManager final : public ISnapshotManager {
    bool BeginUpdate() override;
    bool CancelUpdate() override;
    bool FinishedSnapshotWrites(bool wipe) override;
    bool InitiateMerge() override;
    bool InitiateMerge(uint64_t* cow_file_size = nullptr) override;
    UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
                                   const std::function<bool()>& before_cancel = {}) override;
    UpdateState GetUpdateState(double* progress = nullptr) override;
+4 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ class ISnapshotMergeStats {
    // Called when merge starts or resumes.
    virtual bool Start() = 0;
    virtual void set_state(android::snapshot::UpdateState state) = 0;
    virtual void set_cow_file_size(uint64_t cow_file_size) = 0;
    virtual uint64_t cow_file_size() = 0;

    // Called when merge ends. Properly clean up permanent storage.
    class Result {
@@ -50,6 +52,8 @@ class SnapshotMergeStats : public ISnapshotMergeStats {
    // ISnapshotMergeStats overrides
    bool Start() override;
    void set_state(android::snapshot::UpdateState state) override;
    void set_cow_file_size(uint64_t cow_file_size) override;
    uint64_t cow_file_size() override;
    std::unique_ptr<Result> Finish() override;

  private:
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class SnapshotManagerStub : public ISnapshotManager {
    bool BeginUpdate() override;
    bool CancelUpdate() override;
    bool FinishedSnapshotWrites(bool wipe) override;
    bool InitiateMerge() override;
    bool InitiateMerge(uint64_t* cow_file_size = nullptr) override;
    UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
                                   const std::function<bool()>& before_cancel = {}) override;
    UpdateState GetUpdateState(double* progress = nullptr) override;
Loading