Skip to content

Commit

Permalink
Merge pull request #30 from soramitsu/develop
Browse files Browse the repository at this point in the history
Running aeron
  • Loading branch information
MizukiSonoko committed Oct 18, 2016
2 parents f4fc235 + 10dc7a1 commit 59f021a
Show file tree
Hide file tree
Showing 34 changed files with 486 additions and 218 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@
[submodule "core/vendor/json"]
path = core/vendor/json
url = https://github.com/nlohmann/json.git
[submodule "core/vendor/Agrona"]
path = core/vendor/Agrona
url = https://github.com/real-logic/Agrona.git
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Please include a developer certificate with pull requests: http://developercerti
│   ├── connection
│   ├── consensus
│   ├── crypto
│   ├── domain
│   ├── model
│   │   └── transactions
│   ├── infra
│   │   ├── connection
Expand Down
7 changes: 5 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ machine:
environment:
IROHA_HOME: $(pwd)/iroha
PATH: $PATH:/opt/cmake-3.5.2-Linux-x86_64/bin
JAVA_HOME: /usr/lib/jvm/java-7-openjdk-amd64
JAVA_HOME: /usr/lib/jvm/java-1.8.0-openjdk-amd64/
java:
version: 'oraclejdk8'
pre:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
Expand All @@ -28,7 +30,8 @@ checkout:
- cd $IROHA_HOME
- git submodule init
- git submodule update
- cd $IROHA_HOME/core/vendor/Aeron; ./gradlew; mkdir -p cppbuild/Debug; cd cppbuild/Debug; cmake ../..; cmake --build . --clean-first; ctest
- cd $IROHA_HOME/core/vendor/Agrona; ./gradlew
- cd $IROHA_HOME/core/vendor/Aeron; ./gradlew; mkdir -p cppbuild/Debug; cd cppbuild/Debug; cmake ../..; cmake --build . --clean-first
- cd $IROHA_HOME/core/vendor/leveldb; make
- cd $IROHA_HOME/core/vendor/ed25519; make
- cd $IROHA_HOME/core/vendor/KeccakCodePackage; make; make generic64/libkeccak.a
Expand Down
1 change: 1 addition & 0 deletions config/private.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
qPmAAEz/eQiL6VlNau2GPHf3kdRW2lRiGceUgXk51F8Fr4CAzG2zGQ0Xp6yXjL0Nnocg38xLePOKTb9SciGypg==
1 change: 1 addition & 0 deletions config/public.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5mE1Ynmr1kDy1iDCvtHRqaCXWeUdXbPrPZa4aP/ri1o=
1 change: 1 addition & 0 deletions core/consensus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ADD_LIBRARY(sumeragi STATIC
consensus_event.cpp
)
target_link_libraries(sumeragi
event_repository
crypto
yaml_loader
validator
Expand Down
3 changes: 2 additions & 1 deletion core/consensus/connection/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
#include <functional>

namespace connection {
void initialize_peer(std::unordered_map<std::string, std::string> config);
void initialize_peer(const std::unordered_map<std::string, std::string>& config);

bool sendAll(std::string message);
bool send(std::string to, std::string message);
bool receive(std::function<void(std::string from, std::string message)> callback);

}; // end connection

#endif
4 changes: 4 additions & 0 deletions core/consensus/consensus_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ struct ConsensusEvent {
std::string merkleRoot;
std::vector<std::string> merkleRootSignatures;

ConsensusEvent(std::unique_ptr<abstract_transaction::AbstractTransaction> tx){

}

void addSignature(const std::string& signature);
std::string getHash() const;
};
Expand Down
13 changes: 13 additions & 0 deletions core/consensus/sumeragi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "../util/logger.hpp"
#include "../repository/consensus/merkle_transaction_repository.hpp"
#include "../repository/consensus/event_repository.hpp"
#include "../model/transactions/abstract_transaction.hpp"
#include "../crypto/hash.hpp"
#include "../crypto/signature.hpp"
Expand Down Expand Up @@ -173,8 +174,20 @@ void determineConsensusOrder(const std::unique_ptr<ConsensusEvent>& event/*, std
void loop() {
logger::info("sumeragi","start main loop");
while (true) { // TODO(M->M): replace with callback linking aeron

if(!repository::event::empty()){
std::vector<
std::unique_ptr<abstract_transaction::AbstractTransaction>
> txs = repository::event::findAll();
for(auto& tx : txs){
// How to convert AbstractTransaction to Consensus Event?
// context->eventCache.push( consensus_event );
}
}

if (!context->eventCache.empty()) { //TODO: mutex here?
std::unique_ptr<ConsensusEvent> event = std::move(context->eventCache.front());
context->eventCache.pop();
if (!transaction_validator::isValid(*event->tx)) {
continue;
}
Expand Down
1 change: 1 addition & 0 deletions core/infra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ add_subdirectory(crypto)
add_subdirectory(repository)
add_subdirectory(server)
add_subdirectory(connection)
add_subdirectory(util)

0 comments on commit 59f021a

Please sign in to comment.