Exemple #1
0
/**
 * Initialize node stability caching.
 */
G_GNUC_COLD void
stable_init(void)
{
    dbstore_kv_t kv = { KUID_RAW_SIZE, NULL, sizeof(struct lifedata), 0 };
    dbstore_packing_t packing =
    { serialize_lifedata, deserialize_lifedata, NULL };

    g_assert(NULL == db_lifedata);
    g_assert(NULL == stable_sync_ev);
    g_assert(NULL == stable_prune_ev);

    /* Legacy: remove after 0.97 -- RAM, 2011-05-03 */
    dbstore_move(settings_config_dir(), settings_dht_db_dir(), db_stable_base);

    db_lifedata = dbstore_open(db_stable_what, settings_dht_db_dir(),
                               db_stable_base, kv, packing, STABLE_DB_CACHE_SIZE, kuid_hash, kuid_eq,
                               GNET_PROPERTY(dht_storage_in_memory));

    dbmw_set_map_cache(db_lifedata, STABLE_MAP_CACHE_SIZE);
    stable_prune_old();

    stable_sync_ev = cq_periodic_main_add(STABLE_SYNC_PERIOD,
                                          stable_sync, NULL);

    stable_prune_ev = cq_periodic_main_add(STABLE_PRUNE_PERIOD,
                                           stable_periodic_prune, NULL);
}
Exemple #2
0
/**
 * Callout queue periodic event to expire old entries.
 */
static gboolean
stable_periodic_prune(gpointer unused_obj)
{
    (void) unused_obj;

    stable_prune_old();
    return TRUE;		/* Keep calling */
}
Exemple #3
0
/**
 * Callout queue periodic event to expire old entries.
 */
static bool
stable_periodic_prune(void *unused_obj)
{
	(void) unused_obj;

	stable_prune_old();
	return TRUE;		/* Keep calling */
}