0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ReplayBuffer.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef Hypertable_RangeServer_ReplayBuffer_h
23 #define Hypertable_RangeServer_ReplayBuffer_h
24 
25 #include "RangeReplayBuffer.h"
26 
30 
31 #include <AsyncComm/Comm.h>
32 
33 #include <Common/Properties.h>
34 
35 #include <map>
36 
37 namespace Hypertable {
38 
39  using namespace Lib;
40  using namespace std;
41 
42  class ReplayBuffer {
43  public:
44  ReplayBuffer(PropertiesPtr &props, Comm *comm,
45  const RangeServerRecovery::ReceiverPlan &plan, const String &location,
46  int32_t plan_generation);
47 
48  void add(const TableIdentifier &table, SerializedKey &key,
49  ByteString &value);
50 
51  size_t memory_used() const { return m_memory_used; }
52 
53  void set_current_fragment(uint32_t fragment_id) {
54  m_fragment = fragment_id;
55  }
56 
57  void flush();
58 
59  private:
60 
63  typedef map<QualifiedRangeSpec, RangeReplayBufferPtr> ReplayBufferMap;
64  ReplayBufferMap m_buffer_map;
66  int32_t m_plan_generation {};
67  size_t m_memory_used {};
68  size_t m_flush_limit_aggregate {};
69  size_t m_flush_limit_per_range {};
70  int32_t m_timeout_ms {};
71  uint32_t m_fragment {};
72  };
73 
74 }
75 
76 #endif // Hypertable_RangeServer_ReplayBuffer_h
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
Declarations for TableIdentifier and TableIdentifierManaged.
Program options handling.
STL namespace.
void set_current_fragment(uint32_t fragment_id)
Definition: ReplayBuffer.h:53
void add(const Key &key, uint8_t flag, const void *value, uint32_t value_len, TableMutatorAsync *value_index_mutator, TableMutatorAsync *qualifier_index_mutator)
Definition: IndexTables.cc:34
A class managing one or more serializable ByteStrings.
Definition: ByteString.h:47
Declarations for QualifiedRangeSpec and QualifiedRangeSpecManaged.
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:447
const RangeServerRecovery::ReceiverPlan & m_plan
Definition: ReplayBuffer.h:62
ReplayBufferMap m_buffer_map
Definition: ReplayBuffer.h:64
map< QualifiedRangeSpec, RangeReplayBufferPtr > ReplayBufferMap
Definition: ReplayBuffer.h:63
Hypertable definitions
Entry point to AsyncComm service.
Definition: Comm.h:61
Declarations for Comm.
size_t memory_used() const
Definition: ReplayBuffer.h:51
RangeServer recovery receiver plan.
Definition: ReceiverPlan.h:48