?? tcbdb.h
字號(hào):
/************************************************************************************************* * features for experts *************************************************************************************************//* Set the error code of a B+ tree database object. `bdb' specifies the B+ tree database object. `ecode' specifies the error code. `file' specifies the file name of the code. `line' specifies the line number of the code. `func' specifies the function name of the code. */void tcbdbsetecode(TCBDB *bdb, int ecode, const char *filename, int line, const char *func);/* Set the file descriptor for debugging output. `bdb' specifies the B+ tree database object. `fd' specifies the file descriptor for debugging output. */void tcbdbsetdbgfd(TCBDB *bdb, int fd);/* Get the file descriptor for debugging output. `bdb' specifies the B+ tree database object. The return value is the file descriptor for debugging output. */int tcbdbdbgfd(TCBDB *bdb);/* Check whether mutual exclusion control is set to a B+ tree database object. `bdb' specifies the B+ tree database object. If mutual exclusion control is set, it is true, else it is false. */bool tcbdbhasmutex(TCBDB *bdb);/* Synchronize updating contents on memory of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `phys' specifies whether to synchronize physically. If successful, the return value is true, else, it is false. */bool tcbdbmemsync(TCBDB *bdb, bool phys);/* Clear the cache of a B+ tree database object. `bdb' specifies the B+ tree database object. If successful, the return value is true, else, it is false. */bool tcbdbcacheclear(TCBDB *bdb);/* Get the comparison function of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the pointer to the comparison function. */TCCMP tcbdbcmpfunc(TCBDB *bdb);/* Get the opaque object for the comparison function of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the opaque object for the comparison function. */void *tcbdbcmpop(TCBDB *bdb);/* Get the maximum number of cached leaf nodes of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the maximum number of cached leaf nodes. */uint32_t tcbdblmemb(TCBDB *bdb);/* Get the maximum number of cached non-leaf nodes of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the maximum number of cached non-leaf nodes. */uint32_t tcbdbnmemb(TCBDB *bdb);/* Get the number of the leaf nodes of B+ tree database object. `bdb' specifies the B+ tree database object. If successful, the return value is the number of the leaf nodes or 0 if the object does not connect to any database file. */uint64_t tcbdblnum(TCBDB *bdb);/* Get the number of the non-leaf nodes of B+ tree database object. `bdb' specifies the B+ tree database object. If successful, the return value is the number of the non-leaf nodes or 0 if the object does not connect to any database file. */uint64_t tcbdbnnum(TCBDB *bdb);/* Get the number of elements of the bucket array of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the number of elements of the bucket array or 0 if the object does not connect to any database file. */uint64_t tcbdbbnum(TCBDB *bdb);/* Get the record alignment of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the record alignment or 0 if the object does not connect to any database file. */uint32_t tcbdbalign(TCBDB *bdb);/* Get the maximum number of the free block pool of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the maximum number of the free block pool or 0 if the object does not connect to any database file. */uint32_t tcbdbfbpmax(TCBDB *bdb);/* Get the inode number of the database file of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the inode number of the database file or 0 if the object does not connect to any database file. */uint64_t tcbdbinode(TCBDB *bdb);/* Get the modification time of the database file of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the inode number of the database file or 0 if the object does not connect to any database file. */time_t tcbdbmtime(TCBDB *bdb);/* Get the additional flags of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the additional flags. */uint8_t tcbdbflags(TCBDB *bdb);/* Get the options of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the options. */uint8_t tcbdbopts(TCBDB *bdb);/* Get the pointer to the opaque field of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the pointer to the opaque field whose size is 128 bytes. */char *tcbdbopaque(TCBDB *bdb);/* Get the number of used elements of the bucket array of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the number of used elements of the bucket array or 0 if the object does not connect to any database file. */uint64_t tcbdbbnumused(TCBDB *bdb);/* Set the maximum size of each leaf node. `bdb' specifies the B+ tree database object which is not opened. `lsmax' specifies the maximum size of each leaf node. If it is not more than 0, the default value is specified. The default value is 16386. If successful, the return value is true, else, it is false. Note that the tuning parameters of the database should be set before the database is opened. */bool tcbdbsetlsmax(TCBDB *bdb, uint32_t lsmax);/* Set the capacity number of records. `bdb' specifies the B+ tree database object which is not opened. `capnum' specifies the capacity number of records. If it is not more than 0, the capacity is unlimited. If successful, the return value is true, else, it is false. When the number of records exceeds the capacity, forehand records are removed implicitly. Note that the tuning parameters of the database should be set before the database is opened. */bool tcbdbsetcapnum(TCBDB *bdb, uint64_t capnum);/* Set the custom codec functions of a B+ tree database object. `bdb' specifies the B+ tree database object. `enc' specifies the pointer to the custom encoding function. It receives four parameters. The first parameter is the pointer to the region. The second parameter is the size of the region. The third parameter is the pointer to the variable into which the size of the region of the return value is assigned. The fourth parameter is the pointer to the optional opaque object. It returns the pointer to the result object allocated with `malloc' call if successful, else, it returns `NULL'. `encop' specifies an arbitrary pointer to be given as a parameter of the encoding function. If it is not needed, `NULL' can be specified. `dec' specifies the pointer to the custom decoding function. `decop' specifies an arbitrary pointer to be given as a parameter of the decoding function. If it is not needed, `NULL' can be specified. If successful, the return value is true, else, it is false. Note that the custom codec functions should be set before the database is opened and should be set every time the database is being opened. */bool tcbdbsetcodecfunc(TCBDB *bdb, TCCODEC enc, void *encop, TCCODEC dec, void *decop);/* Store a new record into a B+ tree database object with backward duplication. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `vbuf' specifies the pointer to the region of the value. `vsiz' specifies the size of the region of the value. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, the new record is placed after the existing one. */bool tcbdbputdupback(TCBDB *bdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);/* Store a new string record into a B+ tree database object with backward duplication. `bdb' specifies the B+ tree database object connected as a writer. `kstr' specifies the string of the key. `vstr' specifies the string of the value. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, the new record is placed after the existing one. */bool tcbdbputdupback2(TCBDB *bdb, const char *kstr, const char *vstr);/* Store a record into a B+ tree database object with a duplication handler. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `vbuf' specifies the pointer to the region of the value. `NULL' means that record addition is ommited if there is no corresponding record. `vsiz' specifies the size of the region of the value. `proc' specifies the pointer to the callback function to process duplication. It receives four parameters. The first parameter is the pointer to the region of the value. The second parameter is the size of the region of the value. The third parameter is the pointer to the variable into which the size of the region of the return value is assigned. The fourth parameter is the pointer to the optional opaque object. It returns the pointer to the result object allocated with `malloc'. It is released by the caller. If it is `NULL', the record is not modified. If it is `(void *)-1', the record is removed. `op' specifies an arbitrary pointer to be given as a parameter of the callback function. If it is not needed, `NULL' can be specified. If successful, the return value is true, else, it is false. */bool tcbdbputproc(TCBDB *bdb, const void *kbuf, int ksiz, const char *vbuf, int vsiz, TCPDPROC proc, void *op);/* Move a cursor object to the rear of records corresponding a key. `cur' specifies the cursor object. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. If successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition. The cursor is set to the last record corresponding the key or the previous substitute if completely matching record does not exist. */bool tcbdbcurjumpback(BDBCUR *cur, const void *kbuf, int ksiz);/* Move a cursor object to the rear of records corresponding a key string. `cur' specifies the cursor object. `kstr' specifies the string of the key. If successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition. The cursor is set to the last record corresponding the key or the previous substitute if completely matching record does not exist. */bool tcbdbcurjumpback2(BDBCUR *cur, const char *kstr);/* Process each record atomically of a B+ tree database object. `bdb' specifies the B+ tree database object. `iter' specifies the pointer to the iterator function called for each record. It receives five parameters. The first parameter is the pointer to the region of the key. The second parameter is the size of the region of the key. The third parameter is the pointer to the region of the value. The fourth parameter is the size of the region of the value. The fifth parameter is the pointer to the optional opaque object. It returns true to continue iteration or false to stop iteration. `op' specifies an arbitrary pointer to be given as a parameter of the iterator function. If it is not needed, `NULL' can be specified. If successful, the return value is true, else, it is false. */bool tcbdbforeach(TCBDB *bdb, TCITER iter, void *op);__TCBDB_CLINKAGEEND#endif /* duplication check *//* END OF FILE */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -