libfoedus-core
FOEDUS Core Library
snapshot_file_set.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_CACHE_SNAPSHOT_FILE_SET_HPP_
19 #define FOEDUS_CACHE_SNAPSHOT_FILE_SET_HPP_
20 
21 #include <iosfwd>
22 #include <map>
23 
24 #include "foedus/cxx11.hpp"
25 #include "foedus/fwd.hpp"
26 #include "foedus/initializable.hpp"
27 #include "foedus/fs/fwd.hpp"
29 #include "foedus/storage/fwd.hpp"
32 
33 namespace foedus {
34 namespace cache {
53  public:
54  explicit SnapshotFileSet(Engine* engine);
57  void close_all();
58 
59  Engine* get_engine() { return engine_; }
60 
63  SnapshotFileSet& operator=(const SnapshotFileSet &other) CXX11_FUNC_DELETE;
64 
65  ErrorCode get_or_open_file(storage::SnapshotPagePointer page_pointer, fs::DirectIoFile** out) {
66  snapshot::SnapshotId snapshot_id
69  return get_or_open_file(snapshot_id, node_id, out);
70  }
72  snapshot::SnapshotId snapshot_id,
73  thread::ThreadGroupId node_id,
74  fs::DirectIoFile** out);
75 
78  ErrorCode read_pages(storage::SnapshotPagePointer page_id_begin, uint32_t page_count, void* out);
79 
80  friend std::ostream& operator<<(std::ostream& o, const SnapshotFileSet& v);
81 
82  private:
83  Engine* const engine_;
84  std::map<snapshot::SnapshotId, std::map< thread::ThreadGroupId, fs::DirectIoFile* > > files_;
85 };
86 } // namespace cache
87 } // namespace foedus
88 #endif // FOEDUS_CACHE_SNAPSHOT_FILE_SET_HPP_
ErrorStack uninitialize_once() override
Forward declarations of classes in filesystem package.
Definitions of IDs in this package and a few related constant values.
ErrorCode read_page(storage::SnapshotPagePointer page_id, void *out)
Typedefs of ID types used in snapshot package.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Typedefs of ID types used in thread package.
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Typical implementation of Initializable as a skeleton base class.
Holds a set of read-only file objects for snapshot files.
Forward declarations of classes in storage package.
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
Definition: cxx11.hpp:131
friend std::ostream & operator<<(std::ostream &o, const SnapshotFileSet &v)
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
Definition: storage_id.hpp:79
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
ErrorStack initialize_once() override
uint16_t extract_snapshot_id_from_snapshot_pointer(SnapshotPagePointer pointer)
Definition: storage_id.hpp:98
ErrorCode read_pages(storage::SnapshotPagePointer page_id_begin, uint32_t page_count, void *out)
Read contiguous pages in one shot.
uint8_t extract_numa_node_from_snapshot_pointer(SnapshotPagePointer pointer)
Definition: storage_id.hpp:95
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
ErrorCode get_or_open_file(storage::SnapshotPagePointer page_pointer, fs::DirectIoFile **out)
Represents an I/O stream on one file without filesystem caching.
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
Definition: thread_id.hpp:38
ErrorCode
Enum of error codes defined in error_code.xmacro.
Definition: error_code.hpp:85