#include <snapshot.hpp>
Definition at line 329 of file snapshot.hpp.
◆ ostream_snapshot_writer()
sysio::chain::ostream_snapshot_writer::ostream_snapshot_writer |
( |
std::ostream & | snapshot | ) |
|
|
explicit |
Definition at line 122 of file snapshot.cpp.
123:snapshot(snapshot)
124,header_pos(snapshot.tellp())
125,section_pos(-1)
126,row_count(0)
127{
128
130 snapshot.write((char*)&totem, sizeof(totem));
131
132
133 auto version = current_snapshot_version;
134 snapshot.write((char*)&version, sizeof(version));
135}
static const uint32_t magic_number
◆ finalize()
void sysio::chain::ostream_snapshot_writer::finalize |
( |
| ) |
|
Definition at line 186 of file snapshot.cpp.
186 {
187 uint64_t end_marker = std::numeric_limits<uint64_t>::max();
188
189
190 snapshot.write((char*)&end_marker, sizeof(end_marker));
191}
unsigned __int64 uint64_t
◆ write_end_section()
void sysio::chain::ostream_snapshot_writer::write_end_section |
( |
| ) |
|
|
overridevirtual |
Implements sysio::chain::snapshot_writer.
Definition at line 167 of file snapshot.cpp.
167 {
168 auto restore = snapshot.tellp();
169
171
172 snapshot.seekp(section_pos);
173
174
175 snapshot.write((char*)§ion_size, sizeof(section_size));
176
177
178 snapshot.write((char*)&row_count, sizeof(row_count));
179
180 snapshot.seekp(restore);
181
182 section_pos = std::streampos(-1);
183 row_count = 0;
184}
◆ write_row()
Implements sysio::chain::snapshot_writer.
Definition at line 156 of file snapshot.cpp.
156 {
157 auto restore = snapshot.tellp();
158 try {
159 row_writer.write(snapshot);
160 } catch (...) {
161 snapshot.seekp(restore);
162 throw;
163 }
164 row_count++;
165}
◆ write_start_section()
void sysio::chain::ostream_snapshot_writer::write_start_section |
( |
const std::string & | section_name | ) |
|
|
overridevirtual |
Implements sysio::chain::snapshot_writer.
Definition at line 137 of file snapshot.cpp.
138{
139 SYS_ASSERT(section_pos == std::streampos(-1), snapshot_exception,
"Attempting to write a new section without closing the previous section");
140 section_pos = snapshot.tellp();
141 row_count = 0;
142
143 uint64_t placeholder = std::numeric_limits<uint64_t>::max();
144
145
146 snapshot.write((char*)&placeholder, sizeof(placeholder));
147
148
149 snapshot.write((char*)&placeholder, sizeof(placeholder));
150
151
152 snapshot.write(section_name.data(), section_name.size());
153 snapshot.put(0);
154}
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
◆ magic_number
const uint32_t sysio::chain::ostream_snapshot_writer::magic_number = 0x30510550 |
|
static |
The documentation for this class was generated from the following files: