#include <config.h>
#include <isc/json.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/stats.h>
#include <isc/task.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/xml.h>
#include <dns/cache.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/events.h>
#include <dns/lib.h>
#include <dns/log.h>
#include <dns/masterdump.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/result.h>
#include <dns/stats.h>
#include "rbtdb.h"
Go to the source code of this file.
Data Structures | |
struct | cache_cleaner |
Accesses to a cache cleaner object are synchronized through task/event serialization, or locked from the cache object. More... | |
struct | dns_cache |
The actual cache object. More... | |
struct | cache_dumparg |
Defines | |
#define | CACHE_MAGIC ISC_MAGIC('$', '$', '$', '$') |
#define | VALID_CACHE(cache) ISC_MAGIC_VALID(cache, CACHE_MAGIC) |
#define | DNS_CACHE_MINSIZE 2097152U |
Bytes. 2097152 = 2 MB. | |
#define | DNS_CACHE_CLEANERINCREMENT 1000U |
Number of nodes. | |
#define | CLEANER_IDLE(c) |
#define | CLEANER_BUSY(c) |
Typedefs | |
typedef struct cache_cleaner | cache_cleaner_t |
typedef struct cache_dumparg | cache_dumparg_t |
Enumerations | |
enum | cleaner_state_t { cleaner_s_idle, cleaner_s_busy, cleaner_s_done } |
Functions | |
static isc_result_t | cache_cleaner_init (dns_cache_t *cache, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, cache_cleaner_t *cleaner) |
static void | cleaning_timer_action (isc_task_t *task, isc_event_t *event) |
static void | incremental_cleaning_action (isc_task_t *task, isc_event_t *event) |
static void | cleaner_shutdown_action (isc_task_t *task, isc_event_t *event) |
static void | overmem_cleaning_action (isc_task_t *task, isc_event_t *event) |
static isc_result_t | cache_create_db (dns_cache_t *cache, dns_db_t **db) |
isc_result_t | dns_cache_create (isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, const char *db_type, unsigned int db_argc, char **db_argv, dns_cache_t **cachep) |
isc_result_t | dns_cache_create2 (isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, const char *cachename, const char *db_type, unsigned int db_argc, char **db_argv, dns_cache_t **cachep) |
isc_result_t | dns_cache_create3 (isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, const char *cachename, const char *db_type, unsigned int db_argc, char **db_argv, dns_cache_t **cachep) |
Create a new DNS cache. | |
static void | cache_free (dns_cache_t *cache) |
void | dns_cache_attach (dns_cache_t *cache, dns_cache_t **targetp) |
Attach *targetp to cache. | |
void | dns_cache_detach (dns_cache_t **cachep) |
Detach *cachep from its cache. | |
void | dns_cache_attachdb (dns_cache_t *cache, dns_db_t **dbp) |
Attach *dbp to the cache's database. | |
isc_result_t | dns_cache_setfilename (dns_cache_t *cache, const char *filename) |
If 'filename' is non-NULL, make the cache persistent. The cache's data will be stored in the given file. If 'filename' is NULL, make the cache non-persistent. Files that are no longer used are not unlinked automatically. | |
isc_result_t | dns_cache_load (dns_cache_t *cache) |
If the cache has a file name, load the cache contents from the file. Previous cache contents are not discarded. If no file name has been set, do nothing and return success. | |
isc_result_t | dns_cache_dump (dns_cache_t *cache) |
If the cache has a file name, write the cache contents to disk, overwriting any preexisting file. If no file name has been set, do nothing and return success. | |
void | dns_cache_setcleaninginterval (dns_cache_t *cache, unsigned int t) |
Set the periodic cache cleaning interval to 'interval' seconds. | |
unsigned int | dns_cache_getcleaninginterval (dns_cache_t *cache) |
Get the periodic cache cleaning interval to 'interval' seconds. | |
const char * | dns_cache_getname (dns_cache_t *cache) |
Get the cache name. | |
static void | begin_cleaning (cache_cleaner_t *cleaner) |
static void | end_cleaning (cache_cleaner_t *cleaner, isc_event_t *event) |
isc_result_t | dns_cache_clean (dns_cache_t *cache, isc_stdtime_t now) |
Force immediate cleaning of the cache, freeing all rdatasets whose TTL has expired as of 'now' and that have no pending references. | |
static void | water (void *arg, int mark) |
void | dns_cache_setcachesize (dns_cache_t *cache, size_t size) |
Set the maximum cache size. 0 means unlimited. | |
size_t | dns_cache_getcachesize (dns_cache_t *cache) |
Get the maximum cache size. | |
isc_result_t | dns_cache_flush (dns_cache_t *cache) |
Flushes all data from the cache. | |
static isc_result_t | clearnode (dns_db_t *db, dns_dbnode_t *node) |
static isc_result_t | cleartree (dns_db_t *db, dns_name_t *name) |
isc_result_t | dns_cache_flushname (dns_cache_t *cache, dns_name_t *name) |
isc_result_t | dns_cache_flushnode (dns_cache_t *cache, dns_name_t *name, isc_boolean_t tree) |
isc_stats_t * | dns_cache_getstats (dns_cache_t *cache) |
void | dns_cache_updatestats (dns_cache_t *cache, isc_result_t result) |
static void | getcounter (isc_statscounter_t counter, isc_uint64_t val, void *arg) |
static void | getcounters (isc_stats_t *stats, isc_statsformat_t type, int ncounters, int *indices, isc_uint64_t *values) |
void | dns_cache_dumpstats (dns_cache_t *cache, FILE *fp) |
Definition in file cache.c.
#define CACHE_MAGIC ISC_MAGIC('$', '$', '$', '$') |
#define VALID_CACHE | ( | cache | ) | ISC_MAGIC_VALID(cache, CACHE_MAGIC) |
Definition at line 51 of file cache.c.
Referenced by cache_free(), dns_cache_attach(), dns_cache_attachdb(), dns_cache_clean(), dns_cache_detach(), dns_cache_dump(), dns_cache_dumpstats(), dns_cache_getcachesize(), dns_cache_getcleaninginterval(), dns_cache_getname(), dns_cache_getstats(), dns_cache_load(), dns_cache_setcachesize(), dns_cache_setfilename(), dns_cache_updatestats(), and water().
#define DNS_CACHE_MINSIZE 2097152U |
Bytes. 2097152 = 2 MB.
Control incremental cleaning. DNS_CACHE_MINSIZE is how many bytes is the floor for dns_cache_setcachesize(). See also DNS_CACHE_CLEANERINCREMENT
Definition at line 58 of file cache.c.
Referenced by dns_cache_setcachesize().
#define DNS_CACHE_CLEANERINCREMENT 1000U |
Number of nodes.
Control incremental cleaning. CLEANERINCREMENT is how many nodes are examined in one pass. See also DNS_CACHE_MINSIZE
Definition at line 64 of file cache.c.
Referenced by cache_cleaner_init().
#define CLEANER_IDLE | ( | c | ) |
Value:
((c)->state == cleaner_s_idle && \ (c)->resched_event != NULL)
#define CLEANER_BUSY | ( | c | ) |
Value:
((c)->state == cleaner_s_busy && \ (c)->iterator != NULL && \ (c)->resched_event == NULL)
typedef struct cache_cleaner cache_cleaner_t |
typedef struct cache_dumparg cache_dumparg_t |
enum cleaner_state_t |
static isc_result_t cache_cleaner_init | ( | dns_cache_t * | cache, | |
isc_taskmgr_t * | taskmgr, | |||
isc_timermgr_t * | timermgr, | |||
cache_cleaner_t * | cleaner | |||
) | [static] |
Definition at line 610 of file cache.c.
References cache_cleaner::cache, cleaner_s_idle, cleaner_shutdown_action(), cache_cleaner::cleaning_interval, cache_cleaner::cleaning_timer, cleaning_timer_action(), cleanup(), dns_cache::db, DESTROYLOCK, DNS_CACHE_CLEANERINCREMENT, dns_db_createiterator(), dns_dbiterator_destroy(), DNS_EVENT_CACHECLEAN, DNS_EVENT_CACHEOVERMEM, dns_result_totext(), cache_cleaner::increment, incremental_cleaning_action(), isc_event_allocate(), isc_event_free(), ISC_FALSE, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_task_create(), isc_task_detach(), isc_task_onshutdown(), isc_task_setname(), isc_timer_create(), isc_timer_detach(), isc_timertype_inactive, cache_cleaner::iterator, dns_cache::live_tasks, cache_cleaner::lock, dns_cache::mctx, cache_cleaner::overmem, overmem_cleaning_action(), cache_cleaner::overmem_event, cache_cleaner::replaceiterator, cache_cleaner::resched_event, cache_cleaner::state, cache_cleaner::task, and UNEXPECTED_ERROR.
Referenced by dns_cache_create3().
static void cleaning_timer_action | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 791 of file cache.c.
References begin_cleaning(), cleaner_s_idle, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, INSIST, isc_event_free(), ISC_LOG_DEBUG, isc_log_write(), ISC_TIMEREVENT_TICK, cache_cleaner::state, cache_cleaner::task, and UNUSED.
Referenced by cache_cleaner_init().
static void incremental_cleaning_action | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 859 of file cache.c.
References cache_cleaner::cache, CLEANER_BUSY, cleaner_s_busy, cleaner_s_done, dns_cache::db, dns_db_createiterator(), dns_db_detachnode(), dns_dbiterator_current(), dns_dbiterator_destroy(), dns_dbiterator_first(), dns_dbiterator_next(), dns_dbiterator_pause(), DNS_DBITERATOR_VALID, DNS_EVENT_CACHECLEAN, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_result_totext(), end_cleaning(), cache_cleaner::increment, INSIST, ISC_FALSE, ISC_LOG_DEBUG, isc_log_write(), isc_mem_inuse(), ISC_R_NOMORE, ISC_R_SUCCESS, isc_task_send(), isc_time_now(), cache_cleaner::iterator, cache_cleaner::lock, dns_cache::lock, LOCK, dns_cache::mctx, cache_cleaner::overmem, cache_cleaner::replaceiterator, REQUIRE, RUNTIME_CHECK, start, cache_cleaner::state, cache_cleaner::task, UNEXPECTED_ERROR, UNLOCK, and UNUSED.
Referenced by cache_cleaner_init().
static void cleaner_shutdown_action | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 1103 of file cache.c.
References cache_free(), dns_cache::cleaner, CLEANER_BUSY, cache_cleaner::cleaning_timer, DNS_EVENT_CACHECLEAN, end_cleaning(), INSIST, isc_event_free(), ISC_FALSE, isc_task_purge(), ISC_TASKEVENT_SHUTDOWN, isc_timer_detach(), ISC_TRUE, dns_cache::live_tasks, dns_cache::lock, LOCK, dns_cache::references, cache_cleaner::task, UNLOCK, and UNUSED.
Referenced by cache_cleaner_init().
static void overmem_cleaning_action | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 814 of file cache.c.
References begin_cleaning(), cleaner_s_busy, cleaner_s_done, cleaner_s_idle, DNS_EVENT_CACHEOVERMEM, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, INSIST, ISC_FALSE, ISC_LOG_DEBUG, isc_log_write(), ISC_TRUE, cache_cleaner::lock, LOCK, cache_cleaner::overmem, cache_cleaner::overmem_event, cache_cleaner::state, cache_cleaner::task, UNLOCK, and UNUSED.
Referenced by cache_cleaner_init().
static isc_result_t cache_create_db | ( | dns_cache_t * | cache, | |
dns_db_t ** | db | |||
) | [inline, static] |
Definition at line 173 of file cache.c.
References dns_cache::db_argc, dns_cache::db_argv, dns_cache::db_type, dns_db_create(), dns_dbtype_cache, dns_rootname, dns_cache::mctx, and dns_cache::rdclass.
Referenced by dns_cache_create3(), and dns_cache_flush().
isc_result_t dns_cache_create | ( | isc_mem_t * | cmctx, | |
isc_taskmgr_t * | taskmgr, | |||
isc_timermgr_t * | timermgr, | |||
dns_rdataclass_t | rdclass, | |||
const char * | db_type, | |||
unsigned int | db_argc, | |||
char ** | db_argv, | |||
dns_cache_t ** | cachep | |||
) |
isc_result_t dns_cache_create2 | ( | isc_mem_t * | cmctx, | |
isc_taskmgr_t * | taskmgr, | |||
isc_timermgr_t * | timermgr, | |||
dns_rdataclass_t | rdclass, | |||
const char * | cachename, | |||
const char * | db_type, | |||
unsigned int | db_argc, | |||
char ** | db_argv, | |||
dns_cache_t ** | cachep | |||
) |
isc_result_t dns_cache_create3 | ( | isc_mem_t * | cmctx, | |
isc_mem_t * | hmctx, | |||
isc_taskmgr_t * | taskmgr, | |||
isc_timermgr_t * | timermgr, | |||
dns_rdataclass_t | rdclass, | |||
const char * | cachename, | |||
const char * | db_type, | |||
unsigned int | db_argc, | |||
char ** | db_argv, | |||
dns_cache_t ** | cachep | |||
) |
Create a new DNS cache.
dns_cache_create2() will create a named cache.
dns_cache_create3() will create a named cache using two separate memory contexts, one for cache data which can be cleaned and a separate one for memory allocated for the heap (which can grow without an upper limit and has no mechanism for shrinking).
dns_cache_create() is a backward compatible version that internally specifies an empty cache name and a single memory context.
Requires:
Definition at line 201 of file cache.c.
References cache_cleaner_init(), cache_create_db(), CACHE_MAGIC, dns_cache::cleaner, dns_cache::db, dns_cache::db_argc, dns_cache::db_argv, dns_cache::db_type, DESTROYLOCK, dns_cachestatscounter_max, dns_db_detach(), dns_db_setcachestats(), dns_db_settask(), dns_cache::filelock, dns_cache::filename, dns_cache::hmctx, isc_mem_attach(), isc_mem_detach(), isc_mem_free, isc_mem_get, isc_mem_put, isc_mem_putanddetach, isc_mem_strdup, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_stats_create(), isc_stats_detach(), isc_task_create(), isc_task_detach(), isc_task_setname(), dns_cache::live_tasks, dns_cache::lock, dns_cache::magic, dns_cache::mctx, dns_cache::name, dns_cache::rdclass, dns_cache::references, REQUIRE, and dns_cache::stats.
Referenced by configure_view(), dns_cache_create(), and dns_cache_create2().
static void cache_free | ( | dns_cache_t * | cache | ) | [static] |
Definition at line 360 of file cache.c.
References dns_cache::cleaner, dns_cache::db, dns_cache::db_argc, dns_cache::db_argv, dns_cache::db_type, DESTROYLOCK, dns_db_detach(), dns_dbiterator_destroy(), dns_cache::filelock, dns_cache::filename, dns_cache::hmctx, isc_event_free(), isc_mem_detach(), isc_mem_free, isc_mem_put, isc_mem_putanddetach, isc_mem_setwater(), isc_stats_detach(), isc_task_detach(), cache_cleaner::iterator, dns_cache::lock, cache_cleaner::lock, dns_cache::magic, dns_cache::mctx, dns_cache::name, cache_cleaner::overmem_event, dns_cache::references, REQUIRE, cache_cleaner::resched_event, dns_cache::stats, cache_cleaner::task, and VALID_CACHE.
Referenced by cleaner_shutdown_action(), and dns_cache_detach().
void dns_cache_attach | ( | dns_cache_t * | cache, | |
dns_cache_t ** | targetp | |||
) |
Attach *targetp to cache.
Requires:
Definition at line 424 of file cache.c.
References dns_cache::lock, LOCK, dns_cache::references, REQUIRE, UNLOCK, and VALID_CACHE.
Referenced by configure_view(), and dns_view_setcache2().
void dns_cache_detach | ( | dns_cache_t ** | cachep | ) |
Detach *cachep from its cache.
Requires:
Definition at line 437 of file cache.c.
References cache_free(), dns_cache::cleaner, dns_cache_dump(), dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, ISC_FALSE, ISC_LOG_WARNING, isc_log_write(), ISC_R_SUCCESS, isc_result_totext(), isc_task_shutdown(), ISC_TRUE, dns_cache::live_tasks, dns_cache::lock, LOCK, cache_cleaner::overmem, dns_cache::references, REQUIRE, cache_cleaner::task, UNLOCK, and VALID_CACHE.
Referenced by configure_view(), destroy(), dns_view_setcache2(), load_configuration(), and shutdown_server().
void dns_cache_attachdb | ( | dns_cache_t * | cache, | |
dns_db_t ** | dbp | |||
) |
Attach *dbp to the cache's database.
Notes:
Definition at line 483 of file cache.c.
References dns_cache::db, dns_db_attach(), dns_cache::lock, LOCK, REQUIRE, UNLOCK, and VALID_CACHE.
Referenced by dns_view_flushcache2(), dns_view_setcache2(), and prime_done().
isc_result_t dns_cache_setfilename | ( | dns_cache_t * | cache, | |
const char * | filename | |||
) |
If 'filename' is non-NULL, make the cache persistent. The cache's data will be stored in the given file. If 'filename' is NULL, make the cache non-persistent. Files that are no longer used are not unlinked automatically.
Returns:
Definition at line 495 of file cache.c.
References dns_cache::filelock, dns_cache::filename, isc_mem_free, isc_mem_strdup, ISC_R_NOMEMORY, ISC_R_SUCCESS, LOCK, dns_cache::mctx, REQUIRE, UNLOCK, and VALID_CACHE.
Referenced by configure_view().
isc_result_t dns_cache_load | ( | dns_cache_t * | cache | ) |
If the cache has a file name, load the cache contents from the file. Previous cache contents are not discarded. If no file name has been set, do nothing and return success.
MT:
Definition at line 515 of file cache.c.
References dns_cache::db, dns_db_load(), dns_cache::filelock, dns_cache::filename, ISC_R_SUCCESS, LOCK, REQUIRE, UNLOCK, and VALID_CACHE.
Referenced by configure_view().
isc_result_t dns_cache_dump | ( | dns_cache_t * | cache | ) |
If the cache has a file name, write the cache contents to disk, overwriting any preexisting file. If no file name has been set, do nothing and return success.
MT:
Definition at line 531 of file cache.c.
References dns_cache::db, dns_master_dump(), dns_master_style_cache, dns_cache::filelock, dns_cache::filename, ISC_R_SUCCESS, LOCK, dns_cache::mctx, REQUIRE, UNLOCK, and VALID_CACHE.
Referenced by dns_cache_detach().
void dns_cache_setcleaninginterval | ( | dns_cache_t * | cache, | |
unsigned int | t | |||
) |
Set the periodic cache cleaning interval to 'interval' seconds.
Definition at line 548 of file cache.c.
References dns_cache::cleaner, cache_cleaner::cleaning_interval, cache_cleaner::cleaning_timer, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, ISC_FALSE, isc_interval_set(), ISC_LOG_WARNING, isc_log_write(), ISC_R_SUCCESS, isc_result_totext(), isc_timer_reset(), isc_timertype_inactive, isc_timertype_ticker, ISC_TRUE, dns_cache::lock, LOCK, and UNLOCK.
Referenced by configure_view(), and end_cleaning().
unsigned int dns_cache_getcleaninginterval | ( | dns_cache_t * | cache | ) |
Get the periodic cache cleaning interval to 'interval' seconds.
Definition at line 585 of file cache.c.
References dns_cache::cleaner, cache_cleaner::cleaning_interval, dns_cache::lock, LOCK, REQUIRE, UNLOCK, and VALID_CACHE.
Referenced by cache_sharable().
const char* dns_cache_getname | ( | dns_cache_t * | cache | ) |
Get the cache name.
Definition at line 598 of file cache.c.
References dns_cache::name, REQUIRE, and VALID_CACHE.
Referenced by cachelist_find(), dumpdone(), and ns_stats_dump().
static void begin_cleaning | ( | cache_cleaner_t * | cleaner | ) | [static] |
Definition at line 711 of file cache.c.
References cache_cleaner::cache, CLEANER_IDLE, cleaner_s_busy, dns_cache::db, dns_db_createiterator(), dns_dbiterator_destroy(), dns_dbiterator_first(), dns_dbiterator_pause(), dns_dbiterator_setcleanmode(), dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_result_totext(), ISC_FALSE, ISC_LOG_DEBUG, ISC_LOG_WARNING, isc_log_write(), isc_mem_inuse(), ISC_R_NOMORE, ISC_R_SUCCESS, isc_result_totext(), isc_task_send(), ISC_TRUE, cache_cleaner::iterator, dns_cache::mctx, REQUIRE, cache_cleaner::resched_event, RUNTIME_CHECK, cache_cleaner::state, cache_cleaner::task, and UNEXPECTED_ERROR.
static void end_cleaning | ( | cache_cleaner_t * | cleaner, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 766 of file cache.c.
References cache_cleaner::cache, CLEANER_BUSY, cleaner_s_idle, cache_cleaner::cleaning_interval, dns_cache_setcleaninginterval(), dns_dbiterator_destroy(), dns_dbiterator_pause(), dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG, isc_log_write(), isc_mem_inuse(), ISC_R_SUCCESS, cache_cleaner::iterator, dns_cache::mctx, REQUIRE, cache_cleaner::resched_event, and cache_cleaner::state.
isc_result_t dns_cache_clean | ( | dns_cache_t * | cache, | |
isc_stdtime_t | now | |||
) |
Force immediate cleaning of the cache, freeing all rdatasets whose TTL has expired as of 'now' and that have no pending references.
Definition at line 975 of file cache.c.
References dns_cache::db, dns_db_createiterator(), dns_db_detachnode(), dns_db_expirenode(), dns_dbiterator_current(), dns_dbiterator_destroy(), dns_dbiterator_first(), dns_dbiterator_next(), dns_result_totext(), ISC_R_NOMORE, ISC_R_SUCCESS, REQUIRE, UNEXPECTED_ERROR, and VALID_CACHE.
static void water | ( | void * | arg, | |
int | mark | |||
) | [static] |
Definition at line 1025 of file cache.c.
References dns_cache::cleaner, dns_cache::db, dns_db_overmem(), ISC_MEM_HIWATER, isc_mem_waterack(), isc_task_send(), ISC_TF, cache_cleaner::lock, LOCK, dns_cache::mctx, cache_cleaner::overmem, overmem(), cache_cleaner::overmem_event, REQUIRE, cache_cleaner::task, UNLOCK, and VALID_CACHE.
void dns_cache_setcachesize | ( | dns_cache_t * | cache, | |
size_t | size | |||
) |
Set the maximum cache size. 0 means unlimited.
Definition at line 1047 of file cache.c.
References DNS_CACHE_MINSIZE, isc_mem_setwater(), dns_cache::lock, LOCK, dns_cache::mctx, REQUIRE, dns_cache::size, UNLOCK, VALID_CACHE, and water().
Referenced by configure_view().
size_t dns_cache_getcachesize | ( | dns_cache_t * | cache | ) |
Get the maximum cache size.
Definition at line 1087 of file cache.c.
References dns_cache::lock, LOCK, REQUIRE, dns_cache::size, UNLOCK, and VALID_CACHE.
Referenced by cache_sharable().
isc_result_t dns_cache_flush | ( | dns_cache_t * | cache | ) |
Flushes all data from the cache.
Returns:
Definition at line 1143 of file cache.c.
References cache_create_db(), dns_cache::cleaner, cleaner_s_busy, cleaner_s_done, cleaner_s_idle, dns_cache::db, dns_db_createiterator(), dns_db_detach(), dns_db_setcachestats(), dns_dbiterator_destroy(), ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, cache_cleaner::iterator, cache_cleaner::lock, dns_cache::lock, LOCK, cache_cleaner::replaceiterator, cache_cleaner::state, dns_cache::stats, and UNLOCK.
Referenced by dns_cache_flushnode(), and dns_view_flushcache2().
static isc_result_t clearnode | ( | dns_db_t * | db, | |
dns_dbnode_t * | node | |||
) | [static] |
Definition at line 1173 of file cache.c.
References dns_rdataset::covers, dns_db_allrdatasets(), dns_db_deleterdataset(), DNS_R_UNCHANGED, dns_rdataset_disassociate(), dns_rdataset_init(), dns_rdatasetiter_current(), dns_rdatasetiter_destroy(), dns_rdatasetiter_first(), dns_rdatasetiter_next(), ISC_R_NOMORE, ISC_R_SUCCESS, and dns_rdataset::type.
Referenced by cleartree(), and dns_cache_flushnode().
static isc_result_t cleartree | ( | dns_db_t * | db, | |
dns_name_t * | name | |||
) | [static] |
Definition at line 1204 of file cache.c.
References answer, cleanup(), clearnode(), dns_db_createiterator(), dns_db_detachnode(), dns_dbiterator_current(), dns_dbiterator_destroy(), dns_dbiterator_next(), dns_dbiterator_seek(), dns_fixedname_init, dns_fixedname_name, dns_name_issubdomain(), DNS_R_NEWORIGIN, ISC_R_NOMORE, ISC_R_NOTFOUND, and ISC_R_SUCCESS.
Referenced by dns_cache_flushnode().
isc_result_t dns_cache_flushname | ( | dns_cache_t * | cache, | |
dns_name_t * | name | |||
) |
isc_result_t dns_cache_flushnode | ( | dns_cache_t * | cache, | |
dns_name_t * | name, | |||
isc_boolean_t | tree | |||
) |
Definition at line 1263 of file cache.c.
References clearnode(), cleartree(), dns_cache::db, dns_cache_flush(), dns_db_attach(), dns_db_detach(), dns_db_detachnode(), dns_db_findnode(), dns_name_equal(), dns_rootname, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_cache::lock, LOCK, and UNLOCK.
Referenced by dns_cache_flushname(), and dns_view_flushnode().
isc_stats_t* dns_cache_getstats | ( | dns_cache_t * | cache | ) |
void dns_cache_updatestats | ( | dns_cache_t * | cache, | |
isc_result_t | result | |||
) |
Definition at line 1306 of file cache.c.
References dns_cachestatscounter_queryhits, dns_cachestatscounter_querymisses, DNS_R_CNAME, DNS_R_DNAME, DNS_R_GLUE, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_ZONECUT, ISC_R_SUCCESS, isc_stats_increment(), REQUIRE, dns_cache::stats, and VALID_CACHE.
Referenced by query_addadditional(), and query_find().
static void getcounter | ( | isc_statscounter_t | counter, | |
isc_uint64_t | val, | |||
void * | arg | |||
) | [static] |
Definition at line 1344 of file cache.c.
References cache_dumparg::countervalues, and REQUIRE.
Referenced by getcounters().
static void getcounters | ( | isc_stats_t * | stats, | |
isc_statsformat_t | type, | |||
int | ncounters, | |||
int * | indices, | |||
isc_uint64_t * | values | |||
) | [static] |
Definition at line 1352 of file cache.c.
References cache_dumparg::counterindices, cache_dumparg::countervalues, getcounter(), isc_stats_dump(), ISC_STATSDUMP_VERBOSE, cache_dumparg::ncounters, and cache_dumparg::type.
Referenced by dns_cache_dumpstats().
void dns_cache_dumpstats | ( | dns_cache_t * | cache, | |
FILE * | fp | |||
) |
Definition at line 1368 of file cache.c.
References dns_cache::db, dns_cachestatscounter_deletelru, dns_cachestatscounter_deletettl, dns_cachestatscounter_hits, dns_cachestatscounter_max, dns_cachestatscounter_misses, dns_cachestatscounter_queryhits, dns_cachestatscounter_querymisses, dns_db_hashsize(), dns_db_nodecount(), getcounters(), dns_cache::hmctx, isc_mem_inuse(), isc_mem_maxinuse(), isc_mem_total(), ISC_PRINT_QUADFORMAT, isc_statsformat_file, dns_cache::mctx, REQUIRE, dns_cache::stats, and VALID_CACHE.
Referenced by ns_stats_dump().