libfoedus-core
FOEDUS Core Library
savepoint_manager.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_SAVEPOINT_SAVEPOINT_MANAGER_HPP_
19 #define FOEDUS_SAVEPOINT_SAVEPOINT_MANAGER_HPP_
20 #include "foedus/epoch.hpp"
21 #include "foedus/fwd.hpp"
22 #include "foedus/initializable.hpp"
23 #include "foedus/log/log_id.hpp"
24 #include "foedus/savepoint/fwd.hpp"
26 namespace foedus {
27 namespace savepoint {
32 class SavepointManager CXX11_FINAL : public virtual Initializable {
33  public:
34  explicit SavepointManager(Engine* engine);
36 
37  // Disable default constructors
41 
43  bool is_initialized() const CXX11_OVERRIDE;
45 
54 
56  void get_meta_logger_offsets(uint64_t* oldest_offset, uint64_t* durable_offset) const;
62  void change_meta_logger_durable_offset(uint64_t durable_offset);
63 
66  Epoch get_earliest_epoch() const;
70 
80  ErrorStack take_savepoint(Epoch new_global_durable_epoch);
81 
89  snapshot::SnapshotId new_snapshot_id,
90  Epoch new_snapshot_epoch);
91 
92  private:
93  SavepointManagerPimpl *pimpl_;
94 };
95 } // namespace savepoint
96 } // namespace foedus
97 #endif // FOEDUS_SAVEPOINT_SAVEPOINT_MANAGER_HPP_
SavepointManager & operator=(const SavepointManager &)=delete
ErrorStack take_savepoint_after_snapshot(snapshot::SnapshotId new_snapshot_id, Epoch new_snapshot_epoch)
Takes a savepoint just to remember the newly taken snapshot.
snapshot::SnapshotId get_latest_snapshot_id() const
The pure-virtual interface to initialize/uninitialize non-trivial resources.
Typedefs of ID types used in snapshot package.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
ErrorStack initialize() override
Acquires resources in this object, usually called right after constructor.
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Represents a time epoch.
Definition: epoch.hpp:61
ErrorStack take_savepoint(Epoch new_global_durable_epoch)
Atomically and durably takes a savepoint for the given epoch advancement.
Typedefs of ID types used in log package.
void change_meta_logger_durable_offset(uint64_t durable_offset)
Rewrites meta logger's durable_offset.
ErrorStack uninitialize() override
An idempotent method to release all resources of this object, if any.
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
Definition: cxx11.hpp:131
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
uint16_t SnapshotId
Unique ID of Snapshot.
Definition: snapshot_id.hpp:43
#define CXX11_OVERRIDE
Used in public headers in place of "override" of C++11.
Definition: cxx11.hpp:134
#define CXX11_FUNC_DELETE
Used in public headers in place of " = delete" of C++11.
Definition: cxx11.hpp:128
Forward declarations of classes in savepoint manager package.
void get_meta_logger_offsets(uint64_t *oldest_offset, uint64_t *durable_offset) const
Returns the saved information of metadata logger in lateset savepoint.
Information in savepoint for one logger.
Definition: savepoint.hpp:140
uint16_t LoggerId
Typedef for an ID of Logger.
Definition: log_id.hpp:36
bool is_initialized() const override
Returns whether the object has been already initialized or not.
LoggerSavepointInfo get_logger_savepoint(log::LoggerId logger_id)
Returns the saved information of the given logger in latest savepoint.
Savepoint manager that atomically and durably writes out a savepoint file.