libfoedus-core
FOEDUS Core Library
storage_id.cpp
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  */
19 
20 #include <ostream>
21 
23 
24 namespace foedus {
25 namespace storage {
26 
27 void describe_snapshot_pointer(std::ostream* o_ptr, SnapshotPagePointer pointer) {
28  std::ostream& o = *o_ptr;
29  if (pointer == 0) {
30  o << "<SnapshotPointer is_null=\"true\"/>";
31  return;
32  }
33  o << "<SnapshotPointer"
34  << " snapshot_id=\"" << extract_snapshot_id_from_snapshot_pointer(pointer)
35  << "\" node=\"" << static_cast<int>(extract_numa_node_from_snapshot_pointer(pointer))
36  << "\" offset=\"" << extract_local_page_id_from_snapshot_pointer(pointer)
37  << "\" />";
38 }
39 
40 std::ostream& operator<<(std::ostream& o, const VolatilePagePointer& v) {
42  return o;
43 }
44 void describe_volatile_pointer(std::ostream* o_ptr, VolatilePagePointer pointer) {
45  std::ostream& o = *o_ptr;
46  if (pointer.is_null()) {
47  o << "<VolatilePointer is_null=\"true\"/>";
48  return;
49  }
50  o << "<VolatilePointer"
51  << " node=\"" << static_cast<int>(pointer.get_numa_node())
52  << "\" offset=\"" << pointer.get_offset()
53  << "\" />";
54 }
55 
56 std::ostream& operator<<(std::ostream& o, const DualPagePointer& v) {
57  o << "<DualPagePointer>";
60  o << "</DualPagePointer>";
61  return o;
62 }
63 } // namespace storage
64 } // namespace foedus
void describe_volatile_pointer(std::ostream *o, VolatilePagePointer pointer)
Definition: storage_id.cpp:44
Represents a pointer to another page (usually a child page).
Definition: storage_id.hpp:271
Definitions of IDs in this package and a few related constant values.
SnapshotLocalPageId extract_local_page_id_from_snapshot_pointer(SnapshotPagePointer pointer)
Definition: storage_id.hpp:91
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Represents a pointer to a volatile page with modification count for preventing ABA.
Definition: storage_id.hpp:194
VolatilePagePointer volatile_pointer_
Definition: storage_id.hpp:308
memory::PagePoolOffset get_offset() const
Definition: storage_id.hpp:202
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
Definition: storage_id.hpp:79
SnapshotPagePointer snapshot_pointer_
Definition: storage_id.hpp:307
uint16_t extract_snapshot_id_from_snapshot_pointer(SnapshotPagePointer pointer)
Definition: storage_id.hpp:98
uint8_t extract_numa_node_from_snapshot_pointer(SnapshotPagePointer pointer)
Definition: storage_id.hpp:95
void describe_snapshot_pointer(std::ostream *o, SnapshotPagePointer pointer)
Definition: storage_id.cpp:27
std::ostream & operator<<(std::ostream &o, const Composer &v)
Definition: composer.cpp:39