Skip to content

Commit

Permalink
More logging around trace api
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Apr 4, 2024
1 parent d513582 commit ab1ceb3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ class chain_extraction_impl_type {

void store_lib( uint32_t block_num ) {
try {
dlog("append_lib");
store.append_lib( block_num );
dlog("append_lib done");
} catch( ... ) {
except_handler( MAKE_EXCEPTION_WITH_CONTEXT( std::current_exception() ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ namespace eosio::trace_api {
*/
template<typename DataEntry, typename File>
static uint64_t append_store(const DataEntry &entry, File &file) {
dlog("pack");
auto data = fc::raw::pack(entry);
dlog("tellp");
const auto offset = file.tellp();
dlog("write");
file.write(data.data(), data.size());
dlog("flush");
file.flush();
dlog("sync");
file.sync();
dlog("append_store done");
return offset;
}

Expand Down
8 changes: 8 additions & 0 deletions plugins/trace_api_plugin/store_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,21 @@ namespace eosio::trace_api {

void store_provider::append_lib(uint32_t lib) {
fc::cfile index, trx_id;
dlog("slice_number");
const uint32_t slice_number = _slice_directory.slice_number(lib);
dlog("find_or_create_index_slice");
_slice_directory.find_or_create_index_slice(slice_number, open_state::write, index);
dlog("metadata_log_entry");
auto le = metadata_log_entry { lib_entry_v0 { .lib = lib }};
dlog("append_store");
append_store(le, index);
dlog("find_or_create_trx_id_slice");
_slice_directory.find_or_create_trx_id_slice(slice_number, open_state::write, trx_id);
dlog("append_store");
append_store(le, trx_id);
dlog("set_lib");
_slice_directory.set_lib(lib);
dlog("append_lib done");
}

void store_provider::append_trx_ids(block_trxs_entry tt){
Expand Down

0 comments on commit ab1ceb3

Please sign in to comment.