Browse Source

Remove empty code in lib/cache and the corresponding suppression rule in src/cppcheck-suppress.lst

zhanglikun 14 years ago
parent
commit
8c6a400b68

+ 0 - 5
src/cppcheck-suppress.lst

@@ -4,11 +4,6 @@ debug
 missingInclude
 missingInclude
 // This is a template, and should be excluded from the check
 // This is a template, and should be excluded from the check
 unreadVariable:src/lib/dns/rdata/template.cc:60
 unreadVariable:src/lib/dns/rdata/template.cc:60
-// These three trigger warnings due to the incomplete implementation.  This is
-// our problem, but we need to suppress the warnings for now.
-functionConst:src/lib/cache/resolver_cache.h
-functionConst:src/lib/cache/message_cache.h
-functionConst:src/lib/cache/rrset_cache.h
 // Intentional self assignment tests.  Suppress warning about them.
 // Intentional self assignment tests.  Suppress warning about them.
 selfAssignment:src/lib/dns/tests/name_unittest.cc:293
 selfAssignment:src/lib/dns/tests/name_unittest.cc:293
 selfAssignment:src/lib/dns/tests/rdata_unittest.cc:228
 selfAssignment:src/lib/dns/tests/rdata_unittest.cc:228

+ 3 - 2
src/lib/cache/TODO

@@ -12,7 +12,8 @@
 * When the rrset beging updated is an NS rrset, NSAS should be updated
 * When the rrset beging updated is an NS rrset, NSAS should be updated
   together.
   together.
 * Share the NXDOMAIN info between different type queries. current implementation
 * Share the NXDOMAIN info between different type queries. current implementation
-  can only cache for the type that user quired, for example, if user query A 
+  can only cache for the type that user quired, for example, if user query A
   record of a.example. and the server replied with NXDOMAIN, this should be
   record of a.example. and the server replied with NXDOMAIN, this should be
   cached for all the types queries of a.example.
   cached for all the types queries of a.example.
-
+* Add the interfaces for resizing and serialization(loading and dumping) to
+  cache.

+ 0 - 18
src/lib/cache/message_cache.cc

@@ -97,24 +97,6 @@ MessageCache::update(const Message& msg) {
     return (message_table_.add(msg_entry, entry_key, true));
     return (message_table_.add(msg_entry, entry_key, true));
 }
 }
 
 
-#if 0
-void
-MessageCache::dump(const std::string&) {
-    //TODO
-}
-
-void
-MessageCache::load(const std::string&) {
-    //TODO
-}
-
-bool
-MessageCache::resize(uint32_t) {
-    //TODO
-    return (true);
-}
-#endif
-
 } // namespace cache
 } // namespace cache
 } // namespace isc
 } // namespace isc
 
 

+ 2 - 14
src/lib/cache/message_cache.h

@@ -30,6 +30,8 @@ namespace cache {
 /// The object of MessageCache represents the cache for class-specific
 /// The object of MessageCache represents the cache for class-specific
 /// messages.
 /// messages.
 ///
 ///
+/// \todo The message cache class should provide the interfaces for
+///       loading, dumping and resizing.
 class MessageCache {
 class MessageCache {
 // Noncopyable
 // Noncopyable
 private:
 private:
@@ -64,20 +66,6 @@ public:
     /// If the message doesn't exist in the cache, it will be added
     /// If the message doesn't exist in the cache, it will be added
     /// directly.
     /// directly.
     bool update(const isc::dns::Message& msg);
     bool update(const isc::dns::Message& msg);
-
-#if 0
-    /// \brief Dump the message cache to specified file.
-    /// \todo It should can be dumped to one configured database.
-    void dump(const std::string& file_name);
-
-    /// \brief Load the cache from one file.
-    /// \todo It should can be loaded from one configured database.
-    void load(const std::string& file_name);
-
-    /// \brief Resize the size of message cache in runtime.
-    bool resize(uint32_t size);
-#endif
-
 protected:
 protected:
     /// \brief Get the hash key for the message entry in the cache.
     /// \brief Get the hash key for the message entry in the cache.
     /// \param name query name of the message.
     /// \param name query name of the message.

+ 3 - 17
src/lib/cache/resolver_cache.h

@@ -76,6 +76,9 @@ public:
 ///
 ///
 /// \note Public interaction with the cache should be through ResolverCache,
 /// \note Public interaction with the cache should be through ResolverCache,
 /// not directly with this one. (TODO: make this private/hidden/local to the .cc?)
 /// not directly with this one. (TODO: make this private/hidden/local to the .cc?)
+///
+/// \todo The resolver cache class should provide the interfaces for
+///       loading, dumping and resizing.
 class ResolverClassCache {
 class ResolverClassCache {
 public:
 public:
     /// \brief Default Constructor.
     /// \brief Default Constructor.
@@ -300,23 +303,6 @@ public:
     ///
     ///
     bool update(const isc::dns::ConstRRsetPtr& rrset_ptr);
     bool update(const isc::dns::ConstRRsetPtr& rrset_ptr);
 
 
-    /// \name Cache Serialization
-    //@{
-    /// \brief Dump the cache content to one file.
-    ///
-    /// \param file_name file to write to
-    ///
-    /// \todo It should can be dumped to one configured database.
-    void dump(const std::string& file_name);
-
-    /// \brief Load the cache from one file.
-    ///
-    /// \param file to load from
-    ///
-    /// \todo It should can be loaded from one configured database.
-    void load(const std::string& file_name);
-    //@}
-
 private:
 private:
     /// \brief Returns the class-specific subcache
     /// \brief Returns the class-specific subcache
     ///
     ///

+ 0 - 18
src/lib/cache/rrset_cache.cc

@@ -79,24 +79,6 @@ RRsetCache::update(const isc::dns::RRset& rrset, const RRsetTrustLevel& level) {
     return (entry_ptr);
     return (entry_ptr);
 }
 }
 
 
-#if 0
-void
-RRsetCache::dump(const std::string&) {
-    //TODO
-}
-
-void
-RRsetCache::load(const std::string&) {
-    //TODO
-}
-
-bool
-RRsetCache::resize(uint32_t) {
-    //TODO
-    return (true);
-}
-#endif
-
 } // namespace cache
 } // namespace cache
 } // namespace isc
 } // namespace isc
 
 

+ 3 - 22
src/lib/cache/rrset_cache.h

@@ -30,6 +30,9 @@ class RRsetEntry;
 /// \brief RRset Cache
 /// \brief RRset Cache
 /// The object of RRsetCache represented the cache for class-specific
 /// The object of RRsetCache represented the cache for class-specific
 /// RRsets.
 /// RRsets.
+///
+/// \todo The rrset cache class should provide the interfaces for
+///       loading, dumping and resizing.
 class RRsetCache{
 class RRsetCache{
     ///
     ///
     /// \name Constructors and Destructor
     /// \name Constructors and Destructor
@@ -73,28 +76,6 @@ public:
     RRsetEntryPtr update(const isc::dns::RRset& rrset,
     RRsetEntryPtr update(const isc::dns::RRset& rrset,
                          const RRsetTrustLevel& level);
                          const RRsetTrustLevel& level);
 
 
-#if 0
-    /// \brief Dump the rrset cache to specified file.
-    ///
-    /// \param file_name The file to write to
-    ///
-    /// \todo It should can be dumped to one configured database.
-    void dump(const std::string& file_name);
-
-    /// \brief Load the cache from one file.
-    ///
-    /// \param file_name The file to read from
-    ///
-    /// \todo It should can be loaded from one configured database.
-    void load(const std::string& file_name);
-
-    /// \brief Resize the size of rrset cache in runtime.
-    ///
-    /// \param The size to resize to
-    /// \return true
-    bool resize(uint32_t size);
-#endif
-
     /// \short Protected memebers, so they can be accessed by tests.
     /// \short Protected memebers, so they can be accessed by tests.
 protected:
 protected:
     uint16_t class_; // The class of the rrset cache.
     uint16_t class_; // The class of the rrset cache.