Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::detail::index_writer Class Reference

Public Member Functions

 index_writer (const fc::path &block_index_name, uint32_t blocks_expected)
 
void write (uint64_t pos)
 

Detailed Description

Definition at line 177 of file block_log.cpp.

Constructor & Destructor Documentation

◆ index_writer()

sysio::chain::detail::index_writer::index_writer ( const fc::path & block_index_name,
uint32_t blocks_expected )

Definition at line 1139 of file block_log.cpp.

1140 : _blocks_remaining(blocks_expected) {
1141 const size_t file_sz = blocks_expected*sizeof(uint64_t);
1142
1143 fc::cfile file;
1144 file.set_file_path(block_index_name);
1145 file.open(LOG_WRITE_C);
1146 file.close();
1147
1148 fc::resize_file(block_index_name, file_sz);
1149 _file.emplace(block_index_name.string().c_str(), boost::interprocess::read_write);
1150 _mapped_file_region.emplace(*_file, boost::interprocess::read_write);
1151 }
#define LOG_WRITE_C
Definition block_log.cpp:12
void set_file_path(fc::path file_path)
Definition cfile.hpp:37
std::string string() const
void resize_file(const path &file, size_t s)
unsigned __int64 uint64_t
Definition stdint.h:136
Here is the call graph for this function:

Member Function Documentation

◆ write()

void sysio::chain::detail::index_writer::write ( uint64_t pos)

Definition at line 1153 of file block_log.cpp.

1153 {
1154 SYS_ASSERT( _blocks_remaining, block_log_exception, "No more blocks were expected for the block log index" );
1155
1156 char* base = (char*)_mapped_file_region->get_address();
1157 base += --_blocks_remaining*sizeof(uint64_t);
1158 memcpy(base, &pos, sizeof(pos));
1159
1160 if ((_blocks_remaining & 0xfffff) == 0)
1161 ilog("blocks remaining to index: ${blocks_left} position in log file: ${pos}", ("blocks_left", _blocks_remaining)("pos",pos));
1162 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
#define ilog(FORMAT,...)
Definition logger.hpp:118
memcpy((char *) pInfo->slotDescription, s, l)
Here is the call graph for this function:

The documentation for this class was generated from the following file: