From 1ee7413b6e83e1ecc555c9cf028eff05e1767be4 Mon Sep 17 00:00:00 2001 From: Duarte Nunes Date: Thu, 30 Nov 2017 00:10:26 +0000 Subject: [PATCH] storage_proxy: Extract decision about digest algorithm to use Introduce the digest_algorithm() function, which encapsulates the decision of which digest algorithm to use. Right now it is set to MD5, but future patches will change this. Signed-off-by: Duarte Nunes --- service/storage_proxy.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 1b0bf673f9..073b5f67a7 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -2456,6 +2456,10 @@ public: } }; +query::digest_algorithm digest_algorithm() { + return query::digest_algorithm::MD5; +} + class abstract_read_executor : public enable_shared_from_this { protected: using targets_iterator = std::vector::iterator; @@ -2504,7 +2508,7 @@ protected: future>, cache_temperature> make_data_request(gms::inet_address ep, clock_type::time_point timeout, bool want_digest) { ++_proxy->_stats.data_read_attempts.get_ep_stat(ep); auto opts = want_digest - ? query::result_options{query::result_request::result_and_digest, query::digest_algorithm::MD5} + ? query::result_options{query::result_request::result_and_digest, digest_algorithm()} : query::result_options{query::result_request::only_result, query::digest_algorithm::none}; if (fbu::is_me(ep)) { tracing::trace(_trace_state, "read_data: querying locally"); @@ -2907,7 +2911,7 @@ db::read_repair_decision storage_proxy::new_read_repair_decision(const schema& s future storage_proxy::query_result_local_digest(schema_ptr s, lw_shared_ptr cmd, const dht::partition_range& pr, tracing::trace_state_ptr trace_state, storage_proxy::clock_type::time_point timeout, uint64_t max_size) { - return query_result_local(std::move(s), std::move(cmd), pr, query::result_options::only_digest(query::digest_algorithm::MD5), std::move(trace_state), timeout, max_size).then([] (foreign_ptr> result, cache_temperature hit_rate) { + return query_result_local(std::move(s), std::move(cmd), pr, query::result_options::only_digest(digest_algorithm()), std::move(trace_state), timeout, max_size).then([] (foreign_ptr> result, cache_temperature hit_rate) { return make_ready_future(*result->digest(), result->last_modified(), hit_rate); }); }