hamsterdb Enhanced API

Data Structures

struct  ham_file_filter_t
struct  ham_record_filter_t

Modules

 Special Database Names

Typedefs

typedef struct ham_file_filter_t ham_file_filter_t
typedef ham_status_t(* ham_file_filter_before_write_cb_t )(ham_env_t *env, ham_file_filter_t *filter, ham_u8_t *file_data, ham_size_t file_size)
typedef ham_status_t(* ham_file_filter_after_read_cb_t )(ham_env_t *env, ham_file_filter_t *filter, ham_u8_t *file_data, ham_size_t file_size)
typedef void(* ham_file_filter_close_cb_t )(ham_env_t *env, ham_file_filter_t *filter)
typedef struct ham_record_filter_t ham_record_filter_t
typedef ham_status_t(* ham_record_filter_before_insert_cb_t )(ham_db_t *db, ham_record_filter_t *filter, ham_record_t *record)
typedef ham_status_t(* ham_record_filter_after_read_cb_t )(ham_db_t *db, ham_record_filter_t *filter, ham_record_t *record)
typedef void(* ham_record_filter_close_cb_t )(ham_db_t *db, ham_record_filter_t *filter)
typedef struct ham_device_t ham_device_t

Functions

HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_check_integrity (ham_db_t *db, ham_txn_t *txn)
HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_calc_maxkeys_per_page (ham_db_t *db, ham_size_t *keycount, ham_u16_t keysize)
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_EXPORT ham_status_t
HAM_CALLCONV 
ham_env_add_file_filter (ham_env_t *env, ham_file_filter_t *filter)
HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_env_remove_file_filter (ham_env_t *env, ham_file_filter_t *filter)
HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_add_record_filter (ham_db_t *db, ham_record_filter_t *filter)
HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_remove_record_filter (ham_db_t *db, ham_record_filter_t *filter)
HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_env_set_device (ham_env_t *env, ham_device_t *device)
HAM_EXPORT ham_db_t *HAM_CALLCONV ham_cursor_get_database (ham_cursor_t *cursor)

Typedef Documentation

typedef struct ham_device_t ham_device_t

Definition at line 342 of file hamsterdb_int.h.

A callback function for a file-level filter; called immediately after the data is read from disk

Definition at line 149 of file hamsterdb_int.h.

A callback function for a file-level filter; called before the data is written to disk

Definition at line 142 of file hamsterdb_int.h.

typedef void(* ham_file_filter_close_cb_t)(ham_env_t *env, ham_file_filter_t *filter)

A callback function for a file-level filter; called immediately before the Environment is closed. Can be used to avoid memory leaks.

Definition at line 156 of file hamsterdb_int.h.

Definition at line 136 of file hamsterdb_int.h.

A callback function for a record-level filter; called immediately after the record is read from disk, and before it is returned to the user.

Definition at line 241 of file hamsterdb_int.h.

A callback function for a record-level filter; called before the record is inserted

Definition at line 234 of file hamsterdb_int.h.

A callback function for a record-level filter; called immediately before the Database is closed. Can be used to avoid memory leaks.

Definition at line 248 of file hamsterdb_int.h.

Definition at line 228 of file hamsterdb_int.h.


Function Documentation

HAM_EXPORT ham_status_t HAM_CALLCONV ham_add_record_filter ( ham_db_t db,
ham_record_filter_t filter 
)

A function to install a record-level filter.

Record-level filters are usually installed immediately after the Database is created with ham_create[_ex] or opened with ham_open[_ex].

Parameters:
db A valid Database handle
filter A pointer to a ham_record_filter_t structure
Returns:
HAM_SUCCESS upon success
HAM_INV_PARAMETER if db or filter is NULL
HAM_EXPORT ham_status_t HAM_CALLCONV ham_calc_maxkeys_per_page ( ham_db_t db,
ham_size_t keycount,
ham_u16_t  keysize 
)

Estimates the number of keys stored per page in the Database

Parameters:
db A valid Database handle
keycount A reference to a variable which will receive the calculated key count per page
keysize The size of the key
Returns:
HAM_SUCCESS upon success
HAM_INV_PARAMETER if db or keycount is NULL
HAM_INV_KEYSIZE if the keycount turns out to be huge (i.e. larger than 65535); in this case keycount still contains a valid value, but this error indicates this keysize won't be usable with the given Database.
HAM_EXPORT ham_status_t HAM_CALLCONV ham_check_integrity ( ham_db_t db,
ham_txn_t txn 
)

Verifies the integrity of the Database

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

Returns HAM_NOT_IMPLEMENTED unless hamsterdb was built with HAM_ENABLE_INTERNAL (run ./configure --enable-internal).

Parameters:
db A valid Database handle
txn A Transaction handle, or NULL
Returns:
HAM_SUCCESS upon success
HAM_INTEGRITY_VIOLATED if the Database is broken
HAM_NOT_IMPLEMENTED if hamsterdb was built without internal functions.
See also:
HAM_ENABLE_INTERNAL
HAM_EXPORT ham_db_t* HAM_CALLCONV ham_cursor_get_database ( ham_cursor_t cursor  ) 

Retrieves the Database handle of a Cursor

Parameters:
cursor A valid Cursor handle
Returns:
The Database handle of cursor
HAM_EXPORT ham_status_t HAM_CALLCONV ham_env_add_file_filter ( ham_env_t env,
ham_file_filter_t filter 
)

A function to install a file-level filter.

File-level filters are usually installed immediately after the Environment is created with ham_env_create[_ex] or opened with ham_env_open[_ex].

Parameters:
env A valid Environment handle
filter A pointer to a ham_file_filter_t structure
Returns:
HAM_SUCCESS upon success
HAM_INV_PARAMETER if env or filter is NULL
HAM_EXPORT ham_status_t HAM_CALLCONV ham_env_remove_file_filter ( ham_env_t env,
ham_file_filter_t filter 
)

A function to remove a file-level filter.

This function is usually not necessary - the lifetime of a file-filter usually starts before the first Database operation, and ends when the Environment is closed. It is not recommended to use this function.

Parameters:
env A valid Environment handle
filter A pointer to a ham_file_filter_t structure
Returns:
HAM_SUCCESS upon success
HAM_INV_PARAMETER if env or filter is NULL
HAM_FILTER_NOT_FOUND if filter was not registered
HAM_EXPORT ham_status_t HAM_CALLCONV ham_env_set_device ( ham_env_t env,
ham_device_t device 
)
HAM_EXPORT void* HAM_CALLCONV ham_get_context_data ( ham_db_t db  ) 

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:
db A valid Database handle
Returns:
The pointer to the context data
HAM_EXPORT ham_status_t HAM_CALLCONV ham_remove_record_filter ( ham_db_t db,
ham_record_filter_t filter 
)

A function to remove a record-level filter.

This function is usually not necessary - the lifetime of a record-filter usually starts before the first Database operation, and ends when the Database is closed. It is not recommended to use this function.

Parameters:
db A valid Database handle
filter A pointer to a ham_record_filter_t structure
Returns:
HAM_SUCCESS upon success
HAM_INV_PARAMETER if db or filter is NULL
HAM_FILTER_NOT_FOUND if filter was not registered
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:
db A valid Database handle
data The pointer to the context data

Generated on Tue Mar 16 20:19:45 2010 for hamsterdb Embedded Database by  doxygen 1.6.1