0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RangeReplayBuffer.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_RangeReplayBuffer_h
23 #define Hypertable_RangeServer_RangeReplayBuffer_h
24 
27 
28 #include <AsyncComm/CommAddress.h>
29 
30 #include <Common/DynamicBuffer.h>
31 #include <Common/Properties.h>
32 #include <Common/StaticBuffer.h>
33 #include <Common/StringExt.h>
34 
35 #include <memory>
36 
37 namespace Hypertable {
38 
40  public:
41  RangeReplayBuffer(const String &location, const QualifiedRangeSpec &range) :
42  m_location(location), m_range(range) {
43  m_addr.set_proxy(location);
44  }
45  const String& get_location() const {return m_location; }
46  size_t memory_used() const { return m_accum.fill(); }
47  size_t add(SerializedKey &key, ByteString &value);
48  void get_updates(StaticBuffer &updates) { updates = m_accum; }
49  void clear();
52 
53  private:
58  };
59 
60  typedef std::shared_ptr<RangeReplayBuffer> RangeReplayBufferPtr;
61 
62 }
63 
64 #endif // Hypertable_RangeServer_RangeReplayBuffer_h
A memory buffer of static size.
Definition: StaticBuffer.h:45
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
size_t add(SerializedKey &key, ByteString &value)
std::shared_ptr< RangeReplayBuffer > RangeReplayBufferPtr
Program options handling.
Declarations for CommAddress.
A dynamic, resizable and reference counted memory buffer.
Definition: DynamicBuffer.h:42
A class managing one or more serializable ByteStrings.
Definition: ByteString.h:47
Declarations for QualifiedRangeSpec and QualifiedRangeSpecManaged.
A dynamic, resizable memory buffer.
void set_proxy(const String &str)
Sets address type to CommAddress::PROXY and proxy name to p.
Definition: CommAddress.h:76
A memory buffer of static size.
const String & get_location() const
Hypertable definitions
RangeReplayBuffer(const String &location, const QualifiedRangeSpec &range)
size_t fill() const
Returns the size of the used portion.
Definition: DynamicBuffer.h:70
Qualified (with table identifier) range specification.
void get_updates(StaticBuffer &updates)
String extensions and helpers: sets, maps, append operators etc.
QualifiedRangeSpec & get_range()
Address abstraction to hold either proxy name or IPv4:port address.
Definition: CommAddress.h:52