diff options
Diffstat (limited to 'usr.sbin/nsd/udb.h')
-rw-r--r-- | usr.sbin/nsd/udb.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/usr.sbin/nsd/udb.h b/usr.sbin/nsd/udb.h index 691b78c817f..049760dd961 100644 --- a/usr.sbin/nsd/udb.h +++ b/usr.sbin/nsd/udb.h @@ -204,6 +204,11 @@ struct udb_base { udb_walk_relptr_func* walkfunc; /** user data for walkfunc */ void* walkarg; + + /** compaction is inhibited */ + int inhibit_compact; + /** compaction is useful; deletions performed. */ + int useful_compact; }; typedef enum udb_chunk_type udb_chunk_type; @@ -549,6 +554,22 @@ udb_void udb_alloc_realloc(udb_alloc* alloc, udb_void r, size_t osz, */ int udb_alloc_grow(udb_alloc* alloc, size_t sz, size_t num); +/** + * attempt to compact the data and move free space to the end + * can shrink the db, which calls sync on the db (for portability). + * @param udb: the udb base. + * @return 0 on failure (to remap the (possibly) changed udb base). + */ +int udb_compact(udb_base* udb); + +/** + * set the udb to inhibit or uninhibit compaction. Does not perform + * the compaction itself if enabled, for that call udb_compact. + * @param udb: the udb base + * @param inhibit: 0 or 1. + */ +void udb_compact_inhibited(udb_base* udb, int inhibit); + /** * Set the alloc type for a newly alloced piece of data * @param alloc: the udb space allocator. |