-
Notifications
You must be signed in to change notification settings - Fork 79
[indexstore-db] Declare Codable conformance, to autosynthesize implementation. #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[indexstore-db] Declare Codable conformance, to autosynthesize implementation. #248
Conversation
I've added some tests to validate the input and output but an argument could be made that the tests merely confirm the behavior of the system framework. Looking for input from reviewers, please. |
Thanks for opening the PR, @moshe-foreflight. I don’t quite understand why we need a |
I'm trying to optimize for performance across multiple runs of a process by splitting the IndexStoreDB into a separate XPC process. (I'm looking to make something easier to ship to teammates than
Quite possibly - it's likely I'm "holding it wrong."
I was trying to spin up an XPC service so I could keep the index alive in a lightweight process, and for reasons I can't recall,
Can you think of a reason not to support this from the perspective of the library vendor? Just because we can, doesn't mean we should, but will adding Codable here worsen IndexStoreDB? Thanks again for your time and patience! |
What are you trying to gain by keeping the index alive? Are you expecting to quit and re-launch clients of your index service multiple times per second or something like that? Because when closing the index, it should be saved (look for a
I didn’t realize that you were talking about separate processes. In that case,
I am a still a little hesitant, in particular until I understand that this is the correct solution for a real problem. Here are a couple reasons why:
|
As a concrete example, I'm trying to do some code analysis to find unit tests and dependencies between symbols. As an intermediate step, I was trying to build something to query the index store. (Then I realized I can use
A few reasons to keep the index alive:
Now that you mentioned it, I see it, thanks! As I stated above, if/when my process crashes, the
Is there a benefit to adding specificity to this path? (
This is all reasonable. It seems like the right thing to do is close this PR. (I'd like to make Thanks! |
Out of curiosity: How long does it take to load the saved index? I would expect it to take significantly less than a second, especially if you use a small-ish project for local development testing.
I think I remember there being a bug where we don’t recover the indexstore-db after a crash. If I remember correctly, what we’re supposed to do is, if there is no
Yes, I think that makes sense. If you open a PR, could you also make the related types like |
This is unfortunately intentional, as it's possible it could be in a corrupted state after a crash. I'd expect creating the database for a small indexstore to be fairly fast regardless though. |
Sorry, I missed something as @bnbarham pointed out. Let’s not change it then. And thanks for opening the PR. |
This PR adds
Codable
support to theSymbolOccurrence
andSymbol
models, in addition to types they depend on. (SymbolRole
, etc)Why?
indexstore-db
would need to manually implement conformance, because conformances in extensions are not synthesized.Risks
Codable
as well. (Compiler will catch this.)See Also