Some of the singular queries are there to select a small sub-object (like FindXxxMetadata queries). A solution is needed for the iterable queries to do the same.
Solution
A projection system, which allows one to query a sub-object (or multiple sub-objects) of the query. This is done by sending a query selector along with the predicate.
Changes
Predicates are now split into atomic predicates and projections
The projections are shared with the selectors. The accept a Marker type parameter to determine which kind of object they should store inside
more macros (than in older predicates impl), should be easier to modify the data model. The predicates, prototypes and projections are now all in one place too.
Ast predicates are removed, prototype helper methods now return CompoundPredicates directly
CompoundPredicate's generic now accepts the predicated type and not the predicate type itself
Some prototype fields were renamed to be in line with the names in the data model
Migration Guide
Other than some odd renames, regular rust SDK code should not be affected
The SDKs will require updates for the refactored predicates
Review notes
As with #4833, I tried documenting the system as a whole in iroha_data_model::query::dsl module documentation, so this might be a good place to start to understand the system.
An example use of the API can be found in the smart_contract_can_filter_queries integration test.
Each of the commit represents a logical step towards implementing the new query system. I ensured the tests would pass between those. This might make it easier to review the commits separately than in one big clump.
Context
Closes #5063. Helps to continue #4933.
Some of the singular queries are there to select a small sub-object (like
FindXxxMetadata
queries). A solution is needed for the iterable queries to do the same.Solution
A projection system, which allows one to query a sub-object (or multiple sub-objects) of the query. This is done by sending a query selector along with the predicate.
Changes
Marker
type parameter to determine which kind of object they should store insideCompoundPredicates
directlyCompoundPredicate
's generic now accepts the predicated type and not the predicate type itselfMigration Guide
Review notes
As with #4833, I tried documenting the system as a whole in
iroha_data_model::query::dsl
module documentation, so this might be a good place to start to understand the system.An example use of the API can be found in the
smart_contract_can_filter_queries
integration test.Each of the commit represents a logical step towards implementing the new query system. I ensured the tests would pass between those. This might make it easier to review the commits separately than in one big clump.
Checklist
CONTRIBUTING.md
.