fluree / db

Fluree database library
https://fluree.github.io/db/
Other
330 stars 21 forks source link

split the db apis to allow constraining by passed in opts vs. wrapping dbs #814

Open jakep36 opened 1 week ago

jakep36 commented 1 week ago

Add db api or reuse existing to allow an opts map to determine policies used, inferencing, etc. This will allow systems built for stateless requests (i.e. server or nexus-query-server) to utilize the wrapping or constraining functionality available to users of the db library.

(requirement details) ....

bplatz commented 1 week ago

Goals are:

a) stateful query API where you can pass a db/ds that is already permissioned, time-traveled and/or reasoned. It does not need to do a bunch of logic to check these things. I propose the API for this is (fluree/q ...)

b) a "stateless" query API for use by REST, etc. that supports an option map to define reasoning, policy, time-travel where the work of getting a final db to pass to (a) above is done on behalf of the user. This would be used by fluree/server, etc. I think for this, our existing (fluree/query ...) can be used. Options should be an extra arity argument, as the options for the query might come from HTTP header or other sources, and perhaps not in the query itself.

c) Optionally, a separate API like (b) but takes a signed query as the argument. It will verify the signature and add the options for policy, identity, etc based on the signature (overwriting any supplied by the user if present). I'd propose (fluree/signed-query ...) as the API.