From 63c8f42a3d7a1393133ed63fc12e88302f20f459 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja.osipov@gmail.com> Date: Tue, 20 Sep 2011 22:00:02 +0400 Subject: [PATCH] Add comments to index.h --- mod/box/index.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mod/box/index.h b/mod/box/index.h index 3478c09a4b..d61870453e 100644 --- a/mod/box/index.h +++ b/mod/box/index.h @@ -79,10 +79,10 @@ struct index { bool unique; size_t (*size)(struct index *index); - struct box_tuple *(*find) (struct index * index, void *key); /* only for unique lookups */ + struct box_tuple *(*find) (struct index *index, void *key); /* only for unique lookups */ struct box_tuple *(*find_by_tuple) (struct index * index, struct box_tuple * pattern); - void (*remove) (struct index * index, struct box_tuple *); - void (*replace) (struct index * index, struct box_tuple *, struct box_tuple *); + void (*remove) (struct index *index, struct box_tuple *); + void (*replace) (struct index *index, struct box_tuple *, struct box_tuple *); void (*iterator_init) (struct index *, int cardinality, void *key); struct box_tuple *(*iterator_next) (struct index *); struct box_tuple *(*iterator_next_nocompare) (struct index *); @@ -102,12 +102,24 @@ struct index { struct space *space; + /* Description of parts of a multipart index. */ struct { u32 fieldno; enum field_data_type type; } *key_field; + /* + * An array holding field positions in key_field array. + * Imagine there is index[1] = { key_field[0].fieldno=5, + * key_field[1].fieldno=3 }. + * key_field array will contain data from key_field[0] and + * key_field[1] respectively. field_cmp_order_cnt will be 5, + * and field_cmp_order array will hold offsets of + * field 3 and 5 in key_field array: -1, -1, 0, -1, 1. + */ u32 *field_cmp_order; + /* max fieldno in key_field array + 1 */ u32 field_cmp_order_cnt; + /* Size of key_field array */ u32 key_cardinality; /* relative offset of the index in the namespace */ u32 n; -- GitLab