fluree / core

Fluree releases and public bug reports
0 stars 0 forks source link

Allow `:fuel` opt and short-circuit query/txn if fuel limit exceeded (w/ appropriate non-200 response) #33

Closed aaj3f closed 9 months ago

aaj3f commented 9 months ago

Description

Fuel calculation has been implemented on db for query/txn compute work calculation. Currently, however, there is no way to specify a max fuel limit for a single query/txn, e.g. something like

{
  "from": "example/ledger",
  "select": ["(sum ?favNums)"],
  "where": [["?s", "ex:favNums", "?favNums"]],
  "opts": {
     "fuel": 5000
   }
}

The desired behavior would be to allow a query/txn to set a max fuel ceiling. If that particular query/txn resolution hit the threshold specified, then the operation should be short-circuited/halted and return the appropriate non-success response for fuel limit having been reached

cap10morgan commented 9 months ago

We had already defined a max-fuel / maxFuel opt so I used that instead. Let me know if you want to change it to fuel everywhere, though.