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

lib: Add the WorkingCopyStore trait and a default implementation. #2686

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PhilipMetzger
Copy link
Contributor

In principle this trait is a layer above an actual VFS, but should be enough to
start working with them. It's responsible for caching and managing working-copies which
are stored locally or on a remote.

The plan is that jj run will query it to request working copies, which it then uses.

This checks the third checkmark in #1869.

Progress on #1869 and #405

cc @martinvonz, @hooper, @kevincliao, @arxanas

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@PhilipMetzger
Copy link
Contributor Author

All kind suggestions are welcomed here, as I'm definitely not set on the API yet.

@PhilipMetzger
Copy link
Contributor Author

I plan to update this soon-ish, as I have a bunch of jj run related stuff stacked on top of it1. I'll also close #2679 as it is now in this change.

Footnotes

  1. E.G querying/directory creation and the workqueue impl. This stuff is still "unfinished" but if I have a good API then the client should be easier right?

In principle this trait is a layer above an actual VFS, but should be enough to 
start working with them. It's responsible for caching and managing working-copies which 
are stored locally or on a remote. 

The plan is that `jj run` will query it to request working copies, which it then uses. 

The client is coming with the workqueue which is step 4 in #1869. 

This checks the third checkmark in #1869. 

Progress on #1869 and #405

cc @martinvonz, @hooper, @kevincliao, @arxanas
@PhilipMetzger
Copy link
Contributor Author

I'm going to mark this as finally ready for review and do a small self-review. It doesn't build just yet but in my mind the interface is well defined now and only should receive a better name.

@PhilipMetzger PhilipMetzger marked this pull request as ready for review March 7, 2024 21:44
// TODO: is this correct?
old_wcs
.iter_mut()
.map(|wc| wc.replace_with(replacements.iter().next().unwrap()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is blocking a successful build and I don't know what to do here.

Comment on lines +63 to +69
// TODO: This ideally also should contain the `RevsetError`, as it purely is an implementation
// detail.
#[error("internal error")]
Internal(#[from] Infallible),
// The variant below shouldn't exist.
#[error("revset evaluation failed")]
Revset(#[from] RevsetEvaluationError),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dislike that these are not a single Error variant.

/// The trait's design is similar to a database. Clients request a single or multiple working-copies
/// and the backend can coalesce the requests if needed. This allows an implementation to build
/// a global view of all actively used working-copies and where they are stored.
pub trait WorkingCopyStore: Send + Sync {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shed: What would be the correct name for this.

@@ -97,6 +101,8 @@ pub struct ReadonlyRepo {
index_store: Arc<dyn IndexStore>,
submodule_store: Arc<dyn SubmoduleStore>,
index: OnceCell<Box<dyn ReadonlyIndex>>,
working_copy_store: Arc<dyn WorkingCopyStore>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should move below change_id_index.

@PhilipMetzger
Copy link
Contributor Author

I'm going to rework the interface again and am putting this on hold until standalone run works, as it clearly is a better approach.

@PhilipMetzger PhilipMetzger marked this pull request as draft May 29, 2024 16:37
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.

1 participant