diff options
author | Lance Richardson <lrichard@redhat.com> | 2017-08-03 14:20:15 -0400 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-08-03 14:48:34 -0700 |
commit | 93fe026466644b6f436d99e69a31d9884d5a3506 (patch) | |
tree | 65ccac41e66d3861ec6ccdcc1e0f5f91d318ced0 /lib/ovsdb-idl-provider.h | |
parent | 6c2705cda300c63019c93c0755b16308ae7d8540 (diff) | |
download | openvswitch-93fe026466644b6f436d99e69a31d9884d5a3506.tar.gz |
ovsdb-idl: idl compound indexes implementation
This patch adds support for the creation of multicolumn indexes
in the C IDL to enable for efficient search and retrieval of database
rows by key.
Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Co-authored-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/ovsdb-idl-provider.h')
-rw-r--r-- | lib/ovsdb-idl-provider.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h index 8cfbb95aa..59fb24015 100644 --- a/lib/ovsdb-idl-provider.h +++ b/lib/ovsdb-idl-provider.h @@ -1,4 +1,5 @@ /* Copyright (c) 2009, 2010, 2011, 2012, 2016 Nicira, Inc. + * Copyright (C) 2016 Hewlett Packard Enterprise Development LP * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,6 +112,7 @@ struct ovsdb_idl_table { struct hmap rows; /* Contains "struct ovsdb_idl_row"s. */ struct ovsdb_idl *idl; /* Containing idl. */ unsigned int change_seqno[OVSDB_IDL_CHANGE_MAX]; + struct shash indexes; /* Contains "struct ovsdb_idl_index"s */ struct ovs_list track_list; /* Tracked rows (ovsdb_idl_row.track_node). */ struct ovsdb_idl_condition condition; bool cond_changed; @@ -122,6 +124,33 @@ struct ovsdb_idl_class { size_t n_tables; }; +/* + * Structure containing the per-column configuration of the index. + */ +struct ovsdb_idl_index_column { + const struct ovsdb_idl_column *column; /* Column used for index key. */ + column_comparator *comparer; /* Column comparison function. */ + int sorting_order; /* Sorting order (ascending or descending). */ +}; + +/* + * Defines a IDL compound index + */ +struct ovsdb_idl_index { + struct skiplist *skiplist; /* Skiplist with pointers to rows. */ + struct ovsdb_idl_index_column *columns; /* Columns configuration */ + size_t n_columns; /* Number of columns in index. */ + size_t alloc_columns; /* Size allocated memory for columns, + comparers and sorting order. */ + bool ins_del; /* True if a row in the index is being + inserted or deleted; if true, the + search key is augmented with the + UUID and address in order to discriminate + between entries with identical keys. */ + const struct ovsdb_idl_table *table; /* Table that owns this index */ + const char *index_name; /* The name of this index. */ +}; + struct ovsdb_idl_row *ovsdb_idl_get_row_arc( struct ovsdb_idl_row *src, const struct ovsdb_idl_table_class *dst_table, |