Turnstone Operating System
Loading...
Searching...
No Matches
tosdb.h File Reference

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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
typedef boolean_t(* tosdb_record_destroy_f) (tosdb_record_t *record)
 destroys (frees) record More...
 
typedef boolean_t(* tosdb_record_upsert_f) (tosdb_record_t *record)
 updates or deletes record More...
 
typedef boolean_t(* tosdb_record_delete_f) (tosdb_record_t *record)
 deletes a record More...
 
typedef boolean_t(* tosdb_record_get_f) (tosdb_record_t *record)
 gets a record More...
 
typedef list_t *(* tosdb_record_search_f) (tosdb_record_t *record)
 searches a record More...
 
typedef boolean_t(* tosdb_record_is_deleted_f) (tosdb_record_t *record)
 checks if record is deleted More...
 

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_ttosdb_backend_memory_new (uint64_t capacity)
 creates new tosdb memory backend More...
 
tosdb_backend_ttosdb_backend_memory_from_buffer (buffer_t *buffer)
 creates new tosdb memory backend from buffer More...
 
uint8_ttosdb_backend_memory_get_contents (tosdb_backend_t *backend)
 get memory backend contents More...
 
tosdb_backend_ttosdb_backend_disk_new (disk_or_partition_t *dp)
 creates new tosdb disk backend More...
 
boolean_t tosdb_backend_close (tosdb_backend_t *backend)
 closes and frees a backend More...
 
tosdb_ttosdb_new (tosdb_backend_t *backend, compression_type_t compression_type_if_not_exists)
 creates tosdb More...
 
boolean_t tosdb_close (tosdb_t *tdb)
 closes a tosdb More...
 
boolean_t tosdb_free (tosdb_t *tdb)
 frees a tosdb More...
 
boolean_t tosdb_cache_config_set (tosdb_t *tdb, tosdb_cache_config_t *config)
 sets tosdb cache config More...
 
boolean_t tosdb_compact (tosdb_t *tdb, tosdb_compaction_type_t type)
 
tosdb_database_ttosdb_database_create_or_open (tosdb_t *tdb, const char_t *name)
 creates new database More...
 
boolean_t tosdb_database_close (tosdb_database_t *db)
 closes a database More...
 
boolean_t tosdb_database_free (tosdb_database_t *db)
 frees a database More...
 
tosdb_table_ttosdb_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 More...
 
tosdb_sequence_ttosdb_sequence_create_or_open (tosdb_database_t *db, const char_t *name, int64_t start, int64_t cache_size)
 creates new sequence More...
 
int64_t tosdb_sequence_next (tosdb_sequence_t *seq)
 get next sequence value More...
 
boolean_t tosdb_table_column_add (tosdb_table_t *tbl, const char_t *colname, data_type_t type)
 adds a cloumn to given table More...
 
boolean_t tosdb_table_index_create (tosdb_table_t *tbl, const char_t *colname, tosdb_index_type_t type)
 creates an index on table More...
 
boolean_t tosdb_table_close (tosdb_table_t *tbl)
 closes a table More...
 
boolean_t tosdb_table_free (tosdb_table_t *tbl)
 frees a table More...
 
tosdb_record_ttosdb_table_create_record (tosdb_table_t *tbl)
 creates a record for given table More...
 
set_ttosdb_table_get_primary_keys (tosdb_table_t *tbl)
 get all primary keys in terms of record More...
 

Detailed Description

tosdb interface

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Typedef Documentation

◆ tosdb_backend_t

tosdb backend struct type

◆ tosdb_database_t

tosdb database struct type

◆ tosdb_record_delete_f

typedef boolean_t(* tosdb_record_delete_f) (tosdb_record_t *record)

deletes a record

Parameters
[in]tbltable interface
[in]recorda unique key
Returns
deletes a record

◆ tosdb_record_destroy_f

typedef boolean_t(* tosdb_record_destroy_f) (tosdb_record_t *record)

destroys (frees) record

Parameters
[in]recordrecord's itself
Returns
an iterator whose elements are tosdb_record_t

◆ tosdb_record_get_boolean_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_bytearray_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_char_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_data_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]typedata type
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_f

typedef boolean_t(* tosdb_record_get_f) (tosdb_record_t *record)

gets a record

Parameters
[in]tbltable interface
[in,out]recordrecord for retrive. for in it must contain a indexed key. for out it is populated with values.
Returns
true if record found. record populated with values.

◆ tosdb_record_get_float32_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_float64_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_int16_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_int32_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_int64_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_int8_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_string_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_uint16_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_uint32_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_uint64_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_get_uint8_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[out]valuecolumn value
Returns
true if value can be getted

◆ tosdb_record_is_deleted_f

typedef boolean_t(* tosdb_record_is_deleted_f) (tosdb_record_t *record)

checks if record is deleted

Parameters
[in]recordrecord to check
Returns
true if record is deleted

◆ tosdb_record_search_f

typedef list_t *(* tosdb_record_search_f) (tosdb_record_t *record)

searches a record

Parameters
[in]tbltable interface
[in]recordsecondary key of record for retrive
Returns
the record list

◆ tosdb_record_set_boolean_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_bytearray_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_char_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_data_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]typedata type
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_float32_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_float64_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_int16_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_int32_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_int64_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_int8_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_string_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_uint16_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_uint32_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_uint64_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_set_uint8_f

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

Parameters
[in]recordrecord's itself
[in]colnamecolumn name
[in]valuecolumn value
Returns
true if value can be setted

◆ tosdb_record_t

tosdb record struct type

◆ tosdb_record_upsert_f

typedef boolean_t(* tosdb_record_upsert_f) (tosdb_record_t *record)

updates or deletes record

Parameters
[in]tbltable interface
[in]recordrecord to upsert
Returns
true if succeed

◆ tosdb_t

typedef struct tosdb_t tosdb_t

tosdb struct type

◆ tosdb_table_t

typedef struct tosdb_table_t tosdb_table_t

tosdb table struct type

Enumeration Type Documentation

◆ tosdb_compaction_type_t

tosdb compation types.

Enumerator
TOSDB_COMPACTION_TYPE_NONE 

tosdb compation type none

TOSDB_COMPACTION_TYPE_MINOR 

tosdb compation type minor, compacts same level, removes duplicates, deleted ones

TOSDB_COMPACTION_TYPE_MAJOR 

tosdb comaption type major, compacts whole level into a a high level

◆ tosdb_index_type_t

tosdb index types

Enumerator
TOSDB_INDEX_PRIMARY 

primary index

TOSDB_INDEX_UNIQUE 

a unique index

TOSDB_INDEX_SECONDARY 

a secondary index

Function Documentation

◆ tosdb_backend_close()

boolean_t tosdb_backend_close ( tosdb_backend_t backend)

closes and frees a backend

Parameters
[in]backendthe backend to operate
Returns
true if succeed.

◆ tosdb_backend_disk_new()

tosdb_backend_t * tosdb_backend_disk_new ( disk_or_partition_t dp)

creates new tosdb disk backend

Parameters
[in]dpdisk or partition
Returns
disk backend

◆ tosdb_backend_memory_from_buffer()

tosdb_backend_t * tosdb_backend_memory_from_buffer ( buffer_t buffer)

creates new tosdb memory backend from buffer

Parameters
[in]buffermemory backend buffer
Returns
memory backend

◆ tosdb_backend_memory_get_contents()

uint8_t * tosdb_backend_memory_get_contents ( tosdb_backend_t backend)

get memory backend contents

Parameters
[in]backendmemory backend
Returns
byte array of conntent

◆ tosdb_backend_memory_new()

tosdb_backend_t * tosdb_backend_memory_new ( uint64_t  capacity)

creates new tosdb memory backend

Parameters
[in]capacitymemory backend max capacity
Returns
memory backend

◆ tosdb_cache_config_set()

boolean_t tosdb_cache_config_set ( tosdb_t tdb,
tosdb_cache_config_t config 
)

sets tosdb cache config

Parameters
[in]tdbtosdb instance
[in]configtosdb cache config
Returns
true if cache config can be setted

◆ tosdb_close()

boolean_t tosdb_close ( tosdb_t tdb)

closes a tosdb

Parameters
[in]tdbtosdb
Returns
true if succeed.

◆ tosdb_database_close()

boolean_t tosdb_database_close ( tosdb_database_t db)

closes a database

Parameters
[in]dbthe database to close
Returns
true if succeed.

◆ tosdb_database_create_or_open()

tosdb_database_t * tosdb_database_create_or_open ( tosdb_t tdb,
const char_t name 
)

creates new database

Parameters
[in]tdbtosdb interface
[in]namedatabase name
Returns
a new database or existing one

◆ tosdb_database_free()

boolean_t tosdb_database_free ( tosdb_database_t db)

frees a database

Parameters
[in]dbthe database to free
Returns
true if succeed.

◆ tosdb_free()

boolean_t tosdb_free ( tosdb_t tdb)

frees a tosdb

Parameters
[in]tdbtosdb
Returns
true if succeed.

◆ tosdb_new()

tosdb_t * tosdb_new ( tosdb_backend_t backend,
compression_type_t  compression_type_if_not_exists 
)

creates tosdb

Parameters
[in]backendstorage backend
Returns
new tosdb

◆ tosdb_sequence_create_or_open()

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

Parameters
[in]dbdatabase interface
[in]namesequence name
[in]startsequence start
[in]cache_sizesequence cache size
Returns
a new sequence or existing one

◆ tosdb_sequence_next()

int64_t tosdb_sequence_next ( tosdb_sequence_t seq)

get next sequence value

Parameters
[in]seqthe sequence to operate
Returns
next sequence value

◆ tosdb_table_close()

boolean_t tosdb_table_close ( tosdb_table_t tbl)

closes a table

Parameters
[in]tblthe table to close
Returns
true if succeed.

◆ tosdb_table_column_add()

boolean_t tosdb_table_column_add ( tosdb_table_t tbl,
const char_t colname,
data_type_t  type 
)

adds a cloumn to given table

Parameters
[in]tbltable interface
[in]colnamecloumn name
[in]columntype
Returns
true if succeed.

◆ tosdb_table_create_or_open()

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

Parameters
[in]dbdatabase interface
[in]nametable name
[in]max_record_countmaximum record count at each memtable/sstable
[in]max_valuelog_sizemaximum valuelog size
[in]max_memtable_countmaximum memtable count at memory
Returns
a new table or existing one

◆ tosdb_table_create_record()

tosdb_record_t * tosdb_table_create_record ( tosdb_table_t tbl)

creates a record for given table

Parameters
[in]tbltable
Returns
record

◆ tosdb_table_free()

boolean_t tosdb_table_free ( tosdb_table_t tbl)

frees a table

Parameters
[in]tblthe table to close
Returns
true if succeed.

◆ tosdb_table_get_primary_keys()

set_t * tosdb_table_get_primary_keys ( tosdb_table_t tbl)

get all primary keys in terms of record

Parameters
[in]tbltable
Returns
set of record with only contains primary key

◆ tosdb_table_index_create()

boolean_t tosdb_table_index_create ( tosdb_table_t tbl,
const char_t colname,
tosdb_index_type_t  type 
)

creates an index on table

Parameters
[in]tbltable interface
[in]colnameindex column name
[in]typeindex type
Returns
true if succeed.