<commit_before>/**
 * This file is part of the "libfnord" project
 *   Copyright (c) 2015 <NAME>
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#ifndef _FNORD_DHT_REPLICATIONSCHEME_H
#define _FNORD_DHT_REPLICATIONSCHEME_H
#include <fnord-base/stdtypes.h>
#include <fnord-base/autoref.h>
#include <fnord-base/random.h>
#include <fnord-base/option.h>

namespace fnord {
namespace dht {

struct ReplicaRef {
  uint64_t unique_id;
  String addr;
};

class ReplicationScheme : public RefCounted {
public:
  virtual ~ReplicationScheme() {}
  virtual Vector<ReplicaRef> replicasFor(const String& key) = 0;
  virtual bool keepLocalReplicaFor(const String& key) = 0;
};

/**<commit_msg>iface changes for namespaces, SHA1 partition and record keys<commit_after>/**
 * This file is part of the "libfnord" project
 *   Copyright (c) 2015 <NAME>
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#ifndef _FNORD_DHT_REPLICATIONSCHEME_H
#define _FNORD_DHT_REPLICATIONSCHEME_H
#include <fnord-base/stdtypes.h>
#include <fnord-base/SHA1.h>
#include <fnord-base/autoref.h>
#include <fnord-base/random.h>
#include <fnord-base/option.h>

namespace fnord {
namespace dht {

struct ReplicaRef {
  uint64_t unique_id;
  String addr;
};

class ReplicationScheme : public RefCounted {
public:
  virtual ~ReplicationScheme() {}
  virtual Vector<ReplicaRef> replicasFor(const String& key) = 0;
  virtual Vector<ReplicaRef> replicasFor(const SHA1Hash& key);
  virtual bool keepLocalReplicaFor(const String& key) = 0;
};

/**
{'fraction_non_alphanumeric': 0.10351861295257522, 'fraction_numerical': 0.011728709841917389, 'mean_word_length': 4.654178674351585, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2180927', 'n_tokens_mistral': 671, 'n_tokens_neox': 655, 'n_words': 205}