You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
# Context
We are introducing EdenFS notifications to support scalable and ergonomic file system notifications for EdenFS mounts.
Watchman has a concept known as a relative root https://www.internalfb.com/intern/staticdocs/watchman/docs/file-query#relative-roots
This diff introduces the concept of a root to changesSinceV2.
A root is a path starting from the existing mount, from which all paths are computed against and acts as an overall include root, eg. all returned paths will start with the root, after which include/exclude roots will be computed, and paths outside the root will not be returned.
# This Diff
Implements root checking. Use the following flowchart for computing included/excluded roots.
```lang=mermaid
flowchart TD
A[Has Root?] -->|No| B(No Change)
A -->|Yes| C(Has included roots?)
C-->|Yes| D(Root is prepended to included roots and excluded roots)
C-->|No| E(Root becomes included root, and prependended to excluded roots, if any)
```
Use the following flowchart for determining how to handle outputs
```lang=mermaid
flowchart TD
A[Has Root?] -->|No| B(No Change)
A -->|Yes| C(Does change contain only one path)
C-->|Yes| D(Root is stripped from output)
C-->|No| E(Are both paths inside the root?)
E-->|Yes| F(Strip root from both paths, return replace/rename)
E-->|No| G(Is the change from outside the root into the root)
G-->|Yes| H(Does the path already exist inside the root)
G-->|No| I(Convert the change into Removed)
H-->|Yes| J(Convert the change into Modified, from Replaced)
H-->|No| K(Convert the change into Added, From Renamed)
```
Note that a directory rename is converted from a Large Change(DirectoryRenamed) into a Small Change(Directory Added/removed/modified)
# Technical Details
This diff adds some additional allocation overhead. This is to make the code more readable. If it becomes a performance issue, this can be optimized down the line.
The root matching is implemented by augmenting the includedRoots entries, as demonstrated in the flowchart above. The input included/excluded roots are appended to the root value.
# Discussion Points
Reviewed By: jdelliot
Differential Revision: D72603242
fbshipit-source-id: 60d3b54ffd0ad5472856b13bf3c8920f1801ac01
0 commit comments