[wip] feat: add mango-based VDU endpoints
Overview
This work-in-progress PR tracks my efforts to implement features described in https://github.com/apache/couchdb/issues/1554 namely Mango-based update handlers under the /{db}/_update endpoint.
As of this writing, I have scaffolded only a few functions and have written no tests. I'm mainly fumbling around, copying code from where it seems to make sense, in anticipation of further guidance.
As described in the issue thread, this PR attempts to implement the following endpoints:
-
GET /{db/_update: Retrieve a database's update handlers, similar toGET /{db}/_index. -
POST /{db}/_update: Submit a document for validation. If it passes validation, the update is accepted. Otherwise, it is rejected. -
PUT /{db}/_update: Create a new update handler. -
DELETE /{db}/_update: Delete an update handler.
Although not yet in the code, I expect update handlers to have at least two attributes: a guard selector, which indicates which documents this handler applies to; and a condition selector, which validates the document. If a document passes the guard selector but not the condition selector, it is rejected. If a document submitted for validation matches no known guard selectors, it should be rejected too.
Testing recommendations
As of this writing, there are no tests in this PR.
Related Issues or Pull Requests
- https://github.com/apache/couchdb/issues/1554
Checklist
- [ ] Code is written and works correctly;
- [ ] Changes are covered by tests;
- [ ] Documentation reflects the changes;
@garbados Any progress on this PR? I am preparing to mass-close old PRs that never got merged.