Description
We used to have a "volatile" flag that we placed on functions which may consume untracked inputs. At some point it was removed. Unfortunately, we don't seem to have authored an RFC at the time, so I don't remember the reasoning -- probably we could find a PR. The current method for signalling an untracked input is to invoke report_untracked_read
on the runtime. It's a kind of "out of the way" API that most users will not find.
I think we should go back to the volatile flag, so that this...
#[tracked(volatile)]
fn foo(db: &dyn crate::Db) { }
...would be the way to signal an untracked read (and the public report_untracked_read
function would be removed). There is no loss of expressiveness, as one can easily make a function (like foo
above) that does nothing but report an untracked read, and decide dynamically whether to call it.
The reason that I think a flag is better:
- volatile and LRU don't mix well, as noted here. When we add the option for an LRU query (see Add options to tracked funcitons for lru capacity #344), we can make it an error to declare a query as both LRU and volatile, and then this logic won't be necessary (well, we'll probably keep that code, though we could change it to an assertion).