forked from hyperledger-iroha/iroha-dco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hyperledger-iroha#391 from hyperledger/feature/cli…
…ent-interfaces Client interfaces
- Loading branch information
Showing
11 changed files
with
314 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
add_library(torii | ||
impl/processor.cpp | ||
) | ||
|
||
target_link_libraries(torii PUBLIC | ||
dao | ||
rxcpp | ||
) |
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,35 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef IROHA_CLIENT_PROCESSOR_HPP | ||
#define IROHA_CLIENT_PROCESSOR_HPP | ||
|
||
#include "query_processor.hpp" | ||
#include "transaction_processor.hpp" | ||
|
||
namespace iroha { | ||
namespace torii { | ||
|
||
/** | ||
* Client processor is interface | ||
* for processing all user's intents in the system | ||
*/ | ||
class ClientProcessor : public QueryProcessor, public TransactionProcessor { | ||
}; | ||
} //namespace torii | ||
} //namespace iroha | ||
#endif //IROHA_CLIENT_PROCESSOR_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,18 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <torii/client_processor.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,49 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef IROHA_QUERY_PROCESSOR_HPP | ||
#define IROHA_QUERY_PROCESSOR_HPP | ||
|
||
#include <dao/dao.hpp> | ||
#include <rxcpp/rx.hpp> | ||
|
||
namespace iroha { | ||
namespace torii { | ||
|
||
/** | ||
* QueryProcessor provides start point for queries in the whole system | ||
*/ | ||
class QueryProcessor { | ||
public: | ||
|
||
/** | ||
* Register client query | ||
* @param client - query emitter | ||
* @param query - client intent | ||
*/ | ||
virtual void handle(dao::Client client, dao::Query query) = 0; | ||
|
||
/** | ||
* Subscribe for query responses | ||
* @return observable with query responses | ||
*/ | ||
virtual rxcpp::observable <dao::QueryResponse> notifier() = 0; | ||
}; | ||
} //namespace torii | ||
} //namespace iroha | ||
|
||
#endif //IROHA_QUERY_PROCESSOR_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,49 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef IROHA_TRANSACTION_PROCESSOR_HPP | ||
#define IROHA_TRANSACTION_PROCESSOR_HPP | ||
|
||
#include <dao/dao.hpp> | ||
#include <rxcpp/rx.hpp> | ||
|
||
namespace iroha { | ||
namespace torii { | ||
|
||
/** | ||
* Transaction processor is interface with start point | ||
* for processing transaction in the system | ||
*/ | ||
class TransactionProcessor { | ||
public: | ||
|
||
/** | ||
* Add transaction to the system for processing | ||
* @param client - transaction owner | ||
* @param transaction - transaction for processing | ||
*/ | ||
virtual void handle(dao::Client client, dao::Transaction transaction) = 0; | ||
|
||
/** | ||
* Subscribes will be notified with transaction status | ||
* @return observable for subscribing | ||
*/ | ||
virtual rxcpp::observable <dao::TransactionResponse> notifier() = 0; | ||
}; | ||
} //namespace torii | ||
} //namespace iroha | ||
#endif //IROHA_TRANSACTION_PROCESSOR_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,31 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef IROHA_CLIENT_HPP | ||
#define IROHA_CLIENT_HPP | ||
namespace iroha { | ||
namespace dao { | ||
|
||
/** | ||
* Client is representation of user in system | ||
*/ | ||
struct Client { | ||
|
||
}; | ||
} | ||
} | ||
#endif //IROHA_CLIENT_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
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,31 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef IROHA_QUERY_HPP | ||
#define IROHA_QUERY_HPP | ||
namespace iroha { | ||
namespace dao { | ||
/** | ||
* This dao represents user intent for reading ledger. | ||
* Concrete queries should extend this interface. | ||
*/ | ||
struct Query { | ||
|
||
}; | ||
} //namespace dao | ||
} //namespace iroha | ||
#endif //IROHA_QUERY_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,43 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef IROHA_QUERY_RESPONSE_HPP | ||
#define IROHA_QUERY_RESPONSE_HPP | ||
|
||
#include "query.hpp" | ||
#include "client.hpp" | ||
|
||
namespace iroha { | ||
namespace dao { | ||
/** | ||
* Interface of query response for user | ||
*/ | ||
struct QueryResponse { | ||
|
||
/** | ||
* Client query | ||
*/ | ||
Query query; | ||
|
||
/** | ||
* Client identifier | ||
*/ | ||
Client client; | ||
}; | ||
} //namespace dao | ||
} //namespace iroha | ||
#endif //IROHA_QUERY_RESPONSE_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,44 @@ | ||
/** | ||
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. | ||
* http://soramitsu.co.jp | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef IROHA_TRANSACTION_RESPONSE_HPP | ||
#define IROHA_TRANSACTION_RESPONSE_HPP | ||
|
||
#include "transaction.hpp" | ||
#include "client.hpp" | ||
|
||
namespace iroha { | ||
namespace dao { | ||
|
||
/** | ||
* Transaction response is data with status during transaction lifecycle | ||
*/ | ||
struct TransactionResponse { | ||
|
||
/** | ||
* Processed transaction | ||
*/ | ||
Transaction transaction; | ||
|
||
/** | ||
* Transaction emitter | ||
*/ | ||
Client client; | ||
}; | ||
} //namespace dao | ||
} //namespace iroha | ||
#endif //IROHA_TRANSACTION_RESPONSE_HPP |