upscaledb  2.2.1
Data Structures | Macros | Typedefs | Functions
upscaledb Extended API

Data Structures

struct  min_max_avg_u32_t
 
struct  btree_metrics_t
 
struct  ups_env_metrics_t
 
struct  ups_operation_t
 

Macros

#define ups_key_get_intflags(key)   (key)->_flags
 
#define ups_key_set_intflags(key, f)   (key)->_flags=(f)
 
#define UPS_PRINT_GRAPH   1
 
#define UPS_METRICS_VERSION   9
 
#define UPS_OP_INSERT   1
 
#define UPS_OP_ERASE   2
 
#define UPS_OP_FIND   3
 

Typedefs

typedef struct min_max_avg_u32_t min_max_avg_u32_t
 
typedef struct btree_metrics_t btree_metrics_t
 
typedef struct ups_env_metrics_t ups_env_metrics_t
 

Functions

UPS_EXPORT int UPS_CALLCONV ups_key_get_approximate_match_type (ups_key_t *key)
 
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_check_integrity (ups_db_t *db, uint32_t flags)
 
UPS_EXPORT void UPS_CALLCONV ups_set_context_data (ups_db_t *db, void *data)
 
UPS_EXPORT void *UPS_CALLCONV ups_get_context_data (ups_db_t *db, ups_bool_t dont_lock)
 
UPS_EXPORT ups_db_t *UPS_CALLCONV ups_cursor_get_database (ups_cursor_t *cursor)
 
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_metrics (ups_env_t *env, ups_env_metrics_t *metrics)
 
UPS_EXPORT ups_bool_t UPS_CALLCONV ups_is_debug ()
 
UPS_EXPORT uint32_t UPS_CALLCONV ups_calc_compare_name_hash (const char *zname)
 
UPS_EXPORT uint32_t UPS_CALLCONV ups_db_get_compare_name_hash (ups_db_t *db)
 
UPS_EXPORT uint16_t UPS_CALLCONV ups_db_get_name (ups_db_t *hdb)
 
UPS_EXPORT uint32_t UPS_CALLCONV ups_db_get_flags (ups_db_t *hdb)
 
UPS_EXPORT ups_db_t *UPS_CALLCONV ups_env_get_open_database (ups_env_t *env, uint16_t name)
 
UPS_EXPORT void UPS_CALLCONV ups_set_committed_flush_threshold (int threshold)
 
UPS_EXPORT void UPS_CALLCONV ups_at_exit ()
 
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_bulk_operations (ups_db_t *db, ups_txn_t *txn, struct ups_operation_t *operations, size_t operations_length, uint32_t flags)
 

Detailed Description

Macro Definition Documentation

#define ups_key_get_intflags (   key)    (key)->_flags

get the (non-persisted) flags of a key

Definition at line 46 of file upscaledb_int.h.

#define ups_key_set_intflags (   key,
 
)    (key)->_flags=(f)

set the flags of a key

Note that the ups_find/ups_cursor_find/ups_cursor_find_ex flags must be defined such that those can peacefully co-exist with these; that's why those public flags start at the value 0x1000 (4096).

Definition at line 55 of file upscaledb_int.h.

#define UPS_METRICS_VERSION   9

Retrieves collected metrics from the upscaledb Environment. Used mainly for testing. See below for the structure with the currently available metrics. This structure will change a lot; the first field is a version indicator that applications can use to verify that the structure layout is compatible.

These metrics are NOT persisted to disk.

Metrics marked "global" are stored globally and shared between multiple Environments.

Definition at line 212 of file upscaledb_int.h.

#define UPS_OP_ERASE   2

Definition at line 391 of file upscaledb_int.h.

#define UPS_OP_FIND   3

Definition at line 392 of file upscaledb_int.h.

#define UPS_OP_INSERT   1

Definition at line 390 of file upscaledb_int.h.

#define UPS_PRINT_GRAPH   1

Flag for ups_db_check_integrity

Definition at line 105 of file upscaledb_int.h.

Typedef Documentation

Function Documentation

UPS_EXPORT void UPS_CALLCONV ups_at_exit ( )

A function which cleans up statically allocated memory.

Typically, you do not have to call this function because it is automatically registered as an exit-handler (with at_exit()).

UPS_EXPORT uint32_t UPS_CALLCONV ups_calc_compare_name_hash ( const char *  zname)

Returns the hash of a compare function name. The name is case-insensitive.

UPS_EXPORT ups_db_t* UPS_CALLCONV ups_cursor_get_database ( ups_cursor_t cursor)

Retrieves the Database handle of a Cursor

Parameters
cursorA valid Cursor handle
Returns
The Database handle of cursor
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_bulk_operations ( ups_db_t db,
ups_txn_t txn,
struct ups_operation_t operations,
size_t  operations_length,
uint32_t  flags 
)

Perform bulk operations on a database

This function receives an array of ups_operation_t structures and performs the necessary calls to ups_db_insert, ups_db_erase and ups_db_find.

The txn parameter is passed to ups_db_insert, ups_db_erase and ups_db_find.

UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_check_integrity ( ups_db_t db,
uint32_t  flags 
)

Verifies the integrity of the Database

This function is only interesting if you want to debug upscaledb.

Parameters
dbA valid Database handle
flagsOptional flags for the integrity check, combined with bitwise OR. Possible flags are:
  • UPS_PRINT_GRAPH Prints the Btree as a graph; stores the image as "graph.png" in the current working directory. It uses the "dot" tool from graphviz to generate the image. This functionality is only available in DEBUG builds!
Returns
UPS_SUCCESS upon success
UPS_INTEGRITY_VIOLATED if the Database is broken
UPS_EXPORT uint32_t UPS_CALLCONV ups_db_get_compare_name_hash ( ups_db_t db)

Returns the hash of a compare function name of a database.

UPS_EXPORT uint32_t UPS_CALLCONV ups_db_get_flags ( ups_db_t hdb)

Returns the flags of the database.

UPS_EXPORT uint16_t UPS_CALLCONV ups_db_get_name ( ups_db_t hdb)

Returns the "name" of the database.

UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_metrics ( ups_env_t env,
ups_env_metrics_t metrics 
)

Retrieves the current metrics from an Environment

UPS_EXPORT ups_db_t* UPS_CALLCONV ups_env_get_open_database ( ups_env_t env,
uint16_t  name 
)

Returns an open database handle, or 0 if it was not yet opened

UPS_EXPORT void* UPS_CALLCONV ups_get_context_data ( ups_db_t db,
ups_bool_t  dont_lock 
)

Retrieves a user-provided context pointer

This function retrieves a user-provided context pointer. This can be any arbitrary pointer which was previously stored with ups_set_context_data.

Parameters
dbA valid Database handle
dont_lockWhether the Environment mutex should be locked or not this is used to avoid recursive locks when retrieving the context data in a compare function
Returns
The pointer to the context data

Returns UPS_TRUE if this upscaledb library was compiled with debug diagnostics, checks and asserts

UPS_EXPORT int UPS_CALLCONV ups_key_get_approximate_match_type ( ups_key_t key)

Returns the kind of key match which produced this key as it was returned by one of the ups_db_find() and ups_cursor_find().

This routine assumes the key was passed back by one of the ups_db_find and ups_cursor_find functions and not used by any other upscaledb functions after that.

As such, this function produces an answer akin to the 'sign' of the specified key as it was returned by the find operation.

Parameters
keyA valid key
Returns
1 (greater than) or -1 (less than) when the given key is an approximate result / zero (0) otherwise. Specifically:
  • +1 when the key is greater than the item searched for (key was a GT match)
  • -1 when the key is less than the item searched for (key was a LT match)
  • zero (0) otherwise (key was an EQ (EXACT) match)
UPS_EXPORT void UPS_CALLCONV ups_set_committed_flush_threshold ( int  threshold)

Sets the threshold for flushing batched (committed) Transactions to disk.

UPS_EXPORT void UPS_CALLCONV ups_set_context_data ( ups_db_t db,
void *  data 
)

Set a user-provided context pointer

This function sets a user-provided context pointer. This can be any arbitrary pointer; it is stored in the Database handle and can be retrieved with ups_get_context_data. It is mainly used by Wrappers and language bindings.

Parameters
dbA valid Database handle
dataThe pointer to the context data