⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 depot.h

📁 harvest是一个下载html网页得机器人
💻 H
📖 第 1 页 / 共 2 页
字号:
int dpvsiz(DEPOT *depot, const char *kbuf, int ksiz);/* Initialize the iterator of a database handle.   `depot' specifies a database handle.   If successful, the return value is true, else, it is false.   The iterator is used in order to access the key of every record stored in a database. */int dpiterinit(DEPOT *depot);/* Get the next key of the iterator.   `depot' specifies a database handle.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.  If it is `NULL', it is not used.   If successful, the return value is the pointer to the region of the next key, else, it is   `NULL'.  `NULL' is returned when no record is to be get out of the iterator.   Because an additional zero code is appended at the end of the region of the return value,   the return value can be treated as a character string.  Because the region of the return   value is allocated with the `malloc' call, it should be released with the `free' call if   it is no longer in use.  It is possible to access every record by iteration of calling   this function.  However, it is not assured if updating the database is occurred while the   iteration.  Besides, the order of this traversal access method is arbitrary, so it is not   assured that the order of storing matches the one of the traversal access. */char *dpiternext(DEPOT *depot, int *sp);/* Set alignment of a database handle.   `depot' specifies a database handle connected as a writer.   `align' specifies the size of alignment.   If successful, the return value is true, else, it is false.   If alignment is set to a database, the efficiency of overwriting values are improved.   The size of alignment is suggested to be average size of the values of the records to be   stored.  If alignment is positive, padding whose size is multiple number of the alignment   is placed.  If alignment is negative, as `vsiz' is the size of a value, the size of padding   is calculated with `(vsiz / pow(2, abs(align) - 1))'.  Because alignment setting is not   saved in a database, you should specify alignment every opening a database. */int dpsetalign(DEPOT *depot, int align);/* Synchronize updating contents with the file and the device.   `depot' specifies a database handle connected as a writer.   If successful, the return value is true, else, it is false.   This function is useful when another process uses the connected database file. */int dpsync(DEPOT *depot);/* Optimize a database.   `depot' specifies a database handle connected as a writer.   `bnum' specifies the number of the elements of the bucket array.  If it is not more than 0,   the default value is specified.   If successful, the return value is true, else, it is false.   In an alternating succession of deleting and storing with overwrite or concatenate,   dispensable regions accumulate.  This function is useful to do away with them. */int dpoptimize(DEPOT *depot, int bnum);/* Get the name of a database.   `depot' specifies a database handle.   If successful, the return value is the pointer to the region of the name of the database,   else, it is `NULL'.   Because the region of the return value is allocated with the `malloc' call, it should be   released with the `free' call if it is no longer in use. */char *dpname(DEPOT *depot);/* Get the size of a database file.   `depot' specifies a database handle.   If successful, the return value is the size of the database file, else, it is -1. */int dpfsiz(DEPOT *depot);/* Get the number of the elements of the bucket array.   `depot' specifies a database handle.   If successful, the return value is the number of the elements of the bucket array, else, it   is -1. */int dpbnum(DEPOT *depot);/* Get the number of the used elements of the bucket array.   `depot' specifies a database handle.   If successful, the return value is the number of the used elements of the bucket array,   else, it is -1.   This function is inefficient because it accesses all elements of the bucket array. */int dpbusenum(DEPOT *depot);/* Get the number of the records stored in a database.   `depot' specifies a database handle.   If successful, the return value is the number of the records stored in the database, else,   it is -1. */int dprnum(DEPOT *depot);/* Check whether a database handle is a writer or not.   `depot' specifies a database handle.   The return value is true if the handle is a writer, false if not. */int dpwritable(DEPOT *depot);/* Check whether a database has a fatal error or not.   `depot' specifies a database handle.   The return value is true if the database has a fatal error, false if not. */int dpfatalerror(DEPOT *depot);/* Get the inode number of a database file.   `depot' specifies a database handle.   The return value is the inode number of the database file. */int dpinode(DEPOT *depot);/* Get the file descriptor of a database file.   `depot' specifies a database handle.   The return value is the file descriptor of the database file.   Handling the file descriptor of a database file directly is not suggested. */int dpfdesc(DEPOT *depot);/* Remove a database file.   `name' specifies the name of a database file.   If successful, the return value is true, else, it is false. */int dpremove(const char *name);/* Hash function used inside Depot.   `kbuf' specifies the pointer to the region of a key.   `ksiz' specifies the size of the region of the key.  If it is negative, the size is assigned   with `strlen(kbuf)'.   The return value is the hash value of 31 bits length computed from the key.   This function is useful when an application calculates the state of the inside bucket array. */int dpinnerhash(const char *kbuf, int ksiz);/* Hash function which is independent from the hash functions used inside Depot.   `kbuf' specifies the pointer to the region of a key.   `ksiz' specifies the size of the region of the key.  If it is negative, the size is assigned   with `strlen(kbuf)'.   The return value is the hash value of 31 bits length computed from the key.   This function is useful when an application uses its own hash algorithm outside Depot. */int dpouterhash(const char *kbuf, int ksiz);/* Get a natural prime number not less than a number.   `num' specified a natural number.   The return value is a natural prime number not less than the specified number.   This function is useful when an application determines the size of a bucket array of its   own hash algorithm. */int dpprimenum(int num);/************************************************************************************************* * Functions for Experts *************************************************************************************************//* Synchronize updating contents on memory.   `depot' specifies a database handle connected as a writer.   If successful, the return value is true, else, it is false. */int dpmemsync(DEPOT *depot);/* Get flags of a database.   `depot' specifies a database handle.   The return value is the flags of a database. */int dpgetflags(DEPOT *depot);/* Set flags of a database.   `depot' specifies a database handle connected as a writer.   `flags' specifies flags to set.   If successful, the return value is true, else, it is false. */int dpsetflags(DEPOT *depot, int flags);#endif                                   /* duplication check *//* END OF FILE */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -