The database is stored in a single file and uses logging to implement atomic transactions and crash recovery. This module is appropriate to use in situations where a relational database is not appropriate because the data is small and schema-free. In the even of a write error, the current process will be aborted, but the database will remain in a consistent state.
#include "nvpair.h"
#include "int_sizes.h"
Go to the source code of this file.
Functions | |
nvpair_database * | nvpair_database_open (const char *filename) |
Open or create a new database at the given filename. | |
void | nvpair_database_close (struct nvpair_database *db) |
Close an open database. | |
int | nvpair_database_insert (struct nvpair_database *db, INT64_T *key, struct nvpair *nv) |
Insert a new object into the database. | |
nvpair * | nvpair_database_remove (struct nvpair_database *db, INT64_T key) |
Remove an object from the database. | |
nvpair * | nvpair_database_lookup (struct nvpair_database *db, INT64_T key) |
Look up an object in the database. | |
int | nvpair_database_update_string (struct nvpair_database *db, INT64_T key, const char *name, const char *value) |
Update a string property of one object in the database. | |
int | nvpair_database_update_integer (struct nvpair_database *db, INT64_T key, const char *name, INT64_T value) |
Update an integer property of one object in the database. | |
const char * | nvpair_database_lookup_string (struct nvpair_database *db, INT64_T key, const char *name) |
Look up a string property of one object in the database. | |
INT64_T | nvpair_database_lookup_integer (struct nvpair_database *db, INT64_T key, const char *name) |
Look up an integer property of one object in the database. | |
void | nvpair_database_firstkey (struct nvpair_database *db) |
Begin iterating over the database. | |
int | nvpair_database_nextkey (struct nvpair_database *db, INT64_T *key, struct nvpair **nv) |
Continue iterating over the database. |
|
Open or create a new database at the given filename.
|
|
Close an open database.
|
|
Insert a new object into the database.
|
|
Remove an object from the database.
|
|
Look up an object in the database.
|
|
Update a string property of one object in the database.
|
|
Update an integer property of one object in the database.
|
|
Look up a string property of one object in the database.
|
|
Look up an integer property of one object in the database.
|
|
Begin iterating over the database.
|
|
Continue iterating over the database.
|