#include <blocksdat_file.h>
Definition at line 58 of file blocksdat_file.h.
◆ close()
| bool BlocksdatFile::close |
( |
| ) |
|
|
protected |
◆ initialize_file()
Definition at line 84 of file blocksdat_file.cpp.
86 const uint32_t nblocks = block_stop + 1;
87 unsigned char nblocksc[4];
89 nblocksc[0] = nblocks & 0xff;
90 nblocksc[1] = (nblocks >> 8) & 0xff;
91 nblocksc[2] = (nblocks >> 16) & 0xff;
92 nblocksc[3] = (nblocks >> 24) & 0xff;
std::ofstream * m_raw_data_file
◆ 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.
49 const boost::filesystem::path dir_path = file_path.parent_path();
50 if (!dir_path.empty())
52 if (boost::filesystem::exists(dir_path))
54 if (!boost::filesystem::is_directory(dir_path))
56 MFATAL(
"export directory path is a file: " << dir_path);
62 if (!boost::filesystem::create_directory(dir_path))
64 MFATAL(
"Failed to create directory " << dir_path);
72 MINFO(
"creating file");
74 m_raw_data_file->open(file_path.string(), std::ios_base::binary | std::ios_base::out | std::ios::trunc);
std::ofstream * m_raw_data_file
bool initialize_file(uint64_t block_stop)
◆ store_blockchain_raw()
Definition at line 120 of file blocksdat_file.cpp.
132 MINFO(
"Using requested block height: " << requested_block_stop);
133 block_stop = requested_block_stop;
138 MINFO(
"Using block height of source blockchain: " << block_stop);
140 MINFO(
"Storing blocks raw data...");
143 MFATAL(
"failed to open raw file for write");
146 for (m_cur_height = block_start; m_cur_height <= block_stop; ++m_cur_height)
154 if (m_cur_height % progress_interval == 0) {
155 std::cout << refresh_string;
156 std::cout <<
"block " << m_cur_height <<
"/" << block_stop << std::flush;
160 std::cout << refresh_string;
161 std::cout <<
"block " << m_cur_height-1 <<
"/" << block_stop <<
ENDL;
163 MINFO(
"Number of blocks exported: " << num_blocks_written);
uint64_t get_current_blockchain_height() const
get the current height of the blockchain
bool open_writer(const boost::filesystem::path &file_path, uint64_t block_stop)
Blockchain * m_blockchain_storage
#define NUM_BLOCKS_PER_CHUNK
unsigned __int64 uint64_t
crypto::hash get_block_id_by_height(uint64_t height) const
gets a block's hash given a height
void write_block(const crypto::hash &block_hash)
◆ write_block()
| void BlocksdatFile::write_block |
( |
const crypto::hash & |
block_hash | ) |
|
|
protected |
◆ 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.0.0.4/src/blockchain_utilities/blocksdat_file.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.0.0.4/src/blockchain_utilities/blocksdat_file.cpp