Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 1/6] vclock: allow to use const vclock as search key
Date: Sun, 25 Nov 2018 16:48:08 +0300	[thread overview]
Message-ID: <d26302a527d4223cf4b3e3916015f76b2e82952e.1543152574.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1543152574.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1543152574.git.vdavydov.dev@gmail.com>

vclockset_psearch() and friends never modify the vclock used as a search
key, but the compiler will not allow to pass const struct vclock to any
of those functions. Fix this.
---
 src/box/vclock.c | 4 +++-
 src/box/vclock.h | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/box/vclock.c b/src/box/vclock.c
index b5eb2800..3c4b3204 100644
--- a/src/box/vclock.c
+++ b/src/box/vclock.c
@@ -206,4 +206,6 @@ vclockset_node_compare(const struct vclock *a, const struct vclock *b)
 	return res;
 }
 
-rb_gen(, vclockset_, vclockset_t, struct vclock, link, vclockset_node_compare);
+rb_gen_ext_key(, vclockset_, vclockset_t, struct vclock, link,
+	       vclockset_node_compare, const struct vclock *,
+	       vclockset_node_compare);
diff --git a/src/box/vclock.h b/src/box/vclock.h
index 111e2916..d90f5697 100644
--- a/src/box/vclock.h
+++ b/src/box/vclock.h
@@ -271,7 +271,8 @@ vclock_compare(const struct vclock *a, const struct vclock *b)
  * @brief vclockset - a set of vclocks
  */
 typedef rb_tree(struct vclock) vclockset_t;
-rb_proto(, vclockset_, vclockset_t, struct vclock);
+rb_proto_ext_key(, vclockset_, vclockset_t, struct vclock,
+		 const struct vclock *);
 
 /**
  * A proximity search in a set of vclock objects.
@@ -283,7 +284,7 @@ rb_proto(, vclockset_, vclockset_t, struct vclock);
  * @return a vclock that <= than \a key
  */
 static inline struct vclock *
-vclockset_match(vclockset_t *set, struct vclock *key)
+vclockset_match(vclockset_t *set, const struct vclock *key)
 {
 	struct vclock *match = vclockset_psearch(set, key);
 	/**
-- 
2.11.0

  reply	other threads:[~2018-11-25 13:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25 13:48 [PATCH 0/6] WAL garbage collection and checkpointing fixes Vladimir Davydov
2018-11-25 13:48 ` Vladimir Davydov [this message]
2018-11-26 17:38   ` [PATCH 1/6] vclock: allow to use const vclock as search key Konstantin Osipov
2018-11-27  9:56     ` Vladimir Davydov
2018-11-25 13:48 ` [PATCH 2/6] engine: pass vclock instead of lsn to collect_garbage callback Vladimir Davydov
2018-11-26 17:41   ` Konstantin Osipov
2018-11-27  9:56     ` Vladimir Davydov
2018-11-25 13:48 ` [PATCH 3/6] box: do not rotate WAL when replica subscribes Vladimir Davydov
2018-11-26 17:50   ` Konstantin Osipov
2018-11-27  9:57     ` Vladimir Davydov
2018-11-25 13:48 ` [PATCH 4/6] box: use replicaset.vclock in replica join/subscribe Vladimir Davydov
2018-11-26 17:54   ` Konstantin Osipov
2018-11-27  9:57     ` Vladimir Davydov
2018-11-25 13:48 ` [PATCH 5/6] wal: separate checkpoint and flush paths Vladimir Davydov
2018-11-26 17:58   ` Konstantin Osipov
2018-11-26 20:19     ` Vladimir Davydov
2018-11-28 16:46       ` Konstantin Osipov
2018-11-25 13:48 ` [PATCH 6/6] wal: remove files needed for recovery from backup checkpoints on ENOSPC Vladimir Davydov
2018-11-28 16:14   ` Vladimir Davydov

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=d26302a527d4223cf4b3e3916015f76b2e82952e.1543152574.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 1/6] vclock: allow to use const vclock as search key' \
    /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