Parcourir la source

[1067] Rename getIteratorContext to getAllRecords

This will be better for consistency, when we change the searchForRecords
to return an iterator object, it will be called getRecords.
Michal 'vorner' Vaner il y a 13 ans
Parent
commit
fb441884ba

+ 1 - 1
src/lib/datasrc/database.cc

@@ -393,7 +393,7 @@ DatabaseClient::getIterator(const isc::dns::Name& name) const {
     }
     // Request the context
     DatabaseAccessor::IteratorContextPtr
-        context(database_->getIteratorContext(name, zone.second));
+        context(database_->getAllRecords(name, zone.second));
     // It must not return NULL, that's a bug of the implementation
     if (context == DatabaseAccessor::IteratorContextPtr()) {
         isc_throw(isc::Unexpected, "Iterator context null at " +

+ 3 - 3
src/lib/datasrc/database.h

@@ -120,7 +120,7 @@ public:
     typedef boost::shared_ptr<IteratorContext> IteratorContextPtr;
 
     /**
-     * \brief Creates an iterator context for given zone.
+     * \brief Creates an iterator context for the whole zone.
      *
      * This should create a new iterator context to be used by
      * DatabaseConnection's ZoneIterator. It can be created based on the name
@@ -136,8 +136,8 @@ public:
      * \param id The ID of the zone, returned from getZone().
      * \return Newly created iterator context. Must not be NULL.
      */
-    virtual IteratorContextPtr getIteratorContext(const isc::dns::Name& name,
-                                                  int id) const
+    virtual IteratorContextPtr getAllRecords(const isc::dns::Name& name,
+                                             int id) const
     {
         /*
          * This is a compromise. We need to document the parameters in doxygen,

+ 1 - 1
src/lib/datasrc/sqlite3_accessor.cc

@@ -375,7 +375,7 @@ private:
 };
 
 DatabaseAccessor::IteratorContextPtr
-SQLite3Database::getIteratorContext(const isc::dns::Name&, int id) const {
+SQLite3Database::getAllRecords(const isc::dns::Name&, int id) const {
     return (IteratorContextPtr(new Context(shared_from_this(), id)));
 }
 

+ 2 - 2
src/lib/datasrc/sqlite3_accessor.h

@@ -91,8 +91,8 @@ public:
      */
     virtual std::pair<bool, int> getZone(const isc::dns::Name& name) const;
 
-    /// \brief Implementation of DatabaseAbstraction::getIteratorContext
-    virtual IteratorContextPtr getIteratorContext(const isc::dns::Name&,
+    /// \brief Implementation of DatabaseAbstraction::getAllRecords
+    virtual IteratorContextPtr getAllRecords(const isc::dns::Name&,
                                                   int id) const;
     /**
      * \brief Start a new search for the given name in the given zone.

+ 4 - 4
src/lib/datasrc/tests/database_unittest.cc

@@ -171,7 +171,7 @@ private:
         }
     };
 public:
-    virtual IteratorContextPtr getIteratorContext(const Name&, int id) const {
+    virtual IteratorContextPtr getAllRecords(const Name&, int id) const {
         if (id == 42) {
             return (IteratorContextPtr(new MockIteratorContext()));
         } else if (id == 13) {
@@ -391,10 +391,10 @@ private:
     }
 };
 
-// This tests the default getIteratorContext behaviour, throwing NotImplemented
-TEST(DatabaseConnectionTest, getIteratorContext) {
+// This tests the default getAllRecords behaviour, throwing NotImplemented
+TEST(DatabaseConnectionTest, getAllRecords) {
     // The parameters don't matter
-    EXPECT_THROW(NopAccessor().getIteratorContext(Name("."), 1),
+    EXPECT_THROW(NopAccessor().getAllRecords(Name("."), 1),
                  isc::NotImplemented);
 }
 

+ 1 - 1
src/lib/datasrc/tests/sqlite3_accessor_unittest.cc

@@ -110,7 +110,7 @@ TEST_F(SQLite3Access, iterator) {
 
     // Get the iterator context
     DatabaseAccessor::IteratorContextPtr
-        context(db->getIteratorContext(Name("example2.com"), 1));
+        context(db->getAllRecords(Name("example2.com"), 1));
     ASSERT_NE(DatabaseAccessor::IteratorContextPtr(),
               context);