]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Views now have a 'cache' field. The 'cachedb' field still
authorAndreas Gustafsson <source@isc.org>
Thu, 2 Dec 1999 22:38:34 +0000 (22:38 +0000)
committerAndreas Gustafsson <source@isc.org>
Thu, 2 Dec 1999 22:38:34 +0000 (22:38 +0000)
exists as a convenience shortcut / backwards compatibility thing.

bin/named/server.c
bin/tests/adb_test.c
lib/dns/include/dns/view.h
lib/dns/view.c

index 55debbed59d3bacdc8ced6c543b2e7840d3f61ee..38ec90d75e63d9d71eb07efffdb82c4a8a992081 100644 (file)
@@ -35,6 +35,7 @@
 #include <isc/app.h>
 #include <isc/dir.h>
 
+#include <dns/cache.h>
 #include <dns/confparser.h>
 #include <dns/types.h>
 #include <dns/result.h>
@@ -77,7 +78,8 @@ create_default_view(isc_mem_t *mctx, dns_rdataclass_t rdclass,
                    dns_view_t **viewp)
 {
        dns_view_t *view;
-       dns_db_t *db;
+       dns_cache_t *cache;
+       
        isc_result_t result;
 
        REQUIRE(viewp != NULL && *viewp == NULL);
@@ -93,13 +95,13 @@ create_default_view(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        /*
         * Cache.
         */
-       db = NULL;
-       result = dns_db_create(mctx, "rbt", dns_rootname, ISC_TRUE,
-                              rdclass, 0, NULL, &db);
+       cache = NULL;
+       result = dns_cache_create(mctx, ns_g_taskmgr, ns_g_timermgr, rdclass,
+                                 "rbt", 0, NULL, &cache);
        if (result != ISC_R_SUCCESS)
                goto cleanup;
-       dns_view_setcachedb(view, db);
-       dns_db_detach(&db);
+       dns_view_setcache(view, cache);
+       dns_cache_detach(&cache);
 
        /*
         * XXXRTH  Temporary support for loading cache contents.
index 3f5b528367c2c75b64647b35d2f3a6985c1194fa..6d76483804ae120b2529d9941bcfeff098d8bc2f 100644 (file)
@@ -36,6 +36,7 @@
 #include <isc/net.h>
 
 #include <dns/adb.h>
+#include <dns/cache.h>
 #include <dns/db.h>
 #include <dns/master.h>
 #include <dns/name.h>
@@ -253,7 +254,7 @@ create_managers(void)
 void
 create_view(void)
 {
-       dns_db_t *db;
+       dns_cache_t *cache;
        isc_result_t result;
 
        /*
@@ -266,12 +267,12 @@ create_view(void)
        /*
         * Cache.
         */
-       db = NULL;
-       result = dns_db_create(mctx, "rbt", dns_rootname, ISC_TRUE,
-                              dns_rdataclass_in, 0, NULL, &db);
-       check_result(result, "dns_view_create");
-       dns_view_setcachedb(view, db);
-       dns_db_detach(&db);
+       cache = NULL;
+       result = dns_cache_create(mctx, taskmgr, timermgr, dns_rdataclass_in,
+                                 "rbt", 0, NULL, &cache);
+       check_result(result, "dns_cache_create");
+       dns_view_setcache(view, cache);
+       dns_cache_detach(&cache);
 
        /*
         * Resolver.
index 6c3573165632a72e8c21bfb4138092302c14443b..1e41e2a6147ac88cdf8e0b36be8f1c9b30058564 100644 (file)
@@ -80,6 +80,7 @@ struct dns_view {
        dns_zt_t *                      zonetable;
        dns_resolver_t *                resolver;
        dns_adb_t *                     adb;
+       dns_cache_t *                   cache;
        dns_db_t *                      cachedb;
        dns_db_t *                      hints;
        dns_rbt_t *                     secroots;
@@ -191,27 +192,22 @@ dns_view_createresolver(dns_view_t *view,
  */
 
 void
-dns_view_setcachedb(dns_view_t *view, dns_db_t *cachedb);
+dns_view_setcache(dns_view_t *view, dns_cache_t *cache);
 /*
  * Set the view's cache database.
  *
- * Note:
- *
- *     WARNING!  THIS ROUTINE WILL BE REPLACED WITH dns_view_setcache()
- *     WHEN WE HAVE INTEGRATED CACHE OBJECT SUPPORT INTO THE LIBRARY.
- *
  * Requires:
  *
  *     'view' is a valid, unfrozen view.
  *
- *     'cachedb' is a valid cache database.
+ *     'cache' is a valid cache.
  *
  * Ensures:
  *
- *             The cache database of 'view' is 'cachedb'.
+ *             The cache of 'view' is 'cached.
  *
- *     If this is not the first call to dns_view_setcachedb() for this
- *     view, then previously set db is detached.
+ *     If this is not the first call to dns_view_setcache() for this
+ *     view, then previously set cache is detached.
  */
 
 void
index 03dae967c5f9149d6ead9c1005937c54c893fb6b..5f636e157cdd812211118f0bce6ff44f7d41fe83 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <dns/types.h>
 #include <dns/adb.h>
+#include <dns/cache.h>
 #include <dns/dbtable.h>
 #include <dns/db.h>
 #include <dns/events.h>
@@ -93,6 +94,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
                goto cleanup_zt;
        }
 
+       view->cache = NULL;
        view->cachedb = NULL;
        view->hints = NULL;
        view->resolver = NULL;
@@ -169,6 +171,8 @@ destroy(dns_view_t *view) {
                dns_db_detach(&view->hints);
        if (view->cachedb != NULL)
                dns_db_detach(&view->cachedb);
+       if (view->cache != NULL)
+               dns_cache_detach(&view->cache);
        dns_zt_detach(&view->zonetable);
        dns_rbt_destroy(&view->secroots);
        isc_mutex_destroy(&view->lock);
@@ -310,24 +314,22 @@ dns_view_createresolver(dns_view_t *view,
 }
 
 void
-dns_view_setcachedb(dns_view_t *view, dns_db_t *cachedb) {
+dns_view_setcache(dns_view_t *view, dns_cache_t *cache) {
 
        /*
-        * Set the view's cache database.
-        */
-
-       /*
-        * WARNING!  THIS ROUTINE WILL BE REPLACED WITH dns_view_setcache()
-        * WHEN WE HAVE INTEGRATED CACHE OBJECT SUPPORT INTO THE LIBRARY.
+        * Set the view's cache.
         */
 
        REQUIRE(DNS_VIEW_VALID(view));
        REQUIRE(!view->frozen);
-       REQUIRE(dns_db_iscache(cachedb));
 
-       if (view->cachedb != NULL)
+       if (view->cache != NULL) {
                dns_db_detach(&view->cachedb);
-       dns_db_attach(cachedb, &view->cachedb);
+               dns_cache_detach(&view->cache);
+       }
+       dns_cache_attach(cache, &view->cache);
+       dns_cache_attachdb(cache, &view->cachedb);
+       INSIST(DNS_DB_VALID(view->cachedb));
 }
 
 void