Skip to content

Commit 58472c5

Browse files
committed
Rename DIRTY to DIFF
1 parent 28420e0 commit 58472c5

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/main/java/engineering/swat/watch/Approximation.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public enum Approximation {
6666
*
6767
* <p>
6868
* This approach is relatively cheap in terms of memory usage (cf.
69-
* {@link #DIRTY}), but it results in a large over/underapproximation of the
70-
* actual events (cf. DIRTY).
69+
* {@link #DIFF}), but it results in a large over/underapproximation of the
70+
* actual events (cf. DIFF).
7171
*/
7272
ALL,
7373

@@ -76,7 +76,8 @@ public enum Approximation {
7676
* <p>
7777
* Synthetic events of kinds {@link WatchEvent.Kind#CREATED},
7878
* {@link WatchEvent.Kind#MODIFIED}, and {@link WatchEvent.Kind#DELETED} are
79-
* issued for dirty regular files/directories in the scope of the watch, as
79+
* issued for regular files/directories in the scope of the watch, when
80+
* their current versions are different from their previous versions, as
8081
* determined using <i>last-modified-times</i>. Specifically, when an
8182
* overflow event happens:
8283
*
@@ -103,5 +104,5 @@ public enum Approximation {
103104
* but it is relatively expensive in terms of memory usage (cf. ALL), as the
104105
* watch needs to keep track of last-modified-times.
105106
*/
106-
DIRTY
107+
DIFF
107108
}

src/main/java/engineering/swat/watch/Watcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ private BiConsumer<EventHandlingWatch, WatchEvent> applyApproximateOnOverflow()
233233
return eventHandler;
234234
case ALL:
235235
return eventHandler.andThen(new MemorylessRescanner(executor));
236-
case DIRTY:
236+
case DIFF:
237237
return eventHandler.andThen(new IndexingRescanner(executor, path, scope));
238238
default:
239239
throw new UnsupportedOperationException("No event handler has been defined yet for this overflow policy");

src/test/java/engineering/swat/watch/SingleDirectoryTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void indexingRescanOnOverflow() throws IOException, InterruptedException {
179179
var nDeleted = new AtomicInteger();
180180

181181
var watchConfig = Watcher.watch(directory, WatchScope.PATH_AND_CHILDREN)
182-
.onOverflow(Approximation.DIRTY)
182+
.onOverflow(Approximation.DIFF)
183183
.on(e -> {
184184
var kind = e.getKind();
185185
if (kind != OVERFLOW) {

src/test/java/engineering/swat/watch/TortureTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Set<Path> stop() throws InterruptedException {
145145
private static final int THREADS = 4;
146146

147147
@ParameterizedTest
148-
@EnumSource(names = { "ALL", "DIRTY" })
148+
@EnumSource(names = { "ALL", "DIFF" })
149149
void pressureOnFSShouldNotMissNewFilesAnything(Approximation whichFiles) throws InterruptedException, IOException {
150150
final var root = testDir.getTestDirectory();
151151
var pool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 4);
@@ -268,7 +268,7 @@ void manyRegistrationsForSamePath() throws InterruptedException, IOException {
268268
}
269269

270270
static Stream<Approximation> manyRegisterAndUnregisterSameTimeSource() {
271-
Approximation[] values = { Approximation.ALL, Approximation.DIRTY };
271+
Approximation[] values = { Approximation.ALL, Approximation.DIFF };
272272
return TestHelper.streamOf(values, 5);
273273
}
274274

@@ -342,7 +342,7 @@ void manyRegisterAndUnregisterSameTime(Approximation whichFiles) throws Interrup
342342
}
343343

344344
@ParameterizedTest
345-
@EnumSource(names = { "ALL", "DIRTY" })
345+
@EnumSource(names = { "ALL", "DIFF" })
346346
//Deletes can race the filesystem, so you might miss a few files in a dir, if that dir is already deleted
347347
@EnabledIfEnvironmentVariable(named="TORTURE_DELETE", matches="true")
348348
void pressureOnFSShouldNotMissDeletes(Approximation whichFiles) throws InterruptedException, IOException {

0 commit comments

Comments
 (0)