#include <blocksdat_file.h>
Definition at line 58 of file blocksdat_file.h.
◆ close()
| bool BlocksdatFile::close |
( |
| ) |
|
|
protected |
Definition at line 109 of file blocksdat_file.cpp.
110{
112 return false;
113
116 return true;
117}
std::ofstream * m_raw_data_file
◆ initialize_file()
| bool BlocksdatFile::initialize_file |
( |
uint64_t | block_stop | ) |
|
|
protected |
Definition at line 84 of file blocksdat_file.cpp.
85{
86 const uint32_t nblocks = block_stop + 1;
87 unsigned char nblocksc[4];
88
89 nblocksc[0] = nblocks & 0xff;
90 nblocksc[1] = (nblocks >> 8) & 0xff;
91 nblocksc[2] = (nblocks >> 16) & 0xff;
92 nblocksc[3] = (nblocks >> 24) & 0xff;
93
94
99
100 return true;
101}
◆ open_writer()
| bool BlocksdatFile::open_writer |
( |
const boost::filesystem::path & | file_path, |
|
|
uint64_t | block_stop ) |
|
protected |
Definition at line 47 of file blocksdat_file.cpp.
48{
49 const boost::filesystem::path dir_path = file_path.parent_path();
50 if (!dir_path.empty())
51 {
52 if (boost::filesystem::exists(dir_path))
53 {
54 if (!boost::filesystem::is_directory(dir_path))
55 {
56 MFATAL(
"export directory path is a file: " << dir_path);
57 return false;
58 }
59 }
60 else
61 {
62 if (!boost::filesystem::create_directory(dir_path))
63 {
64 MFATAL(
"Failed to create directory " << dir_path);
65 return false;
66 }
67 }
68 }
69
71
72 MINFO(
"creating file");
73
74 m_raw_data_file->open(file_path.string(), std::ios_base::binary | std::ios_base::out | std::ios::trunc);
76 return false;
77
79
80 return true;
81}
bool initialize_file(uint64_t block_stop)
◆ store_blockchain_raw()
Definition at line 120 of file blocksdat_file.cpp.
121{
125 block b;
126
130 if ((requested_block_stop > 0) && (requested_block_stop < m_blockchain_storage->get_current_blockchain_height()))
131 {
132 MINFO(
"Using requested block height: " << requested_block_stop);
133 block_stop = requested_block_stop;
134 }
135 else
136 {
138 MINFO(
"Using block height of source blockchain: " << block_stop);
139 }
140 MINFO(
"Storing blocks raw data...");
142 {
143 MFATAL(
"failed to open raw file for write");
144 return false;
145 }
146 for (m_cur_height = block_start; m_cur_height <= block_stop; ++m_cur_height)
147 {
148
153 }
154 if (m_cur_height % progress_interval == 0) {
155 std::cout << refresh_string;
156 std::cout << "block " << m_cur_height << "/" << block_stop << std::flush;
157 }
158 }
159
160 std::cout << refresh_string;
161 std::cout <<
"block " << m_cur_height-1 <<
"/" << block_stop <<
ENDL;
162
163 MINFO(
"Number of blocks exported: " << num_blocks_written);
164
166}
#define NUM_BLOCKS_PER_CHUNK
bool open_writer(const boost::filesystem::path &file_path, uint64_t block_stop)
Blockchain * m_blockchain_storage
void write_block(const crypto::hash &block_hash)
unsigned __int64 uint64_t
◆ write_block()
| void BlocksdatFile::write_block |
( |
const crypto::hash & | block_hash | ) |
|
|
protected |
Definition at line 103 of file blocksdat_file.cpp.
104{
105 const std::string data(block_hash.data, sizeof(block_hash));
107}
◆ m_blockchain_storage
◆ m_raw_data_file
| std::ofstream* BlocksdatFile::m_raw_data_file |
|
protected |
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/blockchain_utilities/blocksdat_file.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/blockchain_utilities/blocksdat_file.cpp