From: imeevma@tarantool.org To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v3 1/5] sysview: make get() and create_iterator() methods virtual Date: Thu, 7 Nov 2019 13:36:19 +0300 [thread overview] Message-ID: <ab54085a2bdf0596be46f556f9757773d5d049a3.1573121685.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1573121685.git.imeevma@gmail.com> This patch makes get() and create_iterator() virtual for sysview index. This will allow us to create custom version of these functions. Needed for #4511 --- src/box/sysview.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/box/sysview.c b/src/box/sysview.c index 00c320b..745cf09 100644 --- a/src/box/sysview.c +++ b/src/box/sysview.c @@ -49,6 +49,12 @@ #include "session.h" typedef bool (*sysview_filter_f)(struct space *, struct tuple *); +typedef int (*sysview_get_f)(struct index *index, const char *key, + uint32_t part_count, struct tuple **result); +typedef struct iterator *(*sysview_create_iterator_f)(struct index *index, + enum iterator_type type, + const char *key, + uint32_t part_count); struct sysview_engine { struct engine base; @@ -61,6 +67,8 @@ struct sysview_index { uint32_t source_space_id; uint32_t source_index_id; sysview_filter_f filter; + sysview_get_f get; + sysview_create_iterator_f create_iterator; }; struct sysview_iterator { @@ -140,7 +148,7 @@ sysview_index_create_iterator(struct index *base, enum iterator_type type, it->base.next = sysview_iterator_next; it->base.free = sysview_iterator_free; - it->source = index_create_iterator(pk, type, key, part_count); + it->source = index->create_iterator(pk, type, key, part_count); if (it->source == NULL) { mempool_free(&sysview->iterator_pool, it); return NULL; @@ -167,7 +175,7 @@ sysview_index_get(struct index *base, const char *key, if (exact_key_validate(pk->def->key_def, key, part_count) != 0) return -1; struct tuple *tuple; - if (index_get(pk, key, part_count, &tuple) != 0) + if (index->get(pk, key, part_count, &tuple) != 0) return -1; if (tuple == NULL || !index->filter(source, tuple)) *result = NULL; @@ -424,42 +432,58 @@ sysview_space_create_index(struct space *space, struct index_def *def) uint32_t source_space_id; uint32_t source_index_id; sysview_filter_f filter; + sysview_get_f get; + sysview_create_iterator_f create_iterator; switch (def->space_id) { case BOX_VSPACE_ID: source_space_id = BOX_SPACE_ID; source_index_id = def->iid; filter = vspace_filter; + get = index_get; + create_iterator = index_create_iterator; break; case BOX_VINDEX_ID: source_space_id = BOX_INDEX_ID; source_index_id = def->iid; filter = vspace_filter; + get = index_get; + create_iterator = index_create_iterator; break; case BOX_VUSER_ID: source_space_id = BOX_USER_ID; source_index_id = def->iid; filter = vuser_filter; + get = index_get; + create_iterator = index_create_iterator; break; case BOX_VFUNC_ID: source_space_id = BOX_FUNC_ID; source_index_id = def->iid; filter = vfunc_filter; + get = index_get; + create_iterator = index_create_iterator; break; case BOX_VPRIV_ID: source_space_id = BOX_PRIV_ID; source_index_id = def->iid; filter = vpriv_filter; + get = index_get; + create_iterator = index_create_iterator; break; case BOX_VSEQUENCE_ID: source_space_id = BOX_SEQUENCE_ID; source_index_id = def->iid; filter = vsequence_filter; + get = index_get; + create_iterator = index_create_iterator; break; case BOX_VCOLLATION_ID: source_space_id = BOX_COLLATION_ID; source_index_id = def->iid; filter = vcollation_filter; + get = index_get; + create_iterator = index_create_iterator; break; default: diag_set(ClientError, ER_MODIFY_INDEX, @@ -484,6 +508,8 @@ sysview_space_create_index(struct space *space, struct index_def *def) index->source_space_id = source_space_id; index->source_index_id = source_index_id; index->filter = filter; + index->get = get; + index->create_iterator = create_iterator; return &index->base; } -- 2.7.4
next prev parent reply other threads:[~2019-11-07 10:36 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-11-07 10:36 [Tarantool-patches] [PATCH v3 0/5] Replace control pragmas by SET imeevma 2019-11-07 10:36 ` imeevma [this message] 2019-11-07 10:36 ` [Tarantool-patches] [PATCH v3 2/5] box: introdice _vsession_settings sysview imeevma 2019-11-07 10:36 ` [Tarantool-patches] [PATCH v3 3/5] sql: introduce SET statement imeevma 2019-11-07 12:40 ` Vladislav Shpilevoy 2019-11-07 14:12 ` Mergen Imeev 2019-11-11 21:56 ` Vladislav Shpilevoy 2019-11-15 14:06 ` Mergen Imeev 2019-11-17 17:26 ` Vladislav Shpilevoy 2019-11-17 20:32 ` Vladislav Shpilevoy 2019-11-27 10:33 ` Mergen Imeev 2019-11-27 23:03 ` Vladislav Shpilevoy 2019-11-27 23:07 ` Vladislav Shpilevoy 2019-11-27 23:09 ` Vladislav Shpilevoy 2019-11-28 8:59 ` Mergen Imeev 2019-11-28 8:56 ` Mergen Imeev 2019-11-07 10:36 ` [Tarantool-patches] [PATCH v3 4/5] temporary: disable boolean.test.sql imeevma 2019-11-07 10:37 ` [Tarantool-patches] [PATCH v3 5/5] sql: replace control pragmas imeevma 2019-12-06 11:37 ` [Tarantool-patches] [PATCH v3 0/5] Replace control pragmas by SET Kirill Yukhin 2019-12-06 13:50 ` Mergen Imeev 2019-12-06 14:06 ` Sergey Ostanevich 2019-12-17 22:11 ` Alexander Turenko 2019-12-18 2:39 ` Peter Gulutzan 2019-12-18 17:39 ` Peter Gulutzan 2019-12-19 9:59 ` Mergen Imeev 2019-12-19 17:35 ` Peter Gulutzan 2019-12-19 17:51 ` Mergen Imeev 2019-12-19 21:09 ` Vladislav Shpilevoy 2019-12-18 10:20 ` Kirill Yukhin 2019-12-18 10:53 ` Alexander Turenko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=ab54085a2bdf0596be46f556f9757773d5d049a3.1573121685.git.imeevma@gmail.com \ --to=imeevma@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v3 1/5] sysview: make get() and create_iterator() methods virtual' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox