#include <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include "odb.h"
Go to the source code of this file.
Defines | |
| #define | _GNU_SOURCE |
Functions | |
| static int | add_node (odb_data_t *data, odb_key_t key, odb_value_t value) |
| int | odb_update_node (odb_t *odb, odb_key_t key) |
| int | odb_update_node_with_offset (odb_t *odb, odb_key_t key, unsigned long int offset) |
| int | odb_add_node (odb_t *odb, odb_key_t key, odb_value_t value) |
Inserting a key-value pair into a DB
Definition in file db_insert.c.
| #define _GNU_SOURCE |
Definition at line 11 of file db_insert.c.
| static int add_node | ( | odb_data_t * | data, | |
| odb_key_t | key, | |||
| odb_value_t | value | |||
| ) | [inline, static] |
Definition at line 21 of file db_insert.c.
References odb_descr_t::current_size, odb_data::descr, odb_data::hash_base, odb_node_t::key, odb_node_t::next, odb_data::node_base, odb_commit_reservation(), odb_do_hash(), odb_grow_hashtable(), odb_descr_t::size, and odb_node_t::value.
Referenced by odb_add_node(), and odb_update_node_with_offset().


| int odb_add_node | ( | odb_t * | odb, | |
| odb_key_t | key, | |||
| odb_value_t | value | |||
| ) |
Add a new node w/o regarding if a node with the same key already exists
returns EXIT_SUCCESS on success, EXIT_FAILURE on failure
Definition at line 106 of file db_insert.c.
References add_node(), and odb_t::data.
Referenced by import_from_abi(), and main().


update info at key by incrementing its associated value by one, if the key does not exist a new node is created and the value associated is set to one.
returns EXIT_SUCCESS on success, EXIT_FAILURE on failure
Definition at line 52 of file db_insert.c.
References odb_update_node_with_offset().
Referenced by opd_put_image_sample(), operf_sfile_log_arc(), sfile_log_arc(), speed_test(), and test().


odb_update_node_with_offset
| odb | the data base object to setup | |
| key | the hash key | |
| offset | the offset to be added |
update info at key by adding the specified offset to its associated value, if the key does not exist a new node is created and the value associated is set to offset.
returns EXIT_SUCCESS on success, EXIT_FAILURE on failure
Definition at line 57 of file db_insert.c.
References add_node(), odb_t::data, odb_data::hash_base, odb_node_t::key, odb_node_t::next, odb_data::node_base, odb_do_hash(), and odb_node_t::value.
Referenced by odb_update_node(), operf_sfile_log_sample_count(), and sfile_log_sample_count().


1.6.1