Files
scylladb/redis/options.hh
Avi Kivity 582802825a treewide: use system-#include (angle brackets) for seastar
Seastar is an external library from Scylla's point of view so
we should use the angle bracket #include style. Most of the source
follows this, this patch fixes a few stragglers.

Also fix cases of #include which reached out to seastar's directory
tree directly, via #include "seastar/include/sesatar/..." to
just refer to <seastar/...>.

Closes #10433
2022-04-26 14:46:42 +03:00

80 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_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 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 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, 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 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, addr)
,_total_redis_db_count(total_redis_db_count)
{
}
const db::consistency_level get_read_consistency_level() const { return _read_consistency; }
const db::consistency_level get_write_consistency_level() const { return _write_consistency; }
const timeout_config& get_timeout_config() const { return _timeout_config; }
const db::timeout_clock::duration get_read_timeout() const { return _timeout_config.read_timeout; }
const db::timeout_clock::duration get_write_timeout() const { return _timeout_config.write_timeout; }
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);
}