forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabstract_replication_strategy.hh
38 lines (31 loc) · 1.3 KB
/
abstract_replication_strategy.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Copyright (C) 2015 Cloudius Systems, Ltd.
*/
#pragma once
#include <memory>
#include <functional>
#include <unordered_map>
#include "gms/inet_address.hh"
#include "dht/i_partitioner.hh"
#include "token_metadata.hh"
#include "abstract_endpoint_snitch.hh"
// forward declaration since database.hh includes this file
class keyspace;
namespace locator {
using inet_address = gms::inet_address;
using token = dht::token;
class abstract_replication_strategy {
protected:
sstring _ks_name;
keyspace* _keyspace = nullptr;
std::unordered_map<sstring, sstring> _config_options;
token_metadata& _token_metadata;
i_endpoint_snitch& _snitch;
virtual std::vector<inet_address> calculate_natural_endpoints(const token& search_token) = 0;
public:
abstract_replication_strategy(const sstring& keyspace_name, token_metadata& token_metadata, i_endpoint_snitch& snitch, std::unordered_map<sstring, sstring>& config_options);
virtual ~abstract_replication_strategy() {}
static std::unique_ptr<abstract_replication_strategy> create_replication_strategy(const sstring& ks_name, const sstring& strategy_name, token_metadata& token_metadata, i_endpoint_snitch& snitch, std::unordered_map<sstring, sstring>& config_options);
std::vector<inet_address> get_natural_endpoints(const token& search_token);
};
}