Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Data Structures | Macros | Typedefs | Enumerations | Functions
openapi_syncdb.h File Reference
#include <pthread.h>

Go to the source code of this file.

Data Structures

struct  syncdbClientHandle_t
 syncdb Client Handle. More...
 
struct  syncdbClientStatus_t
 Client Table Status. More...
 
struct  syncdbDataTableStatus_t
 Data Table Status. More...
 
struct  syncdbJsonNode_s
 The JSON node definition. More...
 

Macros

#define SYNCDB_AGENT_MAX_MSG_SIZE   8000
 Maximum size of the message buffer between the SyncDB process and the SyncDB Agent. More...
 
#define SYNCDB_DUPNAME   (-3)
 Table exists with duplicate name.
 
#define SYNCDB_ENTRY_EXISTS   (-9)
 AVL entry with the specified key already exists.
 
#define SYNCDB_ERROR   (-1)
 General Error.
 
#define SYNCDB_FULL   (-5)
 Specified table is full.
 
#define SYNCDB_JSON_MAX_SCHEMA_SIZE   (SYNCDB_RECORD_MAX_SIZE)
 The schema for storable records is also defined using JSON format. More...
 
#define SYNCDB_MAX_CLIENTS   (-2)
 Reached maximum number of clients.
 
#define SYNCDB_MAX_STR_LEN   256
 Maximum length for string fields used by syncdb. More...
 
#define SYNCDB_NO_TABLE   (-4)
 Specified table does not exist.
 
#define SYNCDB_NOT_FOUND   (-7)
 Specified record is not in the table. More...
 
#define SYNCDB_OK   (0)
 Operation is Successful.
 
#define SYNCDB_RECORD_MAX_SIZE   (1024*64)
 Maximum size of a single data record. More...
 
#define SYNCDB_SCHEMA_ERROR   (-8)
 Schema validation error.
 
#define SYNCDB_SIZE   (-6)
 Specified record size is invalid for this table. More...
 
#define SYNCDB_TABLE_FLAG_EXISTS   (1 << 3)
 When this flag is set, the syncdbInsert() function returns an error if an entry with the specified key already exists. More...
 
#define SYNCDB_TABLE_FLAG_FILE_LOAD   (1 << 2)
 If this flag is enabled then the syncdb tries to populate the table from a file when creating the table. More...
 
#define SYNCDB_TABLE_FLAG_NSF   (1 << 4)
 When this flag is set, the content of the table is synchronized with the backup manager. More...
 
#define SYNCDB_TABLE_FLAG_NVRAM   (1 << 1)
 This table is copied to NVRAM when the table-store command is received. More...
 
#define SYNCDB_TABLE_FLAG_STORABLE   (1 << 0)
 This table can be stored in a file. More...
 
#define SYNCDB_TABLE_NAME_SIZE   32
 Maximum size of the text string that uniquely identifies a database table. More...
 
#define SYNCDB_TABLE_STAT_AVL_TREE_PURGED   (1 << 2)
 AVL Tree Purged (Cleared on Read) This bit indicates that all delete-pending entries have been removed from the AVL tree since the last call to the syncdbTableStatusGet() function. More...
 
#define SYNCDB_TABLE_STAT_CHANGED   (1 << 1)
 Changes pending for this client. More...
 
#define SYNCDB_TABLE_STAT_EXISTS   (1 << 0)
 Specified Table Exist If this bit is not set to 1 then all other bits are meaningless.
 
#define SYNCDB_TABLE_STAT_NEW_TABLE   (1 << 3)
 New Table (Cleared on Read) This bit indicates that the syncdbTableStatusGet() function is called for the first time since the table has been created. More...
 
#define SYNCDB_TABLE_TYPE_AVL_TREE   2
 
#define SYNCDB_TABLE_TYPE_QUEUE   3
 
#define SYNCDB_TABLE_TYPE_RECORD   0
 
#define SYNCDB_TABLE_TYPE_STORABLE_RECORD   1
 

Typedefs

typedef struct syncdbJsonNode_s syncdbJsonNode_t
 The JSON node definition.
 

Enumerations

enum  syncdbJsonDataType_e { SYNCDB_JSON_NUMBER = 1, SYNCDB_JSON_STRING = 2, SYNCDB_JSON_ARRAY = 3 }
 The syncdb supports the following JSON data types: SYNCDB_JSON_NUMBER - A numeric value. More...
 
enum  syncdbSchemaError_e {
  SYNCDB_SCHEMA_OK = 0, SYNCDB_SCHEMA_TOO_BIG = 1, SYNCDB_SCHEMA_OVERLAP = 2, SYNCDB_SCHEMA_TOO_SHORT = 3,
  SYNCDB_SCHEMA_GAP = 4, SYNCDB_SCHEMA_INT_OVERFLOW = 5, SYNCDB_SCHEMA_STRING_OVERFLOW = 6, SYNCDB_SCHEMA_INT_SIZE = 7,
  SYNCDB_SCHEMA_TYPE = 8, SYNCDB_SCHEMA_NO_ZERO_OFFSET = 9, SYNCDB_SCHEMA_ZERO_SIZE = 10, SYNCDB_SCHEMA_DUP_NAME = 11
}
 The following errors may be reported during schema validation. More...
 

Functions

int syncdbAvlTableCreate (syncdbClientHandle_t *client_id, char *table_name, unsigned int table_version, unsigned int max_elements, unsigned int max_live_elements, unsigned int node_size, unsigned int key_size, unsigned int flags, char *schema, unsigned int schema_size)
 Create AVL Table. More...
 
int syncdbClientDeregister (syncdbClientHandle_t *client_id)
 Deregister a client from the syncdb. More...
 
int syncdbClientRegister (char *client_name, syncdbClientHandle_t *client_id)
 Register a new client with the syncdb. More...
 
int syncdbClientStatusGet (syncdbClientHandle_t *client_id, syncdbClientStatus_t *client_status)
 Get client information for the specified client ID. More...
 
int syncdbDelete (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size)
 Delete an entry from the AVL table. More...
 
int syncdbFieldGet (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size, unsigned int field_offset, unsigned int field_size, int flags_unchanged, int *delete_pending)
 Get the specified field in an entry from the table. More...
 
int syncdbFieldSet (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size, unsigned int field_offset, unsigned int field_size)
 Set the specified field in an entry in the table. More...
 
int syncdbGet (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size, int *delete_pending)
 Get an entry from the table. More...
 
int syncdbGetNext (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size, int *delete_pending)
 Get the Next entry from the table. More...
 
int syncdbGetNextChanged (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size, int *delete_pending)
 Get the Next Changed entry from the table. More...
 
int syncdbInsert (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size)
 Insert a new entry into the AVL table. More...
 
int syncdbNsfModeSet (syncdbClientHandle_t *client_id, unsigned int sync_mode, unsigned int max_msg_size)
 Tell SyncDB that it should start or stop data sync with the backup manager. More...
 
int syncdbRecordTableCreate (syncdbClientHandle_t *client_id, char *table_name, unsigned int table_version, unsigned int node_size, unsigned int flags, char *schema, unsigned int schema_size)
 Create a Record Table. More...
 
int syncdbSet (syncdbClientHandle_t *client_id, char *table_name, void *element, unsigned int size)
 Set an entry in the table. More...
 
int syncdbTableChangeCheck (syncdbClientHandle_t *client_id, int timeout_secs)
 Check whether any change notifications are pending for this client. More...
 
int syncdbTableChangeNotify (syncdbClientHandle_t *client_id, char *table_name)
 Notify this client about changes to the specified table. More...
 
int syncdbTableDelete (syncdbClientHandle_t *client_id, char *table_name)
 Delete specified table or all tables. More...
 
int syncdbTableStatusGet (syncdbClientHandle_t *client_id, int num_tables, syncdbDataTableStatus_t *table_list)
 Get Table Status as it pertains to the specified client. More...
 
int syncdbTableStore (syncdbClientHandle_t *client_id, char *table_name, unsigned int nvram)
 Store specified table or all tables into the file system. More...
 
int syncdbUtilSchemaCreate (syncdbJsonNode_t *element_node, unsigned int node_schema_size, char *schema_buf, unsigned int buf_size, unsigned int *schema_size, unsigned int data_element_size, syncdbSchemaError_e *schema_error)
 Generate a storable record schema. More...