summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-12-07 15:19:40 -0500
committerSean Bright <sean.bright@gmail.com>2017-12-10 12:51:16 -0600
commit9a9edc6c9e8307410316b30e4f5028facd13a083 (patch)
treeadfc42ee575cd847c80fb37d5bc3d22e603d476e /include
parentb0b28446c1e5f76c54b823bc3f4e2a5423c9c79b (diff)
astdb: Improve prefix searches in astdb
Using the LIKE operator requires a full table scan of 'astdb', whereas a comparison operation is able to use the primary key index. This patch adds a new function to the AstDB API for quick prefix matches and updates res_sorcery_astdb to utilize it. This showed substantial performance improvement in my test environment. Related to ASTERISK~26806, but does not completely resolve it. Change-Id: I7d37f9ba2aea139dabf2ca72d31fbe34bd9b2fa1
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/astdb.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/asterisk/astdb.h b/include/asterisk/astdb.h
index 8a870ae83..383864baf 100644
--- a/include/asterisk/astdb.h
+++ b/include/asterisk/astdb.h
@@ -83,6 +83,16 @@ int ast_db_deltree(const char *family, const char *keytree);
*/
struct ast_db_entry *ast_db_gettree(const char *family, const char *keytree);
+/*!
+ * \brief Get a list of values with the given key prefix
+ *
+ * \param family The family to search under
+ * \param key_prefix The key prefix to search under
+ *
+ * \retval NULL An error occurred
+ */
+struct ast_db_entry *ast_db_gettree_by_prefix(const char *family, const char *key_prefix);
+
/*! \brief Free structure created by ast_db_gettree() */
void ast_db_freetree(struct ast_db_entry *entry);