Experimental optimized XPath, multiple keys
This commit is contained in:
parent
7fb452f96e
commit
b340c36f79
17 changed files with 681 additions and 279 deletions
|
|
@ -85,6 +85,7 @@
|
|||
#include <clixon/clixon_xml_map.h>
|
||||
#include <clixon/clixon_datastore.h>
|
||||
#include <clixon/clixon_xpath_ctx.h>
|
||||
#include <clixon/clixon_xpath_optimize.h>
|
||||
#include <clixon/clixon_xpath.h>
|
||||
#include <clixon/clixon_json.h>
|
||||
#include <clixon/clixon_nacm.h>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,6 @@ int xml_sort(cxobj *x0, void *arg);
|
|||
int xml_insert(cxobj *xp, cxobj *xc, enum insert_type ins, char *key_val, cvec *nsckey);
|
||||
int xml_sort_verify(cxobj *x, void *arg);
|
||||
int match_base_child(cxobj *x0, cxobj *x1c, yang_stmt *yc, cxobj **x0cp);
|
||||
int xml_binsearch(cxobj *xp, char *name, char *keyname, char *keyval, cxobj **xret);
|
||||
int xml_binsearch(cxobj *xp, yang_stmt *yc, cvec *cvk, cxobj **xretp);
|
||||
|
||||
#endif /* _CLIXON_XML_SORT_H */
|
||||
|
|
|
|||
|
|
@ -107,13 +107,14 @@ enum xp_type{
|
|||
*/
|
||||
struct xpath_tree{
|
||||
enum xp_type xs_type;
|
||||
int xs_int; /* step-> axis_type */
|
||||
double xs_double;
|
||||
char *xs_strnr; /* original string xs_double: numeric value */
|
||||
char *xs_s0;
|
||||
char *xs_s1;
|
||||
struct xpath_tree *xs_c0; /* child 0 */
|
||||
struct xpath_tree *xs_c1; /* child 1 */
|
||||
int xs_int; /* step-> axis_type */
|
||||
double xs_double; /* set if XP_PRIME_NR */
|
||||
char *xs_strnr; /* original string xs_double: numeric value */
|
||||
char *xs_s0; /* set if XP_PRIME_STR, XP_PRIME_FN, XP_NODE[_FN] prefix*/
|
||||
char *xs_s1; /* set if XP_NODE NAME */
|
||||
struct xpath_tree *xs_c0; /* child 0 */
|
||||
struct xpath_tree *xs_c1; /* child 1 */
|
||||
int xs_match; /* meta: match this node */
|
||||
};
|
||||
typedef struct xpath_tree xpath_tree;
|
||||
|
||||
|
|
@ -125,7 +126,8 @@ char* xpath_tree_int2str(int nodetype);
|
|||
int xpath_tree_print_cb(cbuf *cb, xpath_tree *xs);
|
||||
int xpath_tree_print(FILE *f, xpath_tree *xs);
|
||||
int xpath_tree2cbuf(xpath_tree *xs, cbuf *xpathcb);
|
||||
int xpath_tree_eq(xpath_tree *xt1, xpath_tree *xt2, cvec *match);
|
||||
int xpath_tree_eq(xpath_tree *xt1, xpath_tree *xt2, xpath_tree ***vec, size_t *len);
|
||||
xpath_tree *xpath_tree_traverse(xpath_tree *xt, ...);
|
||||
int xpath_tree_free(xpath_tree *xs);
|
||||
int xpath_parse(char *xpath, xpath_tree **xptree);
|
||||
int xpath_vec_ctx(cxobj *xcur, cvec *nsc, char *xpath, int localonly, xp_ctx **xrp);
|
||||
|
|
|
|||
46
lib/clixon/clixon_xpath_optimize.h
Normal file
46
lib/clixon/clixon_xpath_optimize.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright (C) 2009-2019 Olof Hagsand
|
||||
|
||||
This file is part of CLIXON.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
the GNU General Public License Version 3 or later (the "GPL"),
|
||||
in which case the provisions of the GPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of the GPL, and not to allow others to
|
||||
use your version of this file under the terms of Apache License version 2,
|
||||
indicate your decision by deleting the provisions above and replace them with
|
||||
the notice and other provisions required by the GPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the Apache License version 2 or the GPL.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
|
||||
* Clixon XML XPATH 1.0 according to https://www.w3.org/TR/xpath-10
|
||||
* See XPATH_LIST_OPTIMIZE
|
||||
*/
|
||||
#ifndef _CLIXON_XPATH_OPTIMIZE_H
|
||||
#define _CLIXON_XPATH_OPTIMIZE_H
|
||||
|
||||
|
||||
int xpath_list_optimize_stats(int *hits);
|
||||
int xpath_list_optimize_set(int enable);
|
||||
void xpath_optimize_exit(void);
|
||||
int xpath_optimize_check();
|
||||
|
||||
#endif /* _CLIXON_XPATH_OPTIMIZE_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue