feature: expose database contents as inherent method on Ingredients#676
Conversation
✅ Deploy Preview for salsa-rs canceled.
|
CodSpeed Performance ReportMerging #676 will not alter performanceComparing Summary
|
5080b53 to
7b0744e
Compare
|
Exposing the methods on the ingredient does make sense to me.
Not saying we have to do this as part of this PR but having the same functionality for queries seems useful because most queries (e.g. the source text or parsed AST) in Ruff aren't tracked structs or inputs but getting a count of alive values would be a useful debug statistics. |
How would you feel about moving
Ah, I naively assumed that most queries in Ruff were Salsa structs. In that case, we should add this functionality to tracked functions, but I'd rather do that in a followup: tracked functions feel substantially more difficult than Salsa structs, but that might also be my unfamiliarity. |
This PR redesigns the functionality introduced in #640 so that the dump-all-database contents methods are on the Salsa struct ingredient instead of the database's
Storage. I think this is an improvement for two reasons:DebugQueryTabletrait.&dyn SomeDatabase. However, it is feasible to access the ingredientExample
Here's an example for interned structs (input and tracked structs have an identical API):
Note that the
entriesmethod is defined on the{interned, input, tracked}::IngredientImpl. The more optimal API would be to defineentrieson the Salsa struct itself, alongsideingredient. However, this is substantially more annoying to feature-flag through macros.Notes
While I don't have a good idea how to access a tracked function's memos, I also don't really know how much it makes sense to do so outside of some migrations.