This repository has been archived by the owner on Oct 4, 2019. It is now read-only.
forked from steemit/steem
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef7858a
commit 492109b
Showing
19 changed files
with
488 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
set(CURRENT_TARGET operation_dump) | ||
|
||
list(APPEND CURRENT_TARGET_HEADERS | ||
include/golos/plugins/operation_dump/operation_dump_plugin.hpp | ||
include/golos/plugins/operation_dump/operation_dump_container.hpp | ||
) | ||
|
||
list(APPEND CURRENT_TARGET_SOURCES | ||
operation_dump_plugin.cpp | ||
) | ||
|
||
if(BUILD_SHARED_LIBRARIES) | ||
add_library(golos_${CURRENT_TARGET} SHARED | ||
${CURRENT_TARGET_HEADERS} | ||
${CURRENT_TARGET_SOURCES} | ||
) | ||
else() | ||
add_library(golos_${CURRENT_TARGET} STATIC | ||
${CURRENT_TARGET_HEADERS} | ||
${CURRENT_TARGET_SOURCES} | ||
) | ||
endif() | ||
|
||
add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) | ||
set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) | ||
|
||
target_link_libraries( | ||
golos_${CURRENT_TARGET} | ||
golos::chain_plugin | ||
golos::follow | ||
golos::tags | ||
appbase | ||
) | ||
|
||
target_include_directories(golos_${CURRENT_TARGET} | ||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
|
||
install(TARGETS | ||
golos_${CURRENT_TARGET} | ||
|
||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) |
42 changes: 42 additions & 0 deletions
42
plugins/operation_dump/include/golos/plugins/operation_dump/operation_dump_container.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include <boost/filesystem/fstream.hpp> | ||
|
||
namespace golos { namespace plugins { namespace operation_dump { | ||
|
||
namespace bfs = boost::filesystem; | ||
|
||
// Structure size can differ - uses sizeof | ||
struct dump_header { | ||
char magic[13] = "Golos\adumpOP"; | ||
uint32_t version = 1; | ||
}; | ||
|
||
using operation_number = std::pair<uint32_t, uint16_t>; | ||
|
||
class dump_buffer : public std::stringstream { | ||
public: | ||
dump_buffer() { | ||
} | ||
|
||
using std::stringstream::write; | ||
|
||
void write(const operation_number& op_num) { | ||
fc::raw::pack(*this, op_num); | ||
} | ||
}; | ||
|
||
using dump_buffers = std::map<std::string, dump_buffer>; | ||
|
||
class dump_file : public bfs::ofstream { | ||
public: | ||
dump_file(const bfs::path& p): bfs::ofstream(p, std::ios_base::binary | std::ios_base::app) { | ||
bfs::ofstream::exceptions(std::ofstream::failbit | std::ofstream::badbit); | ||
} | ||
|
||
void write(const dump_header& hdr) { | ||
bfs::ofstream::write((const char*)&hdr, sizeof(dump_header)); | ||
} | ||
}; | ||
|
||
} } } // golos::plugins::operation_dump |
37 changes: 37 additions & 0 deletions
37
plugins/operation_dump/include/golos/plugins/operation_dump/operation_dump_plugin.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include <appbase/plugin.hpp> | ||
#include <golos/chain/database.hpp> | ||
#include <golos/chain/operation_notification.hpp> | ||
#include <golos/plugins/chain/plugin.hpp> | ||
|
||
namespace golos { namespace plugins { namespace operation_dump { | ||
|
||
namespace bpo = boost::program_options; | ||
using namespace golos::chain; | ||
|
||
class operation_dump_plugin final : public appbase::plugin<operation_dump_plugin> { | ||
public: | ||
APPBASE_PLUGIN_REQUIRES((chain::plugin)) | ||
|
||
operation_dump_plugin(); | ||
|
||
~operation_dump_plugin(); | ||
|
||
void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; | ||
|
||
void plugin_initialize(const bpo::variables_map& options) override; | ||
|
||
void plugin_startup() override; | ||
|
||
void plugin_shutdown() override; | ||
|
||
static const std::string& name(); | ||
|
||
private: | ||
class operation_dump_plugin_impl; | ||
|
||
std::unique_ptr<operation_dump_plugin_impl> my; | ||
}; | ||
|
||
} } } //golos::plugins::operation_dump |
Oops, something went wrong.