libfoedus-core
FOEDUS Core Library
masstree_metadata.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
19 
20 #include <iostream>
21 #include <sstream>
22 #include <string>
23 
25 
26 namespace foedus {
27 namespace storage {
28 namespace masstree {
29 std::string MasstreeMetadata::describe() const {
30  std::stringstream o;
31  o << MasstreeMetadataSerializer(const_cast<MasstreeMetadata*>(this));
32  return o.str();
33 }
34 std::ostream& operator<<(std::ostream& o, const MasstreeMetadata& v) {
35  o << MasstreeMetadataSerializer(const_cast<MasstreeMetadata*>(&v));
36  return o;
37 }
38 
39 ErrorStack MasstreeMetadataSerializer::load(tinyxml2::XMLElement* element) {
40  CHECK_ERROR(load_base(element));
42  element, "border_early_split_threshold_", &data_casted_->border_early_split_threshold_))
44  element,
45  "snapshot_drop_volatile_pages_layer_threshold_",
48  element,
49  "snapshot_drop_volatile_pages_btree_levels_",
51  CHECK_ERROR(get_element(element, "min_layer_hint_", &data_casted_->min_layer_hint_))
52  return kRetOk;
53 }
54 
55 ErrorStack MasstreeMetadataSerializer::save(tinyxml2::XMLElement* element) const {
56  CHECK_ERROR(save_base(element));
58  element, "border_early_split_threshold_", "", data_casted_->border_early_split_threshold_));
60  element,
61  "snapshot_drop_volatile_pages_layer_threshold_",
62  "",
65  element,
66  "snapshot_drop_volatile_pages_btree_levels_",
67  "",
69  CHECK_ERROR(add_element(element, "min_layer_hint_", "", data_casted_->min_layer_hint_));
70  return kRetOk;
71 }
72 
73 } // namespace masstree
74 } // namespace storage
75 } // namespace foedus
std::ostream & operator<<(std::ostream &o, const MasstreeComposeContext::PathLevel &v)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
uint16_t snapshot_drop_volatile_pages_layer_threshold_
Number of B-trie layers of volatile pages to keep after each snapshotting.
ErrorStack load_base(tinyxml2::XMLElement *element)
common routine for the implementation of load()
Definition: metadata.cpp:50
ErrorStack load(tinyxml2::XMLElement *element) override
Reads the content of this object from the given XML element.
uint16_t border_early_split_threshold_
Kind of fill factor for border pages, bit different from usual B-tree.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
ErrorStack save(tinyxml2::XMLElement *element) const override
Writes the content of this object to the given XML element.
ErrorStack save_base(tinyxml2::XMLElement *element) const
common routine for the implementation of save()
Definition: metadata.cpp:66
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
const ErrorStack kRetOk
Normal return value for no-error case.
static ErrorStack get_element(tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0)
Only declaration in header.
Layer min_layer_hint_
Hints how many layers this storage will create for most of records.
uint16_t snapshot_drop_volatile_pages_btree_levels_
Volatile pages of this B-tree level or higher are always kept after each snapshotting.
static ErrorStack add_element(tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value)
Only declaration in header.