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

Manage confined entries in synchronization monitor #8198

Open
vxgmichel opened this issue Aug 28, 2024 · 1 comment
Open

Manage confined entries in synchronization monitor #8198

vxgmichel opened this issue Aug 28, 2024 · 1 comment
Labels
enhancement Improve functionality, potentially changing behavior I-Rust Impact: Rust-related stuff

Comments

@vxgmichel
Copy link
Contributor

vxgmichel commented Aug 28, 2024

As mentioned in this conversation, the WorkspaceOpsOutboundSyncEntryConfined event has not been implemented.

In parsec v2, it was emitted when a confined entry tries to get synchronized:

confinement_point = await self._get_confinement_point(entry_id)
if confinement_point is not None:
# Send entry confined event for the sync monitor
self._send_event(
CoreEvent.FS_ENTRY_CONFINED, entry_id=entry_id, cause_id=confinement_point
)
# Do not perform the synchronization
return None

It was linked to a handler in the sync monitor:

def _on_entry_confined(
event: CoreEvent, entry_id: EntryID, cause_id: EntryID, workspace_id: EntryID
) -> None:
ctx = ctxs.get(workspace_id)
if ctx is not None:
ctx.set_confined_entry(entry_id, cause_id)
# No need to call `_trigger_early_wakeup` here given due time is not updated
# (by definition, a confined entry doesn't have to be synced)

Which allowed the sync monitor to keep track of the confined entries and their respective cause.

This information was then used here:

def set_local_change(self, entry_id: EntryID) -> bool:
# Ignore local changes in read only mode
wake_up = False
if self.read_only:
return wake_up
# Pop confined entries related to current entry_id
local_confinement_points = self._local_confinement_points.pop(entry_id, ())
# Tag all confined entries as potentially changed
for confined_entry in local_confinement_points:
if self.set_local_change(confined_entry):
wake_up = True

This way, all the confined entries corresponding to a given cause would get re-integrated into the synchronization system when the cause gets updated.

@mmmarcos mmmarcos changed the title Add and manage the WorkspaceOpsOutboundSyncEntryConfined event Manage confined entries in synchronization monitor Aug 28, 2024
@mmmarcos mmmarcos added I-Rust Impact: Rust-related stuff enhancement Improve functionality, potentially changing behavior labels Aug 28, 2024
@mmmarcos
Copy link
Contributor

mmmarcos commented Sep 3, 2024

According to @vxgmichel this still needs to be implemented, but it is not a priority since #8068 was fixed by #8192.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve functionality, potentially changing behavior I-Rust Impact: Rust-related stuff
Projects
None yet
Development

No branches or pull requests

2 participants