On this page

BangDBCommon

BangDB Helper (Common) Enums

C++

Java

enum ML_BANGDB_SERVER_TYPE
{
        ML_BANGDB_SERVER_TYPE_INVALID = 0,
        ML_BANGDB_SERVER_TYPE_TRAIN,
        ML_BANGDB_SERVER_TYPE_PREDICT,
        ML_BANGDB_SERVER_TYPE_TRAIN_PREDICT,
};

enum ML_BANGDB_ALGO_TYPE
{
        ML_BANGDB_ALGO_TYPE_INVALID = 0,
        ML_BANGDB_ALGO_TYPE_SVM,
        ML_BANGDB_ALGO_TYPE_IE,
        ML_BANGDB_ALGO_TYPE_IE_SENT,
        ML_BANGDB_ALGO_TYPE_IE_TAGS_SUPPORTED,
        ML_BANGDB_ALGO_TYPE_IE_NER_DETECT,
        ML_BANGDB_ALGO_TYPE_IE_WORD_DICT,
        ML_BANGDB_ALGO_TYPE_IE_NER_TRAIN,
        ML_BANGDB_ALGO_TYPE_KMEANS_TRAIN,
        ML_BANGDB_ALGO_TYPE_CUSTOM_EX,
        ML_BANGDB_ALGO_TYPE_LIN,

        //add all other algo type above this line
        ML_MAX_ALGO_TYPE,
};

enum ML_BANGDB_TRAIN_SOURCE
{
        ML_BANGDB_TRAIN_SOURCE_INVALID = 0,
        ML_BANGDB_TRAIN_SOURCE_FILE,
        ML_BANGDB_TRAIN_SOURCE_DIR,
        ML_BANGDB_TRAIN_SOURCE_DOMAIN,
        ML_BANGDB_TRAIN_SOURCE_STREAM,
        ML_BANGDB_TRAIN_SOURCE_TEXT,
};

enum ML_IE_TRAIN_ACTION
{
        ML_IE_TRAIN_ACTION_ALL = 0,
        ML_IE_TRAIN_ONLY_HELP,
        ML_IE_TRAIN_ACTION_SKIP_HELP,
        ML_IE_TRAIN_ACTION_SKIP_KB_TRAIN,
        ML_IE_TRAIN_ACTION_INVALID,
};

enum ML_PREDICT_DATA_TYPE
{
        ML_PREDICT_DATA_TYPE_INVALID = 0,
        ML_PREDICT_DATA_TYPE_FILE,
        ML_PREDICT_DATA_TYPE_EVENT,
};

enum ML_DATA_REFORMAT_TYPE
{
        ML_DATA_REFORMAT_TYPE_NONE = 0,
        ML_DATA_REFORMAT_TYPE_CSV,
        ML_DATA_REFORMAT_TYPE_ARFF,
        ML_DATA_REFORMAT_TYPE_JSON,
        ML_DATA_REFORMAT_JSON_TO_CSV,
        ML_DATA_REFORMAT_TYPE_TSROLLUP,
        ML_DATA_REFORMAT_TYPE_INVALID,  //add other enum val for different format above this
        // todo: need to add libsvm to csv, arff to csv etc
};

enum ML_BANGDB_ATTR_TYPE
{
        ML_BANGDB_ATTR_TYPE_INVALID = 0,
        ML_BANGDB_ATTR_TYPE_NUM,
        ML_BANGDB_ATTR_TYPE_STR,
        ML_BANGDB_ATTR_TYPE_HYBRID,
};

enum ML_BANGDB_TRAIN_SPEED
{
        ML_BANGDB_TRAIN_SPEED_VERYFAST = 1,
        ML_BANGDB_TRAIN_SPEED_FAST,
        ML_BANGDB_TRAIN_SPEED_MEDIUM,
        ML_BANGDB_TRAIN_SPEED_SLOW,
        ML_BANGDB_TRAIN_SPEED_VERYSLOW,
        ML_BANGDB_TRAIN_SPEED_INVALID,
};

enum ML_BANGDB_TRAINING_STATE
{
        //error
        ML_BANGDB_TRAINING_STATE_INVALID_INPUT = 10,
        ML_BANGDB_TRAINING_STATE_NOT_PRSENT,
        ML_BANGDB_TRAINING_STATE_ERROR_PARSE,
        ML_BANGDB_TRAINING_STATE_ERROR_FORMAT,
        ML_BANGDB_TRAINING_STATE_ERROR_BRS,
        ML_BANGDB_TRAINING_STATE_ERROR_TUNE,
        ML_BANGDB_TRAINING_STATE_ERROR_TRAIN,
        ML_FILE_TYPE_ERROR_VAL_TESTDATA,
        ML_FILE_TYPE_ERROR_VAL_TRAINDATA,
        ML_BANGDB_TRAINING_STATE_LIMBO,
        //intermediate states
        ML_BANGDB_TRAINING_STATE_BRS_GET_PENDING,
        ML_BANGDB_TRAINING_STATE_BRS_GET_DONE,
        ML_BANGDB_TRAINING_STATE_REFORMAT_DONE,
        ML_BANGDB_TRAINING_STATE_SCALE_TUNING_DONE,
        ML_BANGDB_TRAINING_STATE_BRS_MODEL_UPLOAD_PENDING,
        //training done
        ML_BANGDB_TRAINING_STATE_TRAINING_DONE, //25
        ML_BANGDB_TRAINING_STATE_DEPRICATED,
};

enum ML_BANGDB_PRED_STATE
{
        ML_BANGDB_PRED_STATE_INVALID_INPUT = 10,
        ML_BANGDB_PRED_STATE_NOT_PRESENT,
        ML_BANGDB_PRED_STATE_ERROR_PARSE,
        ML_BANGDB_PRED_STATE_ERROR_FORMAT,
        ML_BANGDB_PRED_STATE_ERROR_BRS_FETCH,
        ML_BANGDB_PRED_STATE_ERROR_FILE_FORMAT,
        ML_BANGDB_PRED_STATE_ERROR_FILE_REFORMAT,
        ML_BANGDB_PRED_STATE_ERROR_FILE_TUNE,
        ML_BANGDB_PRED_STATE_ERROR_PREDICT,
        ML_BANGDB_PRED_STATE_LIMBO,
        ML_BANGDB_PRED_STATE_BRS_FETCH_PENDING,
        ML_BANGDB_PRED_STATE_BRS_FETCH_DONE,
        ML_BANGDB_PRED_STATE_REFORMAT_DONE,
        ML_BANGDB_PRED_STATE_TUNE_DONE,
        ML_BANGDB_PRED_STATE_BRS_PUT_DONE,
        ML_BANGDB_PRED_STATE_PREDICT_DONE, //25
        ML_BANGDB_PRED_STATE_DEPRICATED
};

enum ML_BANGDB_TRAINING_STATE
{
        //error
        ML_BANGDB_TRAINING_STATE_INVALID_INPUT = 10,
        ML_BANGDB_TRAINING_STATE_NOT_PRSENT,
        ML_BANGDB_TRAINING_STATE_ERROR_PARSE,
        ML_BANGDB_TRAINING_STATE_ERROR_FORMAT,
        ML_BANGDB_TRAINING_STATE_ERROR_BRS,
        ML_BANGDB_TRAINING_STATE_ERROR_TUNE,
        ML_BANGDB_TRAINING_STATE_ERROR_TRAIN,
        ML_FILE_TYPE_ERROR_VAL_TESTDATA,
        ML_FILE_TYPE_ERROR_VAL_TRAINDATA,
        ML_BANGDB_TRAINING_STATE_LIMBO,
        //intermediate states
        ML_BANGDB_TRAINING_STATE_BRS_GET_PENDING,
        ML_BANGDB_TRAINING_STATE_BRS_GET_DONE,
        ML_BANGDB_TRAINING_STATE_REFORMAT_DONE,
        ML_BANGDB_TRAINING_STATE_SCALE_TUNING_DONE,
        ML_BANGDB_TRAINING_STATE_BRS_MODEL_UPLOAD_PENDING,
        //training done
        ML_BANGDB_TRAINING_STATE_TRAINING_DONE, //25
        ML_BANGDB_TRAINING_STATE_DEPRICATED,
};

enum ML_BANGDB_PRED_STATE
{
        ML_BANGDB_PRED_STATE_INVALID_INPUT = 10,
        ML_BANGDB_PRED_STATE_NOT_PRESENT,
        ML_BANGDB_PRED_STATE_ERROR_PARSE,
        ML_BANGDB_PRED_STATE_ERROR_FORMAT,
        ML_BANGDB_PRED_STATE_ERROR_BRS_FETCH,
        ML_BANGDB_PRED_STATE_ERROR_FILE_FORMAT,
        ML_BANGDB_PRED_STATE_ERROR_FILE_REFORMAT,
        ML_BANGDB_PRED_STATE_ERROR_FILE_TUNE,
        ML_BANGDB_PRED_STATE_ERROR_PREDICT,
        ML_BANGDB_PRED_STATE_LIMBO,
        ML_BANGDB_PRED_STATE_BRS_FETCH_PENDING,
        ML_BANGDB_PRED_STATE_BRS_FETCH_DONE,
        ML_BANGDB_PRED_STATE_REFORMAT_DONE,
        ML_BANGDB_PRED_STATE_TUNE_DONE,
        ML_BANGDB_PRED_STATE_BRS_PUT_DONE,
        ML_BANGDB_PRED_STATE_PREDICT_DONE, //25
        ML_BANGDB_PRED_STATE_DEPRICATED
};

//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
};

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

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

//how should we access db, various ways
enum OpenType
{
        OPENCREATE,
        TRUNCOPEN,
        JUSTOPEN
};

//how should db be closed
enum CloseType
{
        DEFAULT_AT_CLIENT,
        CONSERVATIVE_AT_SERVER,
        OPTIMISTIC_AT_SERVER,
        CLEANCLOSE_AT_SERVER,
        SIMPLECLOSE_AT_SERVER,
        DEFAULT_AT_SERVER,
};

//the insert options
enum InsertOptions
{
        INSERT_UNIQUE,          //if non-existing then insert else return
        UPDATE_EXISTING,        //if existing then update else return
        INSERT_UPDATE,          //insert if non-existing else update
        DELETE_EXISTING,        //delete if existing
        UPDATE_EXISTING_INPLACE, //only for inplace update
        INSERT_UPDATE_INPLACE, //only for inplace update
};

enum TransactionType
{
        DB_TRANSACTION_NONE,
        DB_OPTIMISTIC_TRANSACTION,
        DB_PESSIMISTIC_TRANSACTION,
};

enum TableSizeHint
{
        TINY_TABLE_SIZE,
        SMALL_TABLE_SIZE,
        NORMAL_TABLE_SIZE,
        BIG_TABLE_SIZE,
        TABLE_SIZE_INVALID,
};

enum TableType
{
        /* index and data files with opaque (void*) key */
        NORMAL_TABLE,
        WIDE_TABLE,
        INDEX_TABLE, //opaque(void*) as key and dataoff, datlen is of actual value in the data file store in main table
         //data is in same index file if dupl is not allowed, else data (as dofft) is in data file in chunk of 32 with link at the end
        /* no data file for following tables */
        PRIMITIVE_TABLE_INT, //int as key and int as val, stored in index file only, no data file
        PRIMITIVE_TABLE_LONG, //long as key and long as val, stored in index file only, no data file
        PRIMITIVE_TABLE_STRING, //opaque(void*) as key and data stored in the index only, no data file - Fixed Table

        LARGE_TABLE,

        BANGDB_TABLE_INVALID
};

enum TableSubType
{
        BANGDB_SW_TABLE,
        BANGDB_TOPK_TABLE,
        NON_ANALYTICAL_TABLE,
        //SW_ENTITY_COUNT_TABLE,
        //SW_GROUPBYOP_TABLE,
        INDEXBTREE_TABLE, // this is to override the selection of idx table, right now only for non_dupl keys index_table is selected
        DUPLINDEX_TABLE_NOLOG, // this is to override the selection of idx table, right now only for dupl keys dupl_index is selected
        BANGDB_SW_INVALID,
};

enum PrimitiveDataType
{
        PRIMITIVE_INT,
        PRIMITIVE_LONG,
        PRIMITIVE_STRING,
        PRIMITIVE_INVALID,
};

enum ScanLimitBy
{
        // Adding the below LIMIT_INVALID to use it as a default parameter.
        LIMIT_INVALID = -1,
        LIMIT_RESULT_SIZE,
        LIMIT_RESULT_ROW,
};

enum ScanOperator
{
        GT,
        GTE,
        LT,
        LTE,
        EQ,
        NE
};

enum JoinOperator
{
        JO_INVALID = -1,
        JO_AND = 0,
        JO_OR = 1,
};

//currently just supporting whether data is valid or invalid
//later we can leverage this for versioning as well
enum VersionType
{
        BANGDB_DATA_VERSION_OFF, //no version (current default)
        BANGDB_DATA_VERSION_VALID_INVALID, //db will mark data as valid or invalid
        BANGDB_DATA_VERSION_ON, //this is not supported as of now
};

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

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

enum KeyType
{
        NORMAL_KEY = 1, //opaque (void*) as key
        COMPOSITE_KEY = 3, //always treated as opaque even if it is of long:void* or long:long
        NORMAL_KEY_LONG = 10, //long as key
        //COMPOSITE_KEY_LONG, //long:long as key, all keys participating in composite will be long, no hybrid keys
        KEY_TYPE_INVALID = 100,
};

Was this article helpful to you? Yes No