libfoedus-core
FOEDUS Core Library
sequential_composer_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_SEQUENTIAL_SEQUENTIAL_COMPOSER_IMPL_HPP_
19 #define FOEDUS_STORAGE_SEQUENTIAL_SEQUENTIAL_COMPOSER_IMPL_HPP_
20 
21 #include <stdint.h>
22 
23 #include <iosfwd>
24 #include <string>
25 
26 #include "foedus/fwd.hpp"
27 #include "foedus/memory/fwd.hpp"
28 #include "foedus/snapshot/fwd.hpp"
30 #include "foedus/storage/page.hpp"
34 
35 namespace foedus {
36 namespace storage {
37 namespace sequential {
60 class SequentialComposer final {
61  public:
66  struct RootInfoPage final {
69  char filler_[kPageSize - sizeof(PageHeader) - sizeof(HeadPagePointer)];
70  };
71 
72  explicit SequentialComposer(Composer *parent);
73 
74  std::string to_string() const;
75 
79 
80  private:
81  SequentialPage* compose_new_head(snapshot::SnapshotWriter* snapshot_writer);
82  ErrorStack dump_pages(
83  snapshot::SnapshotWriter* snapshot_writer,
84  bool last_dump,
85  uint32_t allocated_pages,
86  uint64_t* total_pages);
87 
88  Engine* const engine_;
89  const StorageId storage_id_;
90 };
91 
92 } // namespace sequential
93 } // namespace storage
94 } // namespace foedus
95 #endif // FOEDUS_STORAGE_SEQUENTIAL_SEQUENTIAL_COMPOSER_IMPL_HPP_
Definitions of IDs in this package and a few related constant values.
char filler_[kPageSize-sizeof(PageHeader)-sizeof(HeadPagePointer)]
Represents a logic to compose a new version of data pages for one storage.
Definition: composer.hpp:86
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
Composer::DropResult drop_volatiles(const Composer::DropVolatilesArguments &args)
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Forward declarations of classes in snapshot manager package.
Represents one data page in Sequential Storage.
Each pointer to a snapshot head page comes with a bit more information to help reading.
Forward declarations of classes in sequential storage package.
Output of one compose() call, which are then combined in construct_root().
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
ErrorStack compose(const Composer::ComposeArguments &args)
Just a marker to denote that a memory region represents a data page.
Definition: page.hpp:184
Retrun value of drop_volatiles()
Definition: composer.hpp:171
Forward declarations of classes in memory package.
ErrorStack construct_root(const Composer::ConstructRootArguments &args)
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
Definition: storage_id.hpp:45
Writes out one snapshot file for all data pages in one reducer.