libfoedus-core
FOEDUS Core Library
array_metadata.hpp
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  */
18 #ifndef FOEDUS_STORAGE_ARRAY_ARRAY_METADATA_HPP_
19 #define FOEDUS_STORAGE_ARRAY_ARRAY_METADATA_HPP_
20 #include <stdint.h>
21 
22 #include <iosfwd>
23 #include <string>
24 
25 #include "foedus/cxx11.hpp"
26 #include "foedus/error_stack.hpp"
32 
33 namespace foedus {
34 namespace storage {
35 namespace array {
41  enum Constants {
43  };
45  : Metadata(0, kArrayStorage, ""),
46  payload_size_(0),
48  padding_(0),
49  array_size_(0) {}
51  StorageId id,
52  const StorageName& name,
53  uint16_t payload_size,
54  ArrayOffset array_size)
55  : Metadata(id, kArrayStorage, name),
56  payload_size_(payload_size),
58  padding_(0),
59  array_size_(array_size) {
60  }
62  ArrayMetadata(const StorageName& name, uint16_t payload_size, ArrayOffset array_size)
63  : Metadata(0, kArrayStorage, name),
64  payload_size_(payload_size),
66  padding_(0),
67  array_size_(array_size) {
68  }
69 
70  std::string describe() const;
71  friend std::ostream& operator<<(std::ostream& o, const ArrayMetadata& v);
72 
74  uint16_t payload_size_;
83  uint32_t padding_; // to make valgrind happy
86 };
87 
91  : MetadataSerializer(data), data_casted_(data) {}
94 };
95 
96 } // namespace array
97 } // namespace storage
98 } // namespace foedus
99 #endif // FOEDUS_STORAGE_ARRAY_ARRAY_METADATA_HPP_
Definitions of IDs in this package and a few related constant values.
ArrayOffset array_size_
Size of this array.
uint32_t StorageId
Unique ID for storage.
Definition: storage_id.hpp:55
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
uint64_t ArrayOffset
The only key type in array storage.
Definition: array_id.hpp:48
friend std::ostream & operator<<(std::ostream &o, const ArrayMetadata &v)
#define EXTERNALIZABLE(clazz)
Macro to declare/define essential methods for an externalizable class.
ArrayMetadata(const StorageName &name, uint16_t payload_size, ArrayOffset array_size)
This one is for newly creating a storage.
Forward declarations of classes in array storage package.
Metadata of one storage.
Definition: metadata.hpp:58
ArrayMetadata(StorageId id, const StorageName &name, uint16_t payload_size, ArrayOffset array_size)
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
Definition: cxx11.hpp:131
Metadata of an array storage.
Definitions of IDs in this package and a few related constant values.
uint16_t snapshot_drop_volatile_pages_threshold_
Number of levels of volatile pages to keep after each snapshotting.
uint16_t payload_size_
byte size of one record in this array storage without internal overheads