110 #ifndef UPS_UPSCALEDB_H
111 #define UPS_UPSCALEDB_H
120 #define UPS_API_REVISION 3
142 #define UPS_VERSION_MAJ 2
143 #define UPS_VERSION_MIN 1
144 #define UPS_VERSION_REV 13
145 #define UPS_FILE_VERSION 5
221 #define UPS_RECORD_USER_ALLOC 1
229 #define ups_make_record(PTR, SIZE) { SIZE, PTR, 0 }
278 #define ups_make_key(PTR, SIZE) { SIZE, PTR, 0 }
283 #define UPS_KEY_USER_ALLOC 1
318 #define UPS_TYPE_BINARY 0
320 #define UPS_TYPE_CUSTOM 1
322 #define UPS_TYPE_UINT8 3
324 #define UPS_TYPE_UINT16 5
326 #define UPS_TYPE_UINT32 7
328 #define UPS_TYPE_UINT64 9
330 #define UPS_TYPE_REAL32 11
332 #define UPS_TYPE_REAL64 12
345 #define UPS_SUCCESS ( 0)
347 #define UPS_INV_RECORD_SIZE ( -2)
349 #define UPS_INV_KEY_SIZE ( -3)
351 #define UPS_INV_KEYSIZE UPS_INV_KEY_SIZE
353 #define UPS_INV_PAGE_SIZE ( -4)
355 #define UPS_INV_PAGESIZE UPS_INV_PAGE_SIZE
357 #define UPS_OUT_OF_MEMORY ( -6)
359 #define UPS_INV_PARAMETER ( -8)
361 #define UPS_INV_FILE_HEADER ( -9)
363 #define UPS_INV_FILE_VERSION (-10)
365 #define UPS_KEY_NOT_FOUND (-11)
367 #define UPS_DUPLICATE_KEY (-12)
369 #define UPS_INTEGRITY_VIOLATED (-13)
371 #define UPS_INTERNAL_ERROR (-14)
373 #define UPS_WRITE_PROTECTED (-15)
375 #define UPS_BLOB_NOT_FOUND (-16)
377 #define UPS_IO_ERROR (-18)
379 #define UPS_NOT_IMPLEMENTED (-20)
381 #define UPS_FILE_NOT_FOUND (-21)
383 #define UPS_WOULD_BLOCK (-22)
385 #define UPS_NOT_READY (-23)
387 #define UPS_LIMITS_REACHED (-24)
389 #define UPS_ALREADY_INITIALIZED (-27)
391 #define UPS_NEED_RECOVERY (-28)
393 #define UPS_CURSOR_STILL_OPEN (-29)
395 #define UPS_FILTER_NOT_FOUND (-30)
397 #define UPS_TXN_CONFLICT (-31)
399 #define UPS_KEY_ERASED_IN_TXN (-32)
401 #define UPS_TXN_STILL_OPEN (-33)
403 #define UPS_CURSOR_IS_NIL (-100)
405 #define UPS_DATABASE_NOT_FOUND (-200)
407 #define UPS_DATABASE_ALREADY_EXISTS (-201)
409 #define UPS_DATABASE_ALREADY_OPEN (-202)
411 #define UPS_ENVIRONMENT_ALREADY_OPEN (-203)
413 #define UPS_LOG_INV_FILE_HEADER (-300)
415 #define UPS_NETWORK_ERROR (-400)
447 #define UPS_DEBUG_LEVEL_DEBUG 0
450 #define UPS_DEBUG_LEVEL_NORMAL 1
453 #define UPS_DEBUG_LEVEL_FATAL 3
1041 #define UPS_FLUSH_COMMITTED_TRANSACTIONS 1
1062 #define UPS_DONT_LOCK 0xf0000000
1182 #define UPS_TXN_READ_ONLY 1
1185 #define UPS_TXN_TEMPORARY 2
1249 #define UPS_ENABLE_FSYNC 0x00000001
1255 #define UPS_READ_ONLY 0x00000004
1267 #define UPS_IN_MEMORY 0x00000080
1273 #define UPS_DISABLE_MMAP 0x00000200
1276 #define UPS_RECORD_NUMBER UPS_RECORD_NUMBER64
1280 #define UPS_RECORD_NUMBER32 0x00001000
1284 #define UPS_RECORD_NUMBER64 0x00002000
1288 #define UPS_ENABLE_DUPLICATE_KEYS 0x00004000
1290 #define UPS_ENABLE_DUPLICATES UPS_ENABLE_DUPLICATE_KEYS
1293 #define UPS_ENABLE_RECOVERY UPS_ENABLE_TRANSACTIONS
1297 #define UPS_AUTO_RECOVERY 0x00010000
1301 #define UPS_ENABLE_TRANSACTIONS 0x00020000
1305 #define UPS_CACHE_UNLIMITED 0x00040000
1309 #define UPS_DISABLE_RECOVERY 0x00080000
1312 #define UPS_IS_REMOTE_INTERNAL 0x00200000
1315 #define UPS_DISABLE_RECLAIM_INTERNAL 0x00400000
1318 #define UPS_FORCE_RECORDS_INLINE 0x00800000
1321 #define UPS_FLUSH_WHEN_COMMITTED 0x01000000
1325 #define UPS_ENABLE_CRC32 0x02000000
1328 #define UPS_DONT_FLUSH_TRANSACTIONS 0x04000000
1589 #define UPS_OVERWRITE 0x0001
1592 #define UPS_DUPLICATE 0x0002
1595 #define UPS_DUPLICATE_INSERT_BEFORE 0x0004
1598 #define UPS_DUPLICATE_INSERT_AFTER 0x0008
1601 #define UPS_DUPLICATE_INSERT_FIRST 0x0010
1604 #define UPS_DUPLICATE_INSERT_LAST 0x0020
1607 #define UPS_DIRECT_ACCESS 0x0040
1611 #define UPS_PARTIAL 0x0080
1615 #define UPS_FORCE_DEEP_COPY 0x0100
1629 #define UPS_HINT_APPEND 0x00080000
1643 #define UPS_HINT_PREPEND 0x00100000
1649 #define UPS_HINTS_MASK 0x001F0000
1678 #define UPS_ERASE_ALL_DUPLICATES 1
1746 #define UPS_PARAM_JOURNAL_SWITCH_THRESHOLD 0x00001
1750 #define UPS_PARAM_CACHE_SIZE 0x00000100
1752 #define UPS_PARAM_CACHESIZE UPS_PARAM_CACHE_SIZE
1755 #define UPS_PARAM_PAGE_SIZE 0x00000101
1757 #define UPS_PARAM_PAGESIZE UPS_PARAM_PAGE_SIZE
1760 #define UPS_PARAM_KEY_SIZE 0x00000102
1762 #define UPS_PARAM_KEYSIZE UPS_PARAM_KEY_SIZE
1766 #define UPS_PARAM_MAX_DATABASES 0x00000103
1769 #define UPS_PARAM_KEY_TYPE 0x00000104
1773 #define UPS_PARAM_LOG_DIRECTORY 0x00000105
1777 #define UPS_PARAM_ENCRYPTION_KEY 0x00000106
1781 #define UPS_PARAM_NETWORK_TIMEOUT_SEC 0x00000107
1784 #define UPS_PARAM_RECORD_SIZE 0x00000108
1788 #define UPS_PARAM_FILE_SIZE_LIMIT 0x00000109
1792 #define UPS_PARAM_POSIX_FADVISE 0x00000110
1795 #define UPS_PARAM_CUSTOM_COMPARE_NAME 0x00000111
1798 #define UPS_POSIX_FADVICE_NORMAL 0
1801 #define UPS_POSIX_FADVICE_RANDOM 1
1804 #define UPS_RECORD_SIZE_UNLIMITED ((uint32_t)-1)
1807 #define UPS_KEY_SIZE_UNLIMITED ((uint16_t)-1)
1811 #define UPS_PARAM_FLAGS 0x00000200
1815 #define UPS_PARAM_FILEMODE 0x00000201
1824 #define UPS_PARAM_FILENAME 0x00000202
1830 #define UPS_PARAM_DATABASE_NAME 0x00000203
1837 #define UPS_PARAM_MAX_KEYS_PER_PAGE 0x00000204
1843 #define UPS_PARAM_JOURNAL_COMPRESSION 0x00001000
1850 #define UPS_PARAM_RECORD_COMPRESSION 0x00001001
1857 #define UPS_PARAM_KEY_COMPRESSION 0x00001002
1860 #define UPS_COMPRESSOR_NONE 0
1866 #define UPS_COMPRESSOR_ZLIB 1
1872 #define UPS_COMPRESSOR_SNAPPY 2
1878 #define UPS_COMPRESSOR_LZF 3
1884 #define UPS_COMPRESSOR_UINT32_VARBYTE 5
1889 #define UPS_COMPRESSOR_UINT32_SIMDCOMP 6
1894 #define UPS_COMPRESSOR_UINT32_GROUPVARINT 7
1899 #define UPS_COMPRESSOR_UINT32_STREAMVBYTE 8
1904 #define UPS_COMPRESSOR_UINT32_MASKEDVBYTE 9
1909 #define UPS_COMPRESSOR_UINT32_FOR 10
1914 #define UPS_COMPRESSOR_UINT32_SIMDFOR 11
1956 #define UPS_AUTO_CLEANUP 1
1959 #define UPS_DONT_CLEAR_LOG 2
1962 #define UPS_TXN_AUTO_ABORT 4
1965 #define UPS_TXN_AUTO_COMMIT 8
2149 #define UPS_CURSOR_FIRST 0x0001
2152 #define UPS_CURSOR_LAST 0x0002
2155 #define UPS_CURSOR_NEXT 0x0004
2158 #define UPS_CURSOR_PREVIOUS 0x0008
2161 #define UPS_SKIP_DUPLICATES 0x0010
2164 #define UPS_ONLY_DUPLICATES 0x0020
2314 #define UPS_FIND_EQ_MATCH 0x4000
2320 #define UPS_FIND_LT_MATCH 0x1000
2326 #define UPS_FIND_GT_MATCH 0x2000
2335 #define UPS_FIND_LEQ_MATCH (UPS_FIND_LT_MATCH | UPS_FIND_EQ_MATCH)
2344 #define UPS_FIND_GEQ_MATCH (UPS_FIND_GT_MATCH | UPS_FIND_EQ_MATCH)
2359 #define UPS_FIND_NEAR_MATCH (UPS_FIND_LT_MATCH | UPS_FIND_GT_MATCH \
2360 | UPS_FIND_EQ_MATCH)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_parameters(ups_env_t *env, ups_parameter_t *param)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_get_duplicate_count(ups_cursor_t *cursor, uint32_t *count, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_database_names(ups_env_t *env, uint16_t *names, uint32_t *count)
struct ups_txn_t ups_txn_t
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_open(ups_env_t **env, const char *filename, uint32_t flags, const ups_parameter_t *param)
UPS_EXPORT const char *UPS_CALLCONV ups_strerror(ups_status_t status)
Portable typedefs for upscaledb.
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_close(ups_env_t *env, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_erase(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_insert(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, ups_record_t *record, uint32_t flags)
unsigned __int64 uint64_t
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_clone(ups_cursor_t *src, ups_cursor_t **dest)
int UPS_CALLCONV(* ups_compare_func_t)(ups_db_t *db, const uint8_t *lhs, uint32_t lhs_length, const uint8_t *rhs, uint32_t rhs_length)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_find(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, ups_record_t *record, uint32_t flags)
void UPS_CALLCONV(* ups_error_handler_fun)(int level, const char *message)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_move(ups_cursor_t *cursor, ups_key_t *key, ups_record_t *record, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_erase_db(ups_env_t *env, uint16_t name, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_rename_db(ups_env_t *env, uint16_t oldname, uint16_t newname, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_get_duplicate_position(ups_cursor_t *cursor, uint32_t *position)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_find(ups_cursor_t *cursor, ups_key_t *key, ups_record_t *record, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_get_record_size(ups_cursor_t *cursor, uint64_t *size)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_count(ups_db_t *db, ups_txn_t *txn, uint32_t flags, uint64_t *count)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_get_parameters(ups_db_t *db, ups_parameter_t *param)
UPS_EXPORT const char * ups_txn_get_name(ups_txn_t *txn)
struct ups_cursor_t ups_cursor_t
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_flush(ups_env_t *env, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_register_compare(const char *name, ups_compare_func_t func)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_close(ups_cursor_t *cursor)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_overwrite(ups_cursor_t *cursor, ups_record_t *record, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_open_db(ups_env_t *env, ups_db_t **db, uint16_t name, uint32_t flags, const ups_parameter_t *params)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_create(ups_env_t **env, const char *filename, uint32_t flags, uint32_t mode, const ups_parameter_t *param)
UPS_EXPORT ups_status_t ups_txn_begin(ups_txn_t **txn, ups_env_t *env, const char *name, void *reserved, uint32_t flags)
UPS_EXPORT ups_status_t ups_txn_commit(ups_txn_t *txn, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_insert(ups_cursor_t *cursor, ups_key_t *key, ups_record_t *record, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_erase(ups_cursor_t *cursor, uint32_t flags)
UPS_EXPORT ups_status_t ups_txn_abort(ups_txn_t *txn, uint32_t flags)
UPS_EXPORT void UPS_CALLCONV ups_set_error_handler(ups_error_handler_fun f)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_set_compare_func(ups_db_t *db, ups_compare_func_t foo)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_create_db(ups_env_t *env, ups_db_t **db, uint16_t name, uint32_t flags, const ups_parameter_t *params)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_create(ups_cursor_t **cursor, ups_db_t *db, ups_txn_t *txn, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_close(ups_db_t *db, uint32_t flags)
UPS_EXPORT ups_env_t *UPS_CALLCONV ups_db_get_env(ups_db_t *db)
UPS_EXPORT void UPS_CALLCONV ups_get_version(uint32_t *major, uint32_t *minor, uint32_t *revision)
struct ups_env_t ups_env_t