Skip to content
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

A recursive FileNode for CodeFileManager #129

Closed
wants to merge 1 commit into from
Closed

Conversation

granawkins
Copy link
Member

@granawkins granawkins commented Oct 6, 2023

I have mentioned this in a couple comments so here is a start. I'm imagining:

  • CodeFileManager.root is a Node for the git_root. This can be built and cached on startup.
  • CodeFile and FileEdit can get the node via CODE_FILE_MANAGER.get().root[path], and then use it for thread-safe read/write. We'll set CFM outside/above the session loops.
  • Everything in include_files.py can be done here much easier.

So this is here as a draft for feedback. Planning to build it out after #115.

@granawkins granawkins marked this pull request as draft October 6, 2023 13:52
@waydegg
Copy link
Contributor

waydegg commented Oct 6, 2023

thread-safe read/write. We'll set CFM outside/above the session loops

Instead of putting file read/writes on different threads, I'm thinking we could use aiofiles and keep everything in the async event loop

@waydegg
Copy link
Contributor

waydegg commented Oct 6, 2023

What's the advantage of using this over the existing way we pull in files/partial files again?

@granawkins
Copy link
Member Author

What's the advantage of using this over the existing way we pull in files/partial files again?

Instead of putting file read/writes on different threads, I'm thinking we could use aiofiles and keep everything in the async event loop

Keeping a map of the filetree in a separate thread will have a lot of uses, one of which is storing the Lock for that file. I think we'd still need the lock with aiofiles, right?

Another is storing the checksum for each file. We'll need to check for updates across hundreds of files each time the user sends a message, and hopefully not read/hash every time. We could use git, but we also want to #128. If we base it on the last-updated time, we can store the expected time along with the checksum here.

We can also use it in code_context.get_code_message to iterate over the context, instead of calling get_non_gitignored_files.

What do you think? Premature optimization?

@granawkins
Copy link
Member Author

Hasn't been necessary

@granawkins granawkins closed this Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants