exists as a convenience shortcut / backwards compatibility thing.
#include <isc/app.h>
#include <isc/dir.h>
+#include <dns/cache.h>
#include <dns/confparser.h>
#include <dns/types.h>
#include <dns/result.h>
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);
/*
* 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.
#include <isc/net.h>
#include <dns/adb.h>
+#include <dns/cache.h>
#include <dns/db.h>
#include <dns/master.h>
#include <dns/name.h>
void
create_view(void)
{
- dns_db_t *db;
+ dns_cache_t *cache;
isc_result_t result;
/*
/*
* 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.
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;
*/
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
#include <dns/types.h>
#include <dns/adb.h>
+#include <dns/cache.h>
#include <dns/dbtable.h>
#include <dns/db.h>
#include <dns/events.h>
goto cleanup_zt;
}
+ view->cache = NULL;
view->cachedb = NULL;
view->hints = NULL;
view->resolver = NULL;
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);
}
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