...
- Criteria
- CriteriaBuilder (or Criteria.Builder)
Effects on Thrift API
...
- Add a TCriteria struct (this must be wrapped by the Criteria object in the public api)
- Must deprecated or change the current #find() method
- Implement #find() method or new method that takes a Criteria as a param (i.e. set<i64> find0(data.Criteria criteria))
- Make sure that ConcourseServer takes simple queries and turns them to a Criteria and sends them to the appropriate thrift ConcourseService method.
Important Questions and Semantics
- Should the appropriate processing and post-filtering for a complex find be done client or server side?
- We should probably do this on the server so that these queries are performant. I'm really concerned about all the network overhead of the client sending multiple separate queries over the wire.
- If this is done on the client, then complex queries are somewhat analogous to a compound operation
- This means that our results can become invalid if a spurious write changes the data in between network calls
- Example: Assume my criteria is find all records where "name = 'John' AND age = 23". If the client has to do separate calls and post filter the results then its possible a record that matches the first query can be changed to no longer match the first query after the result is returned and the client moves onto the second query.
- This means that our results can become invalid if a spurious write changes the data in between network calls
- If this is done on the server, the complex query is analogous to a repeatable atomic operation
- Should we deprecate the #find methods that take simple parameters?
- No: Builders are inherently not user friendly so we should not force the user to use one of a simple query
- Yes: Overloaded methods that take different kinds of parameters is bad API design
- Why a programatic builder as opposed to a grammar parser?
- Don't trust raw string input from users. We can regulate things a lot more if this is done programmatically with a builder.
- This project may form the basis of a larger database language (e.g. Concourse Action Language (CAL))
- This means that we need to write this feature in a way that can easily be leveraged and extended in the future
...