| Turnstone Operating System
    | 
tosdb interface More...
#include <types.h>#include <data.h>#include <buffer.h>#include <list.h>#include <disk.h>#include <set.h>#include <compression.h>| Classes | |
| struct | tosdb_cache_config_t | 
| tosdb cache config  More... | |
| struct | tosdb_record_t | 
| tosdb record  More... | |
| Macros | |
| #define | ___TOSDB_TOSDB_H 0 | 
| Typedefs | |
| typedef struct tosdb_backend_t | tosdb_backend_t | 
| typedef struct tosdb_t | tosdb_t | 
| typedef struct tosdb_cache_config_t | tosdb_cache_config_t | 
| shorthand for struct | |
| typedef enum tosdb_compaction_type_t | tosdb_compaction_type_t | 
| typedef struct tosdb_database_t | tosdb_database_t | 
| typedef struct tosdb_table_t | tosdb_table_t | 
| typedef struct tosdb_sequence_t | tosdb_sequence_t | 
| typedef enum tosdb_index_type_t | tosdb_index_type_t | 
| shorthand for enum | |
| typedef struct tosdb_record_t | tosdb_record_t | 
| typedef boolean_t(* | tosdb_record_set_boolean_f) (tosdb_record_t *record, const char_t *colname, const boolean_t value) | 
| set column value as boolean to the record | |
| typedef boolean_t(* | tosdb_record_get_boolean_f) (tosdb_record_t *record, const char_t *colname, boolean_t *value) | 
| get column value as boolean to the record | |
| typedef boolean_t(* | tosdb_record_set_char_f) (tosdb_record_t *record, const char_t *colname, const char_t value) | 
| set column value as char to the record | |
| typedef boolean_t(* | tosdb_record_get_char_f) (tosdb_record_t *record, const char_t *colname, char_t *value) | 
| get column value as char to the record | |
| typedef boolean_t(* | tosdb_record_set_int8_f) (tosdb_record_t *record, const char_t *colname, const int8_t value) | 
| set column value as int8 to the record | |
| typedef boolean_t(* | tosdb_record_get_int8_f) (tosdb_record_t *record, const char_t *colname, int8_t *value) | 
| get column value as int8 to the record | |
| typedef boolean_t(* | tosdb_record_set_uint8_f) (tosdb_record_t *record, const char_t *colname, const uint8_t value) | 
| set column value as uint8 to the record | |
| typedef boolean_t(* | tosdb_record_get_uint8_f) (tosdb_record_t *record, const char_t *colname, uint8_t *value) | 
| get column value as uint8 to the record | |
| typedef boolean_t(* | tosdb_record_set_int16_f) (tosdb_record_t *record, const char_t *colname, const int16_t value) | 
| set column value as int16 to the record | |
| typedef boolean_t(* | tosdb_record_get_int16_f) (tosdb_record_t *record, const char_t *colname, int16_t *value) | 
| get column value as int16 to the record | |
| typedef boolean_t(* | tosdb_record_set_uint16_f) (tosdb_record_t *record, const char_t *colname, const uint16_t value) | 
| set column value as uint16 to the record | |
| typedef boolean_t(* | tosdb_record_get_uint16_f) (tosdb_record_t *record, const char_t *colname, uint16_t *value) | 
| get column value as uint16 to the record | |
| typedef boolean_t(* | tosdb_record_set_int32_f) (tosdb_record_t *record, const char_t *colname, const int32_t value) | 
| set column value as int32 to the record | |
| typedef boolean_t(* | tosdb_record_get_int32_f) (tosdb_record_t *record, const char_t *colname, int32_t *value) | 
| get column value as int32 to the record | |
| typedef boolean_t(* | tosdb_record_set_uint32_f) (tosdb_record_t *record, const char_t *colname, const uint32_t value) | 
| set column value as uint32 to the record | |
| typedef boolean_t(* | tosdb_record_get_uint32_f) (tosdb_record_t *record, const char_t *colname, uint32_t *value) | 
| get column value as uint32 to the record | |
| typedef boolean_t(* | tosdb_record_set_int64_f) (tosdb_record_t *record, const char_t *colname, const int64_t value) | 
| set column value as int64 to the record | |
| typedef boolean_t(* | tosdb_record_get_int64_f) (tosdb_record_t *record, const char_t *colname, int64_t *value) | 
| get column value as int64 to the record | |
| typedef boolean_t(* | tosdb_record_set_uint64_f) (tosdb_record_t *record, const char_t *colname, const uint64_t value) | 
| set column value as uint64 to the record | |
| typedef boolean_t(* | tosdb_record_get_uint64_f) (tosdb_record_t *record, const char_t *colname, uint64_t *value) | 
| get column value as uint64 to the record | |
| typedef boolean_t(* | tosdb_record_set_string_f) (tosdb_record_t *record, const char_t *colname, const char_t *value) | 
| set column value as string to the record | |
| typedef boolean_t(* | tosdb_record_get_string_f) (tosdb_record_t *record, const char_t *colname, char_t **value) | 
| get column value as string to the record | |
| typedef boolean_t(* | tosdb_record_set_float32_f) (tosdb_record_t *record, const char_t *colname, const float32_t value) | 
| set column value as float32 to the record | |
| typedef boolean_t(* | tosdb_record_get_float32_f) (tosdb_record_t *record, const char_t *colname, float32_t *value) | 
| get column value as float32 to the record | |
| typedef boolean_t(* | tosdb_record_set_float64_f) (tosdb_record_t *record, const char_t *colname, const float64_t value) | 
| set column value as float64 to the record | |
| typedef boolean_t(* | tosdb_record_get_float64_f) (tosdb_record_t *record, const char_t *colname, float64_t *value) | 
| get column value as float64 to the record | |
| typedef boolean_t(* | tosdb_record_set_bytearray_f) (tosdb_record_t *record, const char_t *colname, uint64_t len, const uint8_t *value) | 
| set column value as byte array to the record | |
| typedef boolean_t(* | tosdb_record_get_bytearray_f) (tosdb_record_t *record, const char_t *colname, uint64_t *len, uint8_t **value) | 
| get column value as byte array to the record | |
| typedef boolean_t(* | tosdb_record_set_data_f) (tosdb_record_t *record, const char_t *colname, data_type_t type, uint64_t len, const void *value) | 
| set column value with data type to the record | |
| typedef boolean_t(* | tosdb_record_get_data_f) (tosdb_record_t *record, const char_t *colname, data_type_t type, uint64_t *len, void **value) | 
| get column value as byte array to the record | |
| typedef boolean_t(* | tosdb_record_destroy_f) (tosdb_record_t *record) | 
| destroys (frees) record | |
| typedef boolean_t(* | tosdb_record_upsert_f) (tosdb_record_t *record) | 
| updates or deletes record | |
| typedef boolean_t(* | tosdb_record_delete_f) (tosdb_record_t *record) | 
| deletes a record | |
| typedef boolean_t(* | tosdb_record_get_f) (tosdb_record_t *record) | 
| gets a record | |
| typedef list_t *(* | tosdb_record_search_f) (tosdb_record_t *record) | 
| searches a record | |
| typedef boolean_t(* | tosdb_record_is_deleted_f) (tosdb_record_t *record) | 
| checks if record is deleted | |
| Enumerations | |
| enum | tosdb_compaction_type_t { TOSDB_COMPACTION_TYPE_NONE , TOSDB_COMPACTION_TYPE_MINOR , TOSDB_COMPACTION_TYPE_MAJOR } | 
| tosdb compation types.  More... | |
| enum | tosdb_index_type_t { TOSDB_INDEX_PRIMARY , TOSDB_INDEX_UNIQUE , TOSDB_INDEX_SECONDARY } | 
| tosdb index types  More... | |
| Functions | |
| tosdb_backend_t * | tosdb_backend_memory_new (uint64_t capacity) | 
| creates new tosdb memory backend | |
| tosdb_backend_t * | tosdb_backend_memory_from_buffer (buffer_t *buffer) | 
| creates new tosdb memory backend from buffer | |
| uint8_t * | tosdb_backend_memory_get_contents (tosdb_backend_t *backend) | 
| get memory backend contents | |
| tosdb_backend_t * | tosdb_backend_disk_new (disk_or_partition_t *dp) | 
| creates new tosdb disk backend | |
| boolean_t | tosdb_backend_close (tosdb_backend_t *backend) | 
| closes and frees a backend | |
| tosdb_t * | tosdb_new (tosdb_backend_t *backend, compression_type_t compression_type_if_not_exists) | 
| creates tosdb | |
| boolean_t | tosdb_close (tosdb_t *tdb) | 
| closes a tosdb | |
| boolean_t | tosdb_free (tosdb_t *tdb) | 
| frees a tosdb | |
| boolean_t | tosdb_cache_config_set (tosdb_t *tdb, tosdb_cache_config_t *config) | 
| sets tosdb cache config | |
| boolean_t | tosdb_compact (tosdb_t *tdb, tosdb_compaction_type_t type) | 
| tosdb_database_t * | tosdb_database_create_or_open (tosdb_t *tdb, const char_t *name) | 
| creates new database | |
| boolean_t | tosdb_database_close (tosdb_database_t *db) | 
| closes a database | |
| boolean_t | tosdb_database_free (tosdb_database_t *db) | 
| frees a database | |
| tosdb_table_t * | tosdb_table_create_or_open (tosdb_database_t *db, const char_t *name, uint64_t max_record_count, uint64_t max_valuelog_size, uint64_t max_memtable_count) | 
| creates new table | |
| tosdb_sequence_t * | tosdb_sequence_create_or_open (tosdb_database_t *db, const char_t *name, int64_t start, int64_t cache_size) | 
| creates new sequence | |
| int64_t | tosdb_sequence_next (tosdb_sequence_t *seq) | 
| get next sequence value | |
| boolean_t | tosdb_table_column_add (tosdb_table_t *tbl, const char_t *colname, data_type_t type) | 
| adds a cloumn to given table | |
| boolean_t | tosdb_table_index_create (tosdb_table_t *tbl, const char_t *colname, tosdb_index_type_t type) | 
| creates an index on table | |
| boolean_t | tosdb_table_close (tosdb_table_t *tbl) | 
| closes a table | |
| boolean_t | tosdb_table_free (tosdb_table_t *tbl) | 
| frees a table | |
| tosdb_record_t * | tosdb_table_create_record (tosdb_table_t *tbl) | 
| creates a record for given table | |
| set_t * | tosdb_table_get_primary_keys (tosdb_table_t *tbl) | 
| get all primary keys in terms of record | |
tosdb interface
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
| typedef struct tosdb_backend_t tosdb_backend_t | 
tosdb backend struct type
| typedef struct tosdb_database_t tosdb_database_t | 
tosdb database struct type
| typedef boolean_t(* tosdb_record_delete_f) (tosdb_record_t *record) | 
deletes a record
| [in] | tbl | table interface | 
| [in] | record | a unique key | 
| typedef boolean_t(* tosdb_record_destroy_f) (tosdb_record_t *record) | 
destroys (frees) record
| [in] | record | record's itself | 
| typedef boolean_t(* tosdb_record_get_boolean_f) (tosdb_record_t *record, const char_t *colname, boolean_t *value) | 
get column value as boolean to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_bytearray_f) (tosdb_record_t *record, const char_t *colname, uint64_t *len, uint8_t **value) | 
get column value as byte array to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_char_f) (tosdb_record_t *record, const char_t *colname, char_t *value) | 
get column value as char to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_data_f) (tosdb_record_t *record, const char_t *colname, data_type_t type, uint64_t *len, void **value) | 
get column value as byte array to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | type | data type | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_f) (tosdb_record_t *record) | 
gets a record
| [in] | tbl | table interface | 
| [in,out] | record | record for retrive. for in it must contain a indexed key. for out it is populated with values. | 
| typedef boolean_t(* tosdb_record_get_float32_f) (tosdb_record_t *record, const char_t *colname, float32_t *value) | 
get column value as float32 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_float64_f) (tosdb_record_t *record, const char_t *colname, float64_t *value) | 
get column value as float64 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_int16_f) (tosdb_record_t *record, const char_t *colname, int16_t *value) | 
get column value as int16 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_int32_f) (tosdb_record_t *record, const char_t *colname, int32_t *value) | 
get column value as int32 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_int64_f) (tosdb_record_t *record, const char_t *colname, int64_t *value) | 
get column value as int64 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_int8_f) (tosdb_record_t *record, const char_t *colname, int8_t *value) | 
get column value as int8 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_string_f) (tosdb_record_t *record, const char_t *colname, char_t **value) | 
get column value as string to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_uint16_f) (tosdb_record_t *record, const char_t *colname, uint16_t *value) | 
get column value as uint16 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_uint32_f) (tosdb_record_t *record, const char_t *colname, uint32_t *value) | 
get column value as uint32 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_uint64_f) (tosdb_record_t *record, const char_t *colname, uint64_t *value) | 
get column value as uint64 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_get_uint8_f) (tosdb_record_t *record, const char_t *colname, uint8_t *value) | 
get column value as uint8 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [out] | value | column value | 
| typedef boolean_t(* tosdb_record_is_deleted_f) (tosdb_record_t *record) | 
checks if record is deleted
| [in] | record | record to check | 
| typedef list_t *(* tosdb_record_search_f) (tosdb_record_t *record) | 
searches a record
| [in] | tbl | table interface | 
| [in] | record | secondary key of record for retrive | 
| typedef boolean_t(* tosdb_record_set_boolean_f) (tosdb_record_t *record, const char_t *colname, const boolean_t value) | 
set column value as boolean to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_bytearray_f) (tosdb_record_t *record, const char_t *colname, uint64_t len, const uint8_t *value) | 
set column value as byte array to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_char_f) (tosdb_record_t *record, const char_t *colname, const char_t value) | 
set column value as char to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_data_f) (tosdb_record_t *record, const char_t *colname, data_type_t type, uint64_t len, const void *value) | 
set column value with data type to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | type | data type | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_float32_f) (tosdb_record_t *record, const char_t *colname, const float32_t value) | 
set column value as float32 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_float64_f) (tosdb_record_t *record, const char_t *colname, const float64_t value) | 
set column value as float64 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_int16_f) (tosdb_record_t *record, const char_t *colname, const int16_t value) | 
set column value as int16 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_int32_f) (tosdb_record_t *record, const char_t *colname, const int32_t value) | 
set column value as int32 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_int64_f) (tosdb_record_t *record, const char_t *colname, const int64_t value) | 
set column value as int64 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_int8_f) (tosdb_record_t *record, const char_t *colname, const int8_t value) | 
set column value as int8 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_string_f) (tosdb_record_t *record, const char_t *colname, const char_t *value) | 
set column value as string to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_uint16_f) (tosdb_record_t *record, const char_t *colname, const uint16_t value) | 
set column value as uint16 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_uint32_f) (tosdb_record_t *record, const char_t *colname, const uint32_t value) | 
set column value as uint32 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_uint64_f) (tosdb_record_t *record, const char_t *colname, const uint64_t value) | 
set column value as uint64 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef boolean_t(* tosdb_record_set_uint8_f) (tosdb_record_t *record, const char_t *colname, const uint8_t value) | 
set column value as uint8 to the record
| [in] | record | record's itself | 
| [in] | colname | column name | 
| [in] | value | column value | 
| typedef struct tosdb_record_t tosdb_record_t | 
tosdb record struct type
| typedef boolean_t(* tosdb_record_upsert_f) (tosdb_record_t *record) | 
updates or deletes record
| [in] | tbl | table interface | 
| [in] | record | record to upsert | 
| typedef struct tosdb_t tosdb_t | 
tosdb struct type
| typedef struct tosdb_table_t tosdb_table_t | 
tosdb table struct type
| enum tosdb_index_type_t | 
| boolean_t tosdb_backend_close | ( | tosdb_backend_t * | backend | ) | 
closes and frees a backend
| [in] | backend | the backend to operate | 
| tosdb_backend_t * tosdb_backend_disk_new | ( | disk_or_partition_t * | dp | ) | 
creates new tosdb disk backend
| [in] | dp | disk or partition | 
| tosdb_backend_t * tosdb_backend_memory_from_buffer | ( | buffer_t * | buffer | ) | 
creates new tosdb memory backend from buffer
| [in] | buffer | memory backend buffer | 
| uint8_t * tosdb_backend_memory_get_contents | ( | tosdb_backend_t * | backend | ) | 
get memory backend contents
| [in] | backend | memory backend | 
| tosdb_backend_t * tosdb_backend_memory_new | ( | uint64_t | capacity | ) | 
creates new tosdb memory backend
| [in] | capacity | memory backend max capacity | 
| boolean_t tosdb_cache_config_set | ( | tosdb_t * | tdb, | 
| tosdb_cache_config_t * | config ) | 
sets tosdb cache config
| [in] | tdb | tosdb instance | 
| [in] | config | tosdb cache config | 
| boolean_t tosdb_close | ( | tosdb_t * | tdb | ) | 
closes a tosdb
| [in] | tdb | tosdb | 
| boolean_t tosdb_database_close | ( | tosdb_database_t * | db | ) | 
closes a database
| [in] | db | the database to close | 
| tosdb_database_t * tosdb_database_create_or_open | ( | tosdb_t * | tdb, | 
| const char_t * | name ) | 
creates new database
| [in] | tdb | tosdb interface | 
| [in] | name | database name | 
| boolean_t tosdb_database_free | ( | tosdb_database_t * | db | ) | 
frees a database
| [in] | db | the database to free | 
| boolean_t tosdb_free | ( | tosdb_t * | tdb | ) | 
frees a tosdb
| [in] | tdb | tosdb | 
| tosdb_t * tosdb_new | ( | tosdb_backend_t * | backend, | 
| compression_type_t | compression_type_if_not_exists ) | 
creates tosdb
| [in] | backend | storage backend | 
| tosdb_sequence_t * tosdb_sequence_create_or_open | ( | tosdb_database_t * | db, | 
| const char_t * | name, | ||
| int64_t | start, | ||
| int64_t | cache_size ) | 
creates new sequence
| [in] | db | database interface | 
| [in] | name | sequence name | 
| [in] | start | sequence start | 
| [in] | cache_size | sequence cache size | 
| int64_t tosdb_sequence_next | ( | tosdb_sequence_t * | seq | ) | 
get next sequence value
| [in] | seq | the sequence to operate | 
| boolean_t tosdb_table_close | ( | tosdb_table_t * | tbl | ) | 
closes a table
| [in] | tbl | the table to close | 
| boolean_t tosdb_table_column_add | ( | tosdb_table_t * | tbl, | 
| const char_t * | colname, | ||
| data_type_t | type ) | 
adds a cloumn to given table
| [in] | tbl | table interface | 
| [in] | colname | cloumn name | 
| [in] | column | type | 
| tosdb_table_t * tosdb_table_create_or_open | ( | tosdb_database_t * | db, | 
| const char_t * | name, | ||
| uint64_t | max_record_count, | ||
| uint64_t | max_valuelog_size, | ||
| uint64_t | max_memtable_count ) | 
creates new table
| [in] | db | database interface | 
| [in] | name | table name | 
| [in] | max_record_count | maximum record count at each memtable/sstable | 
| [in] | max_valuelog_size | maximum valuelog size | 
| [in] | max_memtable_count | maximum memtable count at memory | 
| tosdb_record_t * tosdb_table_create_record | ( | tosdb_table_t * | tbl | ) | 
creates a record for given table
| [in] | tbl | table | 
| boolean_t tosdb_table_free | ( | tosdb_table_t * | tbl | ) | 
frees a table
| [in] | tbl | the table to close | 
| set_t * tosdb_table_get_primary_keys | ( | tosdb_table_t * | tbl | ) | 
get all primary keys in terms of record
| [in] | tbl | table | 
| boolean_t tosdb_table_index_create | ( | tosdb_table_t * | tbl, | 
| const char_t * | colname, | ||
| tosdb_index_type_t | type ) | 
creates an index on table
| [in] | tbl | table interface | 
| [in] | colname | index column name | 
| [in] | type | index type |