Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"en-US,en;q\u003d0.5", "gen_ut":1603226233, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"b168745d464f42de54f15f01b1722251", "oid":{ "oid": "ed1e558eedc79a07837db2f0a41eb94197ad23fa", "alias": [ "refs/heads/master"]},"blobname": "include/libwebsockets/lws-fts.h", "blob": "/*\n * libwebsockets - small server side websockets and web server implementation\n *\n * Copyright (C) 2010 - 2019 Andy Green \u003candy@warmcat.com\u003e\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \u0022Software\u0022), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \u0022AS IS\u0022, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\n/** \u005cdefgroup search Search\n *\n * ##Full-text search\n *\n * Lws provides superfast indexing and fulltext searching from index files on\n * storage.\n */\n///@{\n\nstruct lws_fts;\nstruct lws_fts_file;\n\n/*\n * Queries produce their results in an lwsac, using these public API types.\n * The first thing in the lwsac is always a struct lws_fts_result (see below)\n * containing heads for linked-lists of the other result types.\n */\n\n/* one filepath's results */\n\nstruct lws_fts_result_filepath {\n\tstruct lws_fts_result_filepath *next;\n\tint matches;\t/* logical number of matches */\n\tint matches_length;\t/* bytes in length table (may be zero) */\n\tint lines_in_file;\n\tint filepath_length;\n\n\t/* - uint32_t line table follows (first for alignment) */\n\t/* - filepath (of filepath_length) follows */\n};\n\n/* autocomplete result */\n\nstruct lws_fts_result_autocomplete {\n\tstruct lws_fts_result_autocomplete *next;\n\tint instances;\n\tint agg_instances;\n\tint ac_length;\n\tchar elided; /* children skipped in interest of antecedent children */\n\tchar has_children;\n\n\t/* - autocomplete suggestion (of length ac_length) follows */\n};\n\n/*\n * The results lwsac always starts with this. If no results and / or no\n * autocomplete the members may be NULL. This implies the symbol nor any\n * suffix on it exists in the trie file.\n */\nstruct lws_fts_result {\n\tstruct lws_fts_result_filepath *filepath_head;\n\tstruct lws_fts_result_autocomplete *autocomplete_head;\n\tint duration_ms;\n\tint effective_flags; /* the search flags that were used */\n};\n\n/*\n * index creation functions\n */\n\n/**\n * lws_fts_create() - Create a new index file\n *\n * \u005cparam fd: The fd opened for write\n *\n * Inits a new index file, returning a struct lws_fts to represent it\n */\nLWS_VISIBLE LWS_EXTERN struct lws_fts *\nlws_fts_create(int fd);\n\n/**\n * lws_fts_destroy() - Finalize a new index file / destroy the trie lwsac\n *\n * \u005cparam trie: The previously opened index being finalized\n *\n * Finalizes an index file that was being created, and frees the memory involved\n * *trie is set to NULL afterwards.\n */\nLWS_VISIBLE LWS_EXTERN void\nlws_fts_destroy(struct lws_fts **trie);\n\n/**\n * lws_fts_file_index() - Create a new entry in the trie file for an input path\n *\n * \u005cparam t: The previously opened index being written\n * \u005cparam filepath: The filepath (which may be virtual) associated with this file\n * \u005cparam filepath_len: The number of chars in the filepath\n * \u005cparam priority: not used yet\n *\n * Returns an ordinal that represents this new filepath in the index file.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_fts_file_index(struct lws_fts *t, const char *filepath, int filepath_len,\n\t\t int priority);\n\n/**\n * lws_fts_fill() - Process all or a bufferload of input file\n *\n * \u005cparam t: The previously opened index being written\n * \u005cparam file_index: The ordinal representing this input filepath\n * \u005cparam buf: A bufferload of data from the input file\n * \u005cparam len: The number of bytes in buf\n *\n * Indexes a buffer of data from the input file.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_fts_fill(struct lws_fts *t, uint32_t file_index, const char *buf,\n\t size_t len);\n\n/**\n * lws_fts_serialize() - Store the in-memory trie into the index file\n *\n * \u005cparam t: The previously opened index being written\n *\n * The trie is held in memory where it can be added to... after all the input\n * filepaths and data have been processed, this is called to serialize /\n * write the trie data into the index file.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_fts_serialize(struct lws_fts *t);\n\n/*\n * index search functions\n */\n\n/**\n * lws_fts_open() - Open an existing index file to search it\n *\n * \u005cparam filepath: The filepath to the index file to open\n *\n * Opening the index file returns an opaque struct lws_fts_file * that is\n * used to perform other operations on it, or NULL if it can't be opened.\n */\nLWS_VISIBLE LWS_EXTERN struct lws_fts_file *\nlws_fts_open(const char *filepath);\n\n#define LWSFTS_F_QUERY_AUTOCOMPLETE\t(1 \u003c\u003c 0)\n#define LWSFTS_F_QUERY_FILES\t\t(1 \u003c\u003c 1)\n#define LWSFTS_F_QUERY_FILE_LINES\t(1 \u003c\u003c 2)\n#define LWSFTS_F_QUERY_QUOTE_LINE\t(1 \u003c\u003c 3)\n\nstruct lws_fts_search_params {\n\t/* the actual search term */\n\tconst char *needle;\n\t /* if non-NULL, FILE results for this filepath only */\n\tconst char *only_filepath;\n\t/* will be set to the results lwsac */\n\tstruct lwsac *results_head;\n\t/* combination of LWSFTS_F_QUERY_* flags */\n\tint flags;\n\t/* maximum number of autocomplete suggestions to return */\n\tint max_autocomplete;\n\t/* maximum number of filepaths to return */\n\tint max_files;\n\t/* maximum number of line number results to return per filepath */\n\tint max_lines;\n};\n\n/**\n * lws_fts_search() - Perform a search operation on an index\n *\n * \u005cparam jtf: The index file struct returned by lws_fts_open\n * \u005cparam ftsp: The struct lws_fts_search_params filled in by the caller\n *\n * The caller should memset the ftsp struct to 0 to ensure members that may be\n * introduced in later versions contain known values, then set the related\n * members to describe the kind of search action required.\n *\n * ftsp-\u003eresults_head is the results lwsac, or NULL. It should be freed with\n * lwsac_free() when the results are finished with.\n *\n * Returns a pointer into the results lwsac that is a struct lws_fts_result\n * containing the head pointers into linked-lists of results for autocomplete\n * and filepath data, along with some sundry information. This does not need\n * to be freed since freeing the lwsac will also remove this and everything it\n * points to.\n */\nLWS_VISIBLE LWS_EXTERN struct lws_fts_result *\nlws_fts_search(struct lws_fts_file *jtf, struct lws_fts_search_params *ftsp);\n\n/**\n * lws_fts_close() - Close a previously-opened index file\n *\n * \u005cparam jtf: The pointer returned from the open\n *\n * Closes the file handle on the index and frees any allocations\n */\nLWS_VISIBLE LWS_EXTERN void\nlws_fts_close(struct lws_fts_file *jtf);\n\n///@}\n","s":{"c":1603226233,"u": 527}} ],"g": 2530,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 1, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}