0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CellListScannerBuffer.h
Go to the documentation of this file.
1 /*
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 
29 #ifndef Hypertable_RangeServer_CellListScannerBuffer_h
30 #define Hypertable_RangeServer_CellListScannerBuffer_h
31 
32 #include "CellListScanner.h"
33 
34 #include <Common/PageArena.h>
35 #include <Common/StlAllocator.h>
36 
37 namespace Hypertable {
38 
49  public:
50 
55 
57  virtual ~CellListScannerBuffer() { return; }
58 
63  void add(const SerializedKey key, const ByteString value);
64 
65  virtual void forward();
66  virtual bool get(Key &key, ByteString &value);
67 
68  virtual int64_t get_disk_read() { return m_disk_read; }
69 
70  private:
71 
73  void initialize_for_scan();
74 
76  typedef std::pair<SerializedKey, ByteString> KeyValueT;
77 
80 
82  typedef std::vector<KeyValueT, KeyValueAllocT> KeyValueVectorT;
83 
85  struct LtKeyValueT {
86  bool operator()(const KeyValueT &kv1, const KeyValueT &kv2) const {
87  return kv1.first < kv2.first;
88  }
89  };
90 
93 
95  KeyValueVectorT m_cells;
96 
98  KeyValueVectorT::iterator m_iter;
99 
102 
105  };
106 
108 }
109 
110 #endif // Hypertable_RangeServer_CellListScannerBuffer_h
111 
Cell list scanner over a buffer of cells.
ScanContextPtr m_scan_context
Scan context.
PageArena memory allocator.
KeyValueVectorT m_cells
Buffer (array) of cells to be returned.
STL Strict Weak Ordering for KeyValueT.
std::pair< SerializedKey, ByteString > KeyValueT
Key/value type.
Stl compatible memory allocator based on a PageArena.
A class managing one or more serializable ByteStrings.
Definition: ByteString.h:47
void initialize_for_scan()
Sorts cells in preparation for scan.
ByteArena m_arena
Memory arena to hold serialized keys and values.
Stl compatible memory allocator based on a PageArena.
Definition: StlAllocator.h:41
void add(const SerializedKey key, const ByteString value)
Adds a key/value pair to the buffer.
bool operator()(const KeyValueT &kv1, const KeyValueT &kv2) const
bool m_initialized_for_scan
Flag indicating if initialize_for_scan has been called.
Hypertable definitions
CellListScannerBuffer(ScanContextPtr &scan_ctx)
Constructor.
Provides access to internal components of opaque key.
Definition: Key.h:40
virtual ~CellListScannerBuffer()
Destructor.
std::vector< KeyValueT, KeyValueAllocT > KeyValueVectorT
Vector of KeyValueT with allocator.
StlAllocator< KeyValueT > KeyValueAllocT
STL allocator for KeyValueT structure.
KeyValueVectorT::iterator m_iter
Iterator pointing to next cell in m_cells to be returned.
std::shared_ptr< ScanContext > ScanContextPtr
Definition: ScanContext.h:169