Auto-register prefixes for inserted data

Now it is actually working

Change-Id: Ifcc46a765fa399b10d05f6a98c23c753f57d9f0a
Refs: #4247
diff --git a/src/storage/repo-storage.cpp b/src/storage/repo-storage.cpp
index d3834ba..148116b 100644
--- a/src/storage/repo-storage.cpp
+++ b/src/storage/repo-storage.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -22,13 +22,11 @@
 
 #include <istream>
 
+#include <ndn-cxx/util/logger.hpp>
+
 namespace repo {
 
-static void
-insertItemToIndex(Index* index, const Storage::ItemMeta& item)
-{
-  index->insert(item.fullName, item.id, item.keyLocatorHash);
-}
+NDN_LOG_INIT(repo.RepoStorage);
 
 RepoStorage::RepoStorage(const int64_t& nMaxPackets, Storage& store)
   : m_index(nMaxPackets)
@@ -39,7 +37,16 @@
 void
 RepoStorage::initialize()
 {
-  m_storage.fullEnumerate(bind(&insertItemToIndex, &m_index, _1));
+  NDN_LOG_DEBUG("Initialize");
+  m_storage.fullEnumerate(bind(&RepoStorage::insertItemToIndex, this, _1));
+}
+
+void
+RepoStorage::insertItemToIndex(const Storage::ItemMeta& item)
+{
+  NDN_LOG_DEBUG("Insert data to index " << item.fullName);
+  m_index.insert(item.fullName, item.id, item.keyLocatorHash);
+  afterDataInsertion(item.fullName);
 }
 
 bool
diff --git a/src/storage/repo-storage.hpp b/src/storage/repo-storage.hpp
index bf3ade8..ec5faa7 100644
--- a/src/storage/repo-storage.hpp
+++ b/src/storage/repo-storage.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California.
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -90,6 +90,10 @@
   std::shared_ptr<Data>
   readData(const Interest& interest) const;
 
+private:
+  void
+  insertItemToIndex(const Storage::ItemMeta& item);
+
 public:
   ndn::util::Signal<RepoStorage, ndn::Name> afterDataInsertion;
   ndn::util::Signal<RepoStorage, ndn::Name> afterDataDeletion;