DBParam

C++
Java

DBParam helps set the various configuration for the BangDB. It has following configurable parameter:

host

Sets the host ip of the server, not relevant for embedded

port

Sets the port id of the server, not relevant for embedded

userid

BangDB uses default id as of now, will change in future

password

BangDB used default password as of now, will change in future

init_sock_conn

Boolean to specify if we need to init the socket connection, not relevant for embedded

tls_conn

Whether to use ssl/tls based secure channel or not, not relevant for BangDB embedded

tran_type

Whether the db should be opened in transaction mode or not, following trantypes are available:

enum TransactionType { 
   DB_TRANSACTION_NONE,
   DB_OPTIMISTIC_TRANSACTION,
   DB_PESSIMISTIC_TRANSACTION,
};

Only DB_OPTIMISTIC_TRANSACTION is supported.

config_path

Path to the bangdb.config file

dbPath

Path for db to keep files

dbLogPath

Path for db to keep log files

dbArchivePath

In case of archival, this path should be used to keep archived data

TableEnv

C++
Java

Table environment defines the way table should be created. This is very important helper type and should be used carefully and in right manner to create a table.

Here are the parameter for the table environment:

db_type

Type of db, in-memory or persistent as well. Default is persistent.

It is selected from following enum:

// types of db 
enum PersistType { 
   INMEM_ONLY, // only RAM based, cache enabled (no overflow to disk, ideally overflow to other RAM) 
   INMEM_PERSIST, // disked backed, cache enabled (over flow to disk) 
   PERSIST_ONLY, // cache disabled, direct file IO INVALID_PERSIST_TYPE
};

Most of the time user is not required to set this, default is fine.

idx_type

Type of index for primary key, how primary keys would be stored.

It is driven from following enum:

// types of pk arrangement 
enum IndexType { 
   HASH, 
   EXTHASH, 
   BTREE, 
   HEAP, 
   INVALID_INDEX_TYPE, 
};

Default is BTREE, and it's good for most of the cases.

key_sz

In case of string key, what's the maximum size of the primary key. Please note large size is not good for performance reasons, typically it should be less than 64 bytes, but if it has to be more, please set it accordingly, but not good from efficiency perspective.

table_sz_hint

This is optional, and it helps tell the db how large this table is going to be in case it's created. Good for db optimization. Please note this only affects the db in run time, therefore it could be reset while db restarts etc.

log_sz_mb

Usually default is good, however you may use to reset it. This tells what the size of a single log file is. This log file is Write Ahead Log, where db writes metadata and/or data for atomicity, transction and data recovery perspective.

table_log_type

BangDB can create write ahead log in shared and in private mode. Shared mode will have a log structure shared by all tables, whereas private log will be created for each table. It's always good to use shared (default) log type unless there is a security or other reason to use private.

Here are the options:

// log type 
enum LogType { 
   SHARED_LOG, 
   PRIVATE_LOG, 
};

table_type

The type of the table. Default is NORMAL_TABLE, but user must change this as per requirement. This is a must specified parameter and user must define it properly.

Here are the options:

enum TableType { 
   NORMAL_TABLE, 
   WIDE_TABLE, 
   INDEX_TABLE, 
   PRIMITIVE_TABLE_INT, 
   PRIMITIVE_TABLE_LONG, 
   PRIMITIVE_TABLE_STRING, 
   LARGE_TABLE, 
   BANGDB_TABLE_INVALID 
};

wal_enabled

This tells if write ahead log is enabled or not. User can switch on or off it using this. Default is ON.

Autocommit

This is always ON

sort_method

When BTREE for index is used then we have to define the sort method.

Here are the options:

enum SortMethod { 
   LEXICOGRAPH = 1, 
   QUASI_LEXICOGRAPH = 2, 
};

default is QUASI_LEXICOGRAPH = 2

sort_direction

User can define if sort is in increasing or decreasing order.

Here are the options:

enum SortDirection { 
   SORT_ASCENDING = 3,
   SORT_DESCENDING = 4,
   SORT_INVALID 
};

default is SORT_ASCENDING.

key_type

User may override key type as well.

Here are the options:

enum KeyType { 
   NORMAL_KEY = 1,
   COMPOSITE_KEY = 3,
   NORMAL_KEY_LONG = 10,
};

defaut is NORMAL_KEY.

table_sub_type

To set sub type of the table.

Here are the options:

enum TableSubType { 
   BANGDB_SW_TABLE, 
   BANGDB_TOPK_TABLE, 
   NON_ANALYTICAL_TABLE, 
   INDEXBTREE_TABLE, 
   DUPLINDEX_TABLE_NOLOG, 
   BANGDB_SW_INVALID, 
};

Default is NON_ANALYTICAL_TABLE.

allow_duplicate

Sets if duplicate keys are allowed.

version_type

When duplicate keys are set for primary or secondary, then to have data version defined for proper retrieval of data, we should set this.

The options are:

enum VersionType { 
   BANGDB_DATA_VERSION_INVALID = 0,
   BANGDB_DATA_VERSION_VALID = 1,
};

Default is BANGDB_DATA_VERSION_INVALID.

allow_rev_idx

Set to allow reverse indexing. Note that it can only be done for WIDE_TABLE.