Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
ab3306ac
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ab3306ac
编写于
1月 08, 2018
作者:
K
Kevin Heifner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pulled mongo db_plugin over.
Quick mods to make it compile. #1047
上级
3c8d979d
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
883 addition
and
0 deletion
+883
-0
plugins/CMakeLists.txt
plugins/CMakeLists.txt
+1
-0
plugins/mongo_db_plugin/CMakeLists.txt
plugins/mongo_db_plugin/CMakeLists.txt
+75
-0
plugins/mongo_db_plugin/db_plugin.cpp
plugins/mongo_db_plugin/db_plugin.cpp
+753
-0
plugins/mongo_db_plugin/include/eosio/db_plugin/db_plugin.hpp
...ins/mongo_db_plugin/include/eosio/db_plugin/db_plugin.hpp
+54
-0
未找到文件。
plugins/CMakeLists.txt
浏览文件 @
ab3306ac
...
...
@@ -9,5 +9,6 @@ add_subdirectory(account_history_plugin)
add_subdirectory
(
account_history_api_plugin
)
add_subdirectory
(
wallet_plugin
)
add_subdirectory
(
wallet_api_plugin
)
add_subdirectory
(
mongo_db_plugin
)
add_subdirectory
(
txn_test_gen_plugin
)
add_subdirectory
(
faucet_testnet_plugin
)
plugins/mongo_db_plugin/CMakeLists.txt
0 → 100644
浏览文件 @
ab3306ac
file
(
GLOB HEADERS
"include/eos/db_plugin/*.hpp"
)
add_library
(
db_plugin
db_plugin.cpp
${
HEADERS
}
)
find_package
(
libmongoc-1.0 1.8
)
if
(
libmongoc-1.0_FOUND
)
# EOS has no direct dependencies on libmongoc but its shared libraries
# will need to be present at runtime for the C++ libraries we use:
# libbsoncxx & libmongocxx (both from github.com/mongodb/mongo-cxx-driver)
# The *.cmake package files provided by mongo-cxx-driver don't give us the
# absolute path to the libraries, which is needed whenever they are not
# installed in system-known locations. CMake requires the absolute paths
# in target_link_libraries() since we are builiding an archive and the
# link step for all executables using this archive must include the
# mongo-cxx-driver libraries libmongocxx and libbsoncxx.
find_package
(
libbsoncxx REQUIRED
)
message
(
STATUS
"Found bsoncxx headers:
${
LIBBSONCXX_INCLUDE_DIRS
}
"
)
find_library
(
EOS_LIBBSONCXX
${
LIBBSONCXX_LIBRARIES
}
PATHS
${
LIBBSONCXX_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
message
(
STATUS
"Found bsoncxx library:
${
EOS_LIBBSONCXX
}
"
)
find_package
(
libmongocxx REQUIRED
)
message
(
STATUS
"Found mongocxx headers:
${
LIBMONGOCXX_INCLUDE_DIRS
}
"
)
find_library
(
EOS_LIBMONGOCXX
${
LIBMONGOCXX_LIBRARIES
}
PATHS
${
LIBMONGOCXX_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
message
(
STATUS
"Found mongocxx library:
${
EOS_LIBMONGOCXX
}
"
)
add_definitions
(
-DMONGODB
)
else
()
message
(
"Could NOT find MongoDB. db_plugin with MongoDB support will not be included."
)
# sudo apt-get install pkg-config libssl-dev libsasl2-dev
# wget https://github.com/mongodb/mongo-c-driver/releases/download/1.8.0/mongo-c-driver-1.8.0.tar.gz
# tar xzf mongo-c-driver-1.8.0.tar.gz
# cd mongo-c-driver-1.8.0
# ./configure --disable-automatic-init-and-cleanup --enable-static
# make
# sudo make install
#
# git clone https://github.com/mongodb/mongo-cxx-driver.git --branch releases/stable --depth 1
# cd mongo-cxx-driver/build
# cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
# sudo make EP_mnmlstc_core
# make
# sudo make install
#
# sudo apt-get install mongodb
endif
()
target_include_directories
(
db_plugin
PRIVATE
${
LIBMONGOCXX_INCLUDE_DIRS
}
${
LIBBSONCXX_INCLUDE_DIRS
}
PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
)
target_compile_definitions
(
db_plugin
PRIVATE
${
LIBMONGOCXX_DEFINITIONS
}
${
LIBBSONCXX_DEFINITIONS
}
)
target_link_libraries
(
db_plugin
PUBLIC chain_plugin eos_chain appbase
${
EOS_LIBMONGOCXX
}
${
EOS_LIBBSONCXX
}
)
install
(
TARGETS
db_plugin
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install
(
FILES
${
HEADERS
}
DESTINATION
"include/eos/db_plugin"
)
plugins/mongo_db_plugin/db_plugin.cpp
0 → 100644
浏览文件 @
ab3306ac
此差异已折叠。
点击以展开。
plugins/mongo_db_plugin/include/eosio/db_plugin/db_plugin.hpp
0 → 100644
浏览文件 @
ab3306ac
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#pragma once
#include <eosio/chain_plugin/chain_plugin.hpp>
#include <appbase/application.hpp>
#include <memory>
namespace
eosio
{
using
db_plugin_impl_ptr
=
std
::
shared_ptr
<
class
db_plugin_impl
>
;
/**
* Provides persistence to MongoDB for:
* Blocks
* Transactions
* Messages
* Accounts
*
* See data dictionary (DB Schema Definition - EOS API) for description of MongoDB schema.
*
* The goal ultimately is for all chainbase data to be mirrored in MongoDB via a delayed node processing
* irreversible blocks. Currently, only Blocks, Transactions, Messages, and Account balance it mirrored.
* Chainbase is being rewritten to be multi-threaded. Once chainbase is stable, integration directly with
* a mirror database approach can be followed removing the need for the direct processing of Blocks employed
* with this implementation.
*
* If MongoDB env not available (#ifndef MONGODB) this plugin is a no-op.
*/
class
db_plugin
:
public
plugin
<
db_plugin
>
{
public:
APPBASE_PLUGIN_REQUIRES
((
chain_plugin
))
db_plugin
();
virtual
~
db_plugin
();
virtual
void
set_program_options
(
options_description
&
cli
,
options_description
&
cfg
)
override
;
// This may only be called after plugin_initialize() and before plugin_startup()!
void
wipe_database
();
void
applied_irreversible_block
(
const
chain
::
signed_block
&
block
);
void
plugin_initialize
(
const
variables_map
&
options
);
void
plugin_startup
();
void
plugin_shutdown
();
private:
db_plugin_impl_ptr
my
;
};
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录