-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the query_txid_plugin as a option on the develop branch #1957
Open
bijianing97
wants to merge
19
commits into
bitshares:develop
Choose a base branch
from
bijianing97:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
475a90a
Add the query_txid_plugin as a option on the develop branch
lelecommit f28c61c
Add the query_txid_plugin as a option on the develop branch
lelecommit a16942d
Add the query_txid_plugin as a option on the develop branch
lelecommit 32ba6bb
Add the query_txid_plugin as a option on the develop branch
lelecommit 975a7be
modify the indentation size and delete the error file
lelecommit 47e635e
delete the message
lelecommit 40228db
modify bulid option and fix the warning about the signed and unsigned…
lelecommit b577812
modify the message
lelecommit 33fa8ca
Merge branch 'develop' of https://github.com/bitshares/bitshares-core…
lelecommit 35a77a8
open the plugin for docker and travis ,revise opinions
lelecommit 79727a8
open the plugin for docker and travis ,revise opinions
lelecommit cd8729d
open the plugin for docker and travis ,revise opinions
lelecommit 50d0d76
open the plugin for docker and travis ,revise opinions
lelecommit 1d02766
open the plugin for docker and travis ,revise opinions
lelecommit cc17f4c
open the plugin for docker and travis ,revise opinions
lelecommit 24ff177
open the plugin for docker and travis ,revise opinions
lelecommit a853490
open the plugin for docker and travis ,revise opinions
lelecommit c1dafec
change the docker and travis.yml
lelecommit 3be7ee2
change the docker and travis.yml
lelecommit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
62 changes: 62 additions & 0 deletions
62
libraries/chain/include/graphene/chain/transaction_entry_object.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,62 @@ | ||
/* | ||
pmconrad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Copyright (c) 2019 GXChain and zhaoxiangfei、bijianing97 . | ||
* | ||
* The MIT License | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
#pragma once | ||
#include <graphene/db/object.hpp> | ||
#include <graphene/protocol/types.hpp> | ||
oxarbitrage marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include <boost/multi_index/composite_key.hpp> | ||
|
||
namespace graphene { namespace chain { | ||
|
||
class trx_entry_object : public abstract_object<trx_entry_object> | ||
{ | ||
public: | ||
static const uint8_t space_id = implementation_ids; | ||
pmconrad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static const uint8_t type_id = impl_trx_entry_history_object_type; | ||
|
||
trx_entry_object(){} | ||
|
||
transaction_id_type txid; | ||
uint32_t block_num; | ||
uint32_t trx_in_block; | ||
}; | ||
|
||
struct by_txid; | ||
struct by_blocknum; | ||
|
||
typedef multi_index_container< | ||
trx_entry_object, | ||
indexed_by< | ||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >, | ||
ordered_unique< tag<by_txid>, member< trx_entry_object, transaction_id_type, &trx_entry_object::txid > >, | ||
ordered_non_unique< tag<by_blocknum>, member< trx_entry_object, uint32_t, &trx_entry_object::block_num > > | ||
> | ||
|
||
> trx_entry_multi_index_type; | ||
|
||
typedef generic_index<trx_entry_object, trx_entry_multi_index_type> trx_entry_index; | ||
|
||
} } // graphene::chain | ||
|
||
FC_REFLECT_DERIVED( graphene::chain::trx_entry_object, (graphene::chain::object), | ||
(txid)(block_num)(trx_in_block)) |
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,23 @@ | ||
file(GLOB HEADERS "include/graphene/query_txid/*.hpp") | ||
|
||
add_library( graphene_query_txid | ||
query_txid_plugin.cpp | ||
) | ||
find_path(LevelDB_INCLUDE_PATH NAMES leveldb/db.h leveldb/write_batch.h) | ||
find_library(LevelDB_LIBRARY NAMES libleveldb.a) | ||
find_library(Snappy_LIBRARY NAMES libsnappy.a) | ||
|
||
if(LevelDB_INCLUDE_PATH AND LevelDB_LIBRARY AND Snappy_LIBRARY) | ||
target_link_libraries( graphene_query_txid graphene_chain graphene_app ${LevelDB_LIBRARY} ${Snappy_LIBRARY}) | ||
target_include_directories( graphene_query_txid | ||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ${LevelDB_INCLUDE_PATH}) | ||
install( TARGETS | ||
graphene_query_txid | ||
|
||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) | ||
else(LevelDB_INCLUDE_PATH AND LevelDB_LIBRARY AND Snappy_LIBRARY) | ||
message(FATAL_ERROR "You need leveldb and snappy") | ||
endif() |
58 changes: 58 additions & 0 deletions
58
libraries/plugins/query_txid/include/graphene/query_txid/query_txid_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,58 @@ | ||
/* | ||
* Copyright (c) 2019 GXChain and zhaoxiangfei、bijianing97 . | ||
* | ||
* The MIT License | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
#pragma once | ||
oxarbitrage marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include <graphene/app/plugin.hpp> | ||
#include <graphene/chain/transaction_entry_object.hpp> | ||
#include <graphene/chain/database.hpp> | ||
namespace graphene | ||
oxarbitrage marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
namespace query_txid | ||
{ | ||
using namespace chain; | ||
namespace detail | ||
{ | ||
class query_txid_plugin_impl; | ||
} | ||
class query_txid_plugin : public graphene::app::plugin | ||
{ | ||
public: | ||
query_txid_plugin(); | ||
virtual ~query_txid_plugin(); | ||
|
||
std::string plugin_name() const override; | ||
|
||
virtual void plugin_set_program_options( | ||
boost::program_options::options_description &cli, | ||
boost::program_options::options_description &cfg) override; | ||
|
||
virtual void plugin_initialize(const boost::program_options::variables_map &options) override; | ||
virtual void plugin_startup() override; | ||
|
||
static optional<trx_entry_object> query_trx_by_id(std::string txid); | ||
|
||
friend class detail::query_txid_plugin_impl; | ||
|
||
std::unique_ptr<detail::query_txid_plugin_impl> my; | ||
}; | ||
} }// graphene::query_txid |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the plugin is not enabled the method doesn't return anything. IMO it should throw.