-
Notifications
You must be signed in to change notification settings - Fork 353
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
base: main
Are you sure you want to change the base?
Conversation
All kind suggestions are welcomed here, as I'm definitely not set on the API yet. |
I plan to update this soon-ish, as I have a bunch of Footnotes
|
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
f553c4d
to
6ad721c
Compare
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. |
// TODO: is this correct? | ||
old_wcs | ||
.iter_mut() | ||
.map(|wc| wc.replace_with(replacements.iter().next().unwrap())); |
There was a problem hiding this comment.
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.
// 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), |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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
.
I'm going to rework the interface again and am putting this on hold until standalone |
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:
CHANGELOG.md