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#738 from hyperledger/feature/sha…
…red_model_queries
- Loading branch information
Showing
19 changed files
with
617 additions
and
81 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
71 changes: 71 additions & 0 deletions
71
shared_model/backend/protobuf/queries/proto_get_account_asset_transactions.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,71 @@ | ||
/** | ||
* 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_GET_ACCOUNT_ASSET_TRANSACTIONS_H | ||
#define IROHA_GET_ACCOUNT_ASSET_TRANSACTIONS_H | ||
|
||
#include "interfaces/queries/get_account_transactions.hpp" | ||
|
||
#include "queries.pb.h" | ||
#include "utils/lazy_initializer.hpp" | ||
#include "utils/reference_holder.hpp" | ||
|
||
namespace shared_model { | ||
namespace proto { | ||
class GetAccountAssetTransactions final | ||
: public CopyableProto<interface::GetAccountAssetTransactions, | ||
iroha::protocol::Query, | ||
GetAccountAssetTransactions> { | ||
public: | ||
template <typename QueryType> | ||
explicit GetAccountAssetTransactions(QueryType &&query) | ||
: CopyableProto(std::forward<QueryType>(query)), | ||
account_id_(detail::makeReferenceGenerator( | ||
&proto_->payload(), | ||
&iroha::protocol::Query::Payload::get_account_transactions)), | ||
asset_id_(detail::makeReferenceGenerator( | ||
&proto_->payload(), | ||
&iroha::protocol::Query::Payload::get_account_assets)) {} | ||
|
||
GetAccountAssetTransactions(const GetAccountAssetTransactions &o) | ||
: GetAccountAssetTransactions(o.proto_) {} | ||
|
||
GetAccountAssetTransactions(GetAccountAssetTransactions &&o) noexcept | ||
: GetAccountAssetTransactions(std::move(o.proto_)) {} | ||
|
||
const interface::types::AccountIdType &accountId() const override { | ||
return account_id_->account_id(); | ||
} | ||
|
||
const interface::types::AssetIdType &assetId() const override { | ||
return asset_id_->asset_id(); | ||
} | ||
|
||
private: | ||
// ------------------------------| fields |------------------------------- | ||
|
||
template <typename T> | ||
using Lazy = detail::LazyInitializer<T>; | ||
|
||
const Lazy<const iroha::protocol::GetAccountTransactions &> account_id_; | ||
const Lazy<const iroha::protocol::GetAccountAssets &> asset_id_; | ||
}; | ||
|
||
} // namespace proto | ||
} // namespace shared_model | ||
|
||
#endif // IROHA_GET_ACCOUNT_ASSET_TRANSACTIONS_H |
71 changes: 71 additions & 0 deletions
71
shared_model/backend/protobuf/queries/proto_get_account_assets.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,71 @@ | ||
/** | ||
* 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_PROTO_GET_ACCOUNT_ASSETS_H | ||
#define IROHA_PROTO_GET_ACCOUNT_ASSETS_H | ||
|
||
#include "interfaces/queries/get_account_assets.hpp" | ||
|
||
#include "queries.pb.h" | ||
#include "utils/lazy_initializer.hpp" | ||
#include "utils/reference_holder.hpp" | ||
|
||
namespace shared_model { | ||
namespace proto { | ||
class GetAccountAssets final | ||
: public CopyableProto<interface::GetAccountAssets, | ||
iroha::protocol::Query, | ||
GetAccountAssets> { | ||
public: | ||
template <typename QueryType> | ||
explicit GetAccountAssets(QueryType &&query) | ||
: CopyableProto(std::forward<QueryType>(query)), | ||
account_id_(detail::makeReferenceGenerator( | ||
&proto_->payload(), | ||
&iroha::protocol::Query::Payload::get_account)), | ||
asset_id_(detail::makeReferenceGenerator( | ||
&proto_->payload(), | ||
&iroha::protocol::Query::Payload::get_account_assets)) {} | ||
|
||
GetAccountAssets(const GetAccountAssets &o) | ||
: GetAccountAssets(o.proto_) {} | ||
|
||
GetAccountAssets(GetAccountAssets &&o) noexcept | ||
: GetAccountAssets(std::move(o.proto_)) {} | ||
|
||
const interface::types::AccountIdType &accountId() const override { | ||
return account_id_->account_id(); | ||
} | ||
|
||
const interface::types::AssetIdType &assetId() const override { | ||
return asset_id_->asset_id(); | ||
} | ||
|
||
private: | ||
// ------------------------------| fields |------------------------------- | ||
|
||
template <typename T> | ||
using Lazy = detail::LazyInitializer<T>; | ||
|
||
const Lazy<const iroha::protocol::GetAccount &> account_id_; | ||
const Lazy<const iroha::protocol::GetAccountAssets &> asset_id_; | ||
}; | ||
|
||
} // namespace proto | ||
} // namespace shared_model | ||
|
||
#endif // IROHA_PROTO_GET_ACCOUNT_ASSETS_H |
63 changes: 63 additions & 0 deletions
63
shared_model/backend/protobuf/queries/proto_get_account_transactions.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,63 @@ | ||
/** | ||
* 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_GET_ACCOUNT_TRANSACTIONS_H | ||
#define IROHA_GET_ACCOUNT_TRANSACTIONS_H | ||
|
||
#include "interfaces/queries/get_account_transactions.hpp" | ||
|
||
#include "queries.pb.h" | ||
#include "utils/lazy_initializer.hpp" | ||
#include "utils/reference_holder.hpp" | ||
|
||
namespace shared_model { | ||
namespace proto { | ||
class GetAccountTransactions final | ||
: public CopyableProto<interface::GetAccountTransactions, | ||
iroha::protocol::Query, | ||
GetAccountTransactions> { | ||
public: | ||
template <typename QueryType> | ||
explicit GetAccountTransactions(QueryType &&query) | ||
: CopyableProto(std::forward<QueryType>(query)), | ||
account_id_(detail::makeReferenceGenerator( | ||
&proto_->payload(), | ||
&iroha::protocol::Query::Payload::get_account_transactions)) {} | ||
|
||
GetAccountTransactions(const GetAccountTransactions &o) | ||
: GetAccountTransactions(o.proto_) {} | ||
|
||
GetAccountTransactions(GetAccountTransactions &&o) noexcept | ||
: GetAccountTransactions(std::move(o.proto_)) {} | ||
|
||
const interface::types::AccountIdType &accountId() const override { | ||
return account_id_->account_id(); | ||
} | ||
|
||
private: | ||
// ------------------------------| fields |------------------------------- | ||
|
||
template <typename T> | ||
using Lazy = detail::LazyInitializer<T>; | ||
|
||
const Lazy<const iroha::protocol::GetAccountTransactions &> account_id_; | ||
}; | ||
|
||
} // namespace proto | ||
} // namespace shared_model | ||
|
||
#endif // IROHA_GET_ACCOUNT_TRANSACTIONS_H |
58 changes: 58 additions & 0 deletions
58
shared_model/backend/protobuf/queries/proto_get_asset_info.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 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_PROTO_GET_ASSET_INFO_H | ||
#define IROHA_PROTO_GET_ASSET_INFO_H | ||
|
||
#include "interfaces/queries/get_asset_info.hpp" | ||
|
||
#include "queries.pb.h" | ||
#include "utils/lazy_initializer.hpp" | ||
#include "utils/reference_holder.hpp" | ||
|
||
namespace shared_model { | ||
namespace proto { | ||
class GetAssetInfo final : public CopyableProto<interface::GetAssetInfo, | ||
iroha::protocol::Query, | ||
GetAssetInfo> { | ||
public: | ||
template <typename QueryType> | ||
explicit GetAssetInfo(QueryType &&query) | ||
: CopyableProto(std::forward<QueryType>(query)), | ||
asset_id_(detail::makeReferenceGenerator( | ||
&proto_->payload(), | ||
&iroha::protocol::Query::Payload::get_asset_info)) {} | ||
|
||
GetAssetInfo(const GetAssetInfo &o) : GetAssetInfo(o.proto_) {} | ||
|
||
GetAssetInfo(GetAssetInfo &&o) noexcept | ||
: GetAssetInfo(std::move(o.proto_)) {} | ||
|
||
const interface::types::AssetIdType &assetId() const override { | ||
return asset_id_->asset_id(); | ||
} | ||
|
||
private: | ||
// ------------------------------| fields |------------------------------- | ||
const detail::LazyInitializer<const iroha::protocol::GetAssetInfo &> | ||
asset_id_; | ||
}; | ||
|
||
} // namespace proto | ||
} // namespace shared_model | ||
|
||
#endif // IROHA_PROTO_GET_ASSET_INFO_H |
60 changes: 60 additions & 0 deletions
60
shared_model/backend/protobuf/queries/proto_get_role_permissions.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,60 @@ | ||
/** | ||
* 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_PROTO_GET_ROLE_PERMISSIONS_H | ||
#define IROHA_PROTO_GET_ROLE_PERMISSIONS_H | ||
|
||
#include "interfaces/queries/get_role_permissions.hpp" | ||
|
||
#include "queries.pb.h" | ||
#include "utils/lazy_initializer.hpp" | ||
#include "utils/reference_holder.hpp" | ||
|
||
namespace shared_model { | ||
namespace proto { | ||
class GetRolePermissions final | ||
: public CopyableProto<interface::GetRolePermissions, | ||
iroha::protocol::Query, | ||
GetRolePermissions> { | ||
public: | ||
template <typename QueryType> | ||
explicit GetRolePermissions(QueryType &&query) | ||
: CopyableProto(std::forward<QueryType>(query)), | ||
role_id_(detail::makeReferenceGenerator( | ||
&proto_->payload(), | ||
&iroha::protocol::Query::Payload::get_role_permissions)) {} | ||
|
||
GetRolePermissions(const GetRolePermissions &o) | ||
: GetRolePermissions(o.proto_) {} | ||
|
||
GetRolePermissions(GetRolePermissions &&o) noexcept | ||
: GetRolePermissions(std::move(o.proto_)) {} | ||
|
||
const interface::types::RoleIdType &roleId() const override { | ||
return role_id_->role_id(); | ||
} | ||
|
||
private: | ||
// ------------------------------| fields |------------------------------- | ||
const detail::LazyInitializer<const iroha::protocol::GetRolePermissions &> | ||
role_id_; | ||
}; | ||
|
||
} // namespace proto | ||
} // namespace shared_model | ||
|
||
#endif // IROHA_PROTO_GET_ROLE_PERMISSIONS_H |
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,45 @@ | ||
/** | ||
* 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_PROTO_GET_ROLES_H | ||
#define IROHA_PROTO_GET_ROLES_H | ||
|
||
#include "interfaces/queries/get_roles.hpp" | ||
|
||
#include "queries.pb.h" | ||
#include "utils/lazy_initializer.hpp" | ||
#include "utils/reference_holder.hpp" | ||
|
||
namespace shared_model { | ||
namespace proto { | ||
class GetRoles final : public CopyableProto<interface::GetRoles, | ||
iroha::protocol::Query, | ||
GetRoles> { | ||
public: | ||
template <typename QueryType> | ||
explicit GetRoles(QueryType &&query) | ||
: CopyableProto(std::forward<QueryType>(query)) {} | ||
|
||
GetRoles(const GetRoles &o) : GetRoles(o.proto_) {} | ||
|
||
GetRoles(GetRoles &&o) noexcept : GetRoles(std::move(o.proto_)) {} | ||
}; | ||
|
||
} // namespace proto | ||
} // namespace shared_model | ||
|
||
#endif // IROHA_PROTO_GET_ROLES_H |
Oops, something went wrong.