*/
const struct GNUNET_CONFIGURATION_Handle *cfg;
+/**
+ * Minimum time that content should have to not be discarded instantly
+ * (time stamp of any content that we've been discarding recently to
+ * stay below the quota). FOREVER if we had to expire content with
+ * non-zero priority.
+ */
+static struct GNUNET_TIME_Absolute min_expiration;
/**
* Handle for reporting statistics.
GNUNET_h2s (key), type,
(unsigned long long) (now.abs_value - expiration.abs_value));
#endif
+ min_expiration = now;
GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size,
GNUNET_YES);
GNUNET_CONTAINER_bloomfilter_remove (filter, key);
*need = 0;
else
*need -= size + GNUNET_DATASTORE_ENTRY_OVERHEAD;
+ if (priority > 0)
+ min_expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ else
+ min_expiration = expiration;
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes purged (low-priority)"),
size, GNUNET_YES);
sm->header.size = htons (sizeof (struct StatusMessage) + slen);
sm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_STATUS);
sm->status = htonl (code);
+ sm->min_expiration = GNUNET_TIME_absolute_hton (min_expiration);
if (slen > 0)
memcpy (&sm[1], msg, slen);
transmit (client, &sm->header);
* @param success GNUNET_SYSERR on failure (including timeout/queue drop)
* GNUNET_NO if content was already there
* GNUNET_YES (or other positive value) on success
- * @param min_expiration minimum expiration time required for content to be stored
- * by the datacache at this time, zero for unknown
+ * @param min_expiration minimum expiration time required for 0-priority content to be stored
+ * by the datacache at this time, zero for unknown, forever if we have no
+ * space for 0-priority content
* @param msg NULL on success, otherwise an error message
*/
typedef void (*GNUNET_DATASTORE_ContinuationWithStatus) (void *cls,