Files
scylladb/redis/options.hh
Kefu Chai 15bfa09454 treewide: do not mark return value const if this has no effect
this change is a cleanup.

to mark a return value without value semantics has no effect. these
`const` specifier useless. so let's drop them.

and, if we compile the tree with `-Wignore-qualifiers`, the compiler
would warn like:

```
/home/kefu/dev/scylladb/schema/schema.hh:245:5: error: 'const' type qualifier on return type has no effect [-Werror,-Wignored-qualifiers]
  245 |     const index_metadata_kind kind() const;
      |     ^~~~~
```
so this change also silences the above warnings.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-11-17 17:46:19 +08:00

79 lines
2.6 KiB
C++

/*
* Copyright (C) 2019 pengjian.uestc @ gmail.com
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include <stdexcept>
#include "timeout_config.hh"
#include "db/consistency_level_type.hh"
#include <seastar/core/sstring.hh>
#include <seastar/net/socket_defs.hh>
#include "schema/schema_fwd.hh"
#include "service/client_state.hh"
#include "auth/service.hh"
namespace service {
class storage_proxy;
}
namespace redis {
class redis_options {
sstring _ks_name;
const db::consistency_level _read_consistency;
const db::consistency_level _write_consistency;
const updateable_timeout_config& _timeout_config;
service::client_state _client_state;
size_t _total_redis_db_count;
public:
explicit redis_options(const db::consistency_level rcl,
const db::consistency_level wcl,
const updateable_timeout_config& tc,
auth::service& auth,
const socket_address addr,
size_t total_redis_db_count)
:_ks_name("REDIS_0")
,_read_consistency(rcl)
,_write_consistency(wcl)
,_timeout_config(tc)
,_client_state(service::client_state::external_tag{}, auth, nullptr, tc.current_values(), addr)
,_total_redis_db_count(total_redis_db_count)
{
}
explicit redis_options(const sstring& ks_name,
const db::consistency_level rcl,
const db::consistency_level wcl,
const updateable_timeout_config& tc,
auth::service& auth,
const socket_address addr,
size_t total_redis_db_count)
:_ks_name(ks_name)
,_read_consistency(rcl)
,_write_consistency(wcl)
,_timeout_config(tc)
,_client_state(service::client_state::external_tag{}, auth, nullptr, tc.current_values(), addr)
,_total_redis_db_count(total_redis_db_count)
{
}
db::consistency_level get_read_consistency_level() const { return _read_consistency; }
db::consistency_level get_write_consistency_level() const { return _write_consistency; }
const db::timeout_clock::duration get_read_timeout() const { return std::chrono::milliseconds(_timeout_config.read_timeout_in_ms); }
const db::timeout_clock::duration get_write_timeout() const { return std::chrono::milliseconds(_timeout_config.write_timeout_in_ms); }
const sstring& get_keyspace_name() const { return _ks_name; }
service::client_state& get_client_state() { return _client_state; }
void set_keyspace_name(const sstring ks_name) { _ks_name = ks_name; }
size_t get_total_redis_db_count() const { return _total_redis_db_count; }
};
schema_ptr get_schema(service::storage_proxy& proxy, const sstring& ks_name, const sstring& cf_name);
}