0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CellStoreInfo.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_CellStoreInfo_h
23 #define Hypertable_RangeServer_CellStoreInfo_h
24 
25 #include "CellCache.h"
26 #include "CellStoreV6.h"
27 
28 namespace Hypertable {
29 
30  class CellStoreInfo {
31  public:
36  }
37  CellStoreInfo(CellStorePtr &csp, CellCachePtr &scp, int64_t ecr) :
41  }
45 
47 
48  try {
49  m_divisor = (boost::any_cast<uint32_t>(cs->get_trailer()->get("flags")) & CellStoreTrailerV6::SPLIT) ? 2 : 1;
50  }
51  catch (std::exception &e) {
52  m_divisor = 1;
53  }
54 
55  try {
56  cell_count = boost::any_cast<int64_t>(cs->get_trailer()->get("total_entries")) / m_divisor;
57  timestamp_min = boost::any_cast<int64_t>(cs->get_trailer()->get("timestamp_min"));
58  timestamp_max = boost::any_cast<int64_t>(cs->get_trailer()->get("timestamp_max"));
59  }
60  catch (std::exception &e) {
61  cell_count = 0;
64  }
65  try {
66  key_bytes = boost::any_cast<int64_t>(cs->get_trailer()->get("key_bytes")) / m_divisor;
67  value_bytes = boost::any_cast<int64_t>(cs->get_trailer()->get("value_bytes")) /m_divisor;
68  }
69  catch (std::exception &e) {
70  key_bytes = value_bytes = 0;
71  }
72  }
73 
74  int64_t expirable_data() {
75  try {
76  return boost::any_cast<int64_t>(cs->get_trailer()->get("expirable_data")) / m_divisor;
77  }
78  catch (std::exception &e) {
79  return 0;
80  }
81  }
82 
83  int64_t delete_count() {
84  try {
85  return boost::any_cast<int64_t>(cs->get_trailer()->get("delete_count")) / m_divisor;
86  }
87  catch (std::exception &e) {
88  return 0;
89  }
90  }
91 
94  uint64_t cell_count;
95  int64_t key_bytes;
96  int64_t value_bytes;
102  int64_t timestamp_min;
103  int64_t timestamp_max;
104  int64_t total_data;
105 
106  private:
107  int m_divisor {1};
108  };
109 
110 } // namespace Hypertable
111 
112 #endif // Hypertable_RangeServer_CellStoreInfo_h
static const int64_t TIMESTAMP_MIN
Definition: KeySpec.h:34
CellStoreInfo(CellStorePtr &csp, CellCachePtr &scp, int64_t ecr)
Definition: CellStoreInfo.h:37
CellStoreInfo(CellStorePtr &csp)
Definition: CellStoreInfo.h:32
std::shared_ptr< CellStore > CellStorePtr
Smart pointer to CellStore.
Definition: CellStore.h:340
Hypertable definitions
static const int64_t TIMESTAMP_MAX
Definition: KeySpec.h:35
Declarations for CellStoreV6.
std::shared_ptr< CellCache > CellCachePtr
Shared smart pointer to CellCache.
Definition: CellCache.h:163