hamsterdb Embedded Database  2.1.7
Data Structures | Macros | Typedefs | Functions
hamsterdb Enhanced API

Data Structures

struct  ham_env_metrics_t
 

Macros

#define ham_key_get_intflags(key)   (key)->_flags
 
#define ham_key_set_intflags(key, f)   (key)->_flags=(f)
 
#define HAM_PRINT_GRAPH   1
 
#define HAM_METRICS_VERSION   7
 

Typedefs

typedef struct ham_env_metrics_t ham_env_metrics_t
 

Functions

HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_db_check_integrity (ham_db_t *db, ham_u32_t flags)
 
HAM_EXPORT void HAM_CALLCONV ham_set_context_data (ham_db_t *db, void *data)
 
HAM_EXPORT void *HAM_CALLCONV ham_get_context_data (ham_db_t *db, ham_bool_t dont_lock)
 
HAM_EXPORT ham_db_t *HAM_CALLCONV ham_cursor_get_database (ham_cursor_t *cursor)
 
HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_env_get_metrics (ham_env_t *env, ham_env_metrics_t *metrics)
 
HAM_EXPORT ham_bool_t HAM_CALLCONV ham_is_debug ()
 
HAM_EXPORT ham_bool_t HAM_CALLCONV ham_is_pro ()
 

Detailed Description

Macro Definition Documentation

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

get the (non-persisted) flags of a key

Definition at line 43 of file hamsterdb_int.h.

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

set the flags of a key

Note that the ham_find/ham_cursor_find/ham_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 52 of file hamsterdb_int.h.

#define HAM_METRICS_VERSION   7

Retrieves collected metrics from the hamsterdb 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 130 of file hamsterdb_int.h.

#define HAM_PRINT_GRAPH   1

Flag for ham_db_check_integrity

Definition at line 76 of file hamsterdb_int.h.

Typedef Documentation

Function Documentation

HAM_EXPORT ham_db_t* HAM_CALLCONV ham_cursor_get_database ( ham_cursor_t cursor)

Retrieves the Database handle of a Cursor

Parameters
cursorA valid Cursor handle
Returns
The Database handle of cursor
HAM_EXPORT ham_status_t HAM_CALLCONV ham_db_check_integrity ( ham_db_t db,
ham_u32_t  flags 
)

Verifies the integrity of the Database

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

Parameters
dbA valid Database handle
flagsOptional flags for the integrity check, combined with bitwise OR. Possible flags are:
  • HAM_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
HAM_SUCCESS upon success
HAM_INTEGRITY_VIOLATED if the Database is broken
HAM_EXPORT ham_status_t HAM_CALLCONV ham_env_get_metrics ( ham_env_t env,
ham_env_metrics_t metrics 
)

Retrieves the current metrics from an Environment

HAM_EXPORT void* HAM_CALLCONV ham_get_context_data ( ham_db_t db,
ham_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 ham_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 HAM_TRUE if this hamsterdb library was compiled with debug diagnostics, checks and asserts

Returns HAM_TRUE if this hamsterdb library is the commercial closed-source "hamsterdb pro" edition

HAM_EXPORT void HAM_CALLCONV ham_set_context_data ( ham_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 ham_get_context_data. It is mainly used by Wrappers and language bindings.

Parameters
dbA valid Database handle
dataThe pointer to the context data