From 670c433050ebf1ecbb0003171dc359d42679e35e Mon Sep 17 00:00:00 2001
From: Radoslaw Zarzynski <rzarzyns@redhat.com>
Date: Mon, 13 Jul 2020 14:43:33 +0200
Subject: [PATCH] crimson/osd: do not refence PGLog in BackfillState.

This commit makes the backfill code unware about pg log
implementation details. The benefit is easier unit testing.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
---
 src/crimson/osd/backfill_facades.h | 7 +++++--
 src/crimson/osd/backfill_state.cc  | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/crimson/osd/backfill_facades.h b/src/crimson/osd/backfill_facades.h
index ddebfced603..21b18a8b3b0 100644
--- a/src/crimson/osd/backfill_facades.h
+++ b/src/crimson/osd/backfill_facades.h
@@ -35,9 +35,12 @@ struct BackfillState::PeeringFacade {
     return peering_state.get_info().log_tail;
   }
 
-  decltype(auto) get_pg_log() const {
-    return peering_state.get_pg_log();
+  template <class... Args>
+  void scan_log_after(Args&&... args) const {
+    peering_state.get_pg_log().get_log().scan_log_after(
+      std::forward<Args>(args)...);
   }
+
   bool is_backfill_target(pg_shard_t peer) const {
     return peering_state.is_backfill_target(peer);
   }
diff --git a/src/crimson/osd/backfill_state.cc b/src/crimson/osd/backfill_state.cc
index 3d1191ec9c0..3a173a75758 100644
--- a/src/crimson/osd/backfill_state.cc
+++ b/src/crimson/osd/backfill_state.cc
@@ -127,7 +127,7 @@ void BackfillState::Enqueuing::maybe_update_range()
                    primary_bi.version,
                    pg().get_projected_last_update());
     logger().debug("{}: scanning pg log first", __func__);
-    peering_state().get_pg_log().get_log().scan_log_after(primary_bi.version,
+    peering_state().scan_log_after(primary_bi.version,
       [&](const pg_log_entry_t& e) {
         logger().debug("maybe_update_range(lambda): updating from version {}",
                        e.version);