libfoedus-core
FOEDUS Core Library
array_partitioner_impl.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_PARTITIONER_IMPL_HPP_
19 #define FOEDUS_STORAGE_ARRAY_ARRAY_PARTITIONER_IMPL_HPP_
20 
21 #include <stdint.h>
22 
23 #include <cstring>
24 #include <iosfwd>
25 
26 #include "foedus/error_stack.hpp"
27 #include "foedus/fwd.hpp"
29 #include "foedus/memory/fwd.hpp"
33 
34 namespace foedus {
35 namespace storage {
36 namespace array {
72 class ArrayPartitioner final {
73  public:
74  explicit ArrayPartitioner(Partitioner* parent);
75 
77  bool is_partitionable() const;
79  void sort_batch(const Partitioner::SortBatchArguments& args) const;
80 
82  uint8_t get_array_levels() const;
83  const PartitionId* get_bucket_owners() const;
84 
85  friend std::ostream& operator<<(std::ostream& o, const ArrayPartitioner& v);
86 
87  private:
88  Engine* const engine_;
89  const StorageId id_;
90  PartitionerMetadata* const metadata_;
91  ArrayPartitionerData* data_;
92 };
93 
94 struct ArrayPartitionerData final {
95  // only for reinterpret_cast
96  ArrayPartitionerData() = delete;
97  ~ArrayPartitionerData() = delete;
98 
101  uint8_t array_levels_;
102 
105 
108 
111 };
112 
113 
114 } // namespace array
115 } // namespace storage
116 } // namespace foedus
117 #endif // FOEDUS_STORAGE_ARRAY_ARRAY_PARTITIONER_IMPL_HPP_
thread::ThreadGroupId PartitionId
As partition=NUMA node, this is just a synonym of foedus::thread::ThreadGroupId.
Definition: storage_id.hpp:65
Definitions of IDs in this package and a few related constant values.
bool partitionable_
if false, every record goes to node-0.
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
void partition_batch(const Partitioner::PartitionBatchArguments &args) const
uint64_t ArrayOffset
The only key type in array storage.
Definition: array_id.hpp:48
PartitionId bucket_owners_[kInteriorFanout]
partition of each bucket.
friend std::ostream & operator<<(std::ostream &o, const ArrayPartitioner &v)
ArrayOffset array_size_
Size of the entire array.
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
ArrayOffset bucket_size_
bucket = offset / bucket_size_.
Partitioner for an array storage.
void sort_batch(const Partitioner::SortBatchArguments &args) const
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
Forward declarations of classes in memory package.
Tiny metadata of partitioner for every storage used while log gleaning.
Partitioning and sorting logic for one storage.
Definition: partitioner.hpp:70
Definitions of IDs in this package and a few related constant values.
const uint16_t kInteriorFanout
Max number of entries in an interior page of array storage.
Definition: array_id.hpp:110
ErrorStack design_partition(const Partitioner::DesignPartitionArguments &args)