0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SerializedCellsReader.cc
Go to the documentation of this file.
1 
19 #include <Common/Compat.h>
20 
21 #include "SerializedCellsReader.h"
22 #include "SerializedCellsFlag.h"
23 
24 #include <Hypertable/Lib/KeySpec.h>
25 
26 #include <Common/Error.h>
27 #include <Common/Logger.h>
28 #include <Common/Serialization.h>
29 
30 using namespace Hypertable;
31 
33  size_t remaining = m_end - m_ptr;
34 
35  if (m_eob)
36  return false;
37 
38  if (remaining == 0)
40 
41  m_flag = Serialization::decode_i8(&m_ptr, &remaining);
42 
44  m_eob = true;
45  return false;
46  }
47 
49  m_timestamp = Serialization::decode_i64(&m_ptr, &remaining);
52 
56  m_revision = Serialization::decode_i64(&m_ptr, &remaining);
57  else
59 
60  // row; if empty then use the previous row
61  m_row = (const char *)m_ptr;
62  if (!*m_row) {
63  if (m_previous_row == 0)
65  "Empty row key found in serialized cells buffer");
67  m_ptr++;
68  }
69  else {
70  while (*m_ptr && m_ptr<m_end)
71  m_ptr++;
72  if (m_ptr == m_end)
74  m_ptr++;
76  }
77 
78  // column_family
79  m_column_family = (const char *)m_ptr;
80  while (*m_ptr && m_ptr<m_end)
81  m_ptr++;
82  if (m_ptr == m_end)
84  m_ptr++;
85 
86  // column_qualifier
87  m_column_qualifier = (const char *)m_ptr;
88  while (*m_ptr && m_ptr<m_end)
89  m_ptr++;
90  if (m_ptr == m_end)
92  m_ptr++;
93 
94  remaining = m_end - m_ptr;
95  m_value_len = Serialization::decode_i32(&m_ptr, &remaining);
96 
97  if (m_value_len > remaining)
99 
100  m_value = m_ptr;
101  m_ptr += m_value_len;
102 
103  m_cell_flag = *m_ptr++;
104 
107 
108  return true;
109 }
static const uint32_t FLAG_DELETE_ROW
Definition: KeySpec.h:40
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
uint8_t decode_i8(const uint8_t **bufp, size_t *remainp)
Decode a 8-bit integer (a byte/character)
Definition: Serialization.h:60
uint64_t decode_i64(const uint8_t **bufp, size_t *remainp)
Decode a 64-bit integer in little-endian order.
Logging routines and macros.
Compatibility Macros for C/C++.
Functions to serialize/deserialize primitives to/from a memory buffer.
static const int64_t TIMESTAMP_NULL
Definition: KeySpec.h:36
Hypertable definitions
static const int64_t AUTO_ASSIGN
Definition: KeySpec.h:38
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
Definition: Error.h:478