@@ -14,7 +14,7 @@ type timedEvent struct {
14
14
}
15
15
16
16
type eventCache map [string ]timedEvent
17
-
17
+ DirectoryEventDirectoryEventDirectoryEventsss
18
18
func (cache eventCache ) Add (ev timedEvent ) {
19
19
log := flog .New ()
20
20
log .Prefix = ev .Path () + ": "
@@ -35,34 +35,33 @@ func (cache eventCache) Add(ev timedEvent) {
35
35
cache [ev .Path ()] = ev
36
36
}
37
37
38
- // DirectoryEvents returns the list of events that pertain to directories.
39
- // The set of returns events is disjoint with FileEvents .
40
- func (cache eventCache ) DirectoryEvents () []timedEvent {
38
+ // SequentialEvents returns the list of events that pertain to directories.
39
+ // The set of returned events is disjoint with ConcurrentEvents .
40
+ func (cache eventCache ) SequentialEvents () []timedEvent {
41
41
var r []timedEvent
42
42
for _ , ev := range cache {
43
43
info , err := os .Stat (ev .Path ())
44
- if err != nil {
45
- continue
46
- }
47
- if ! info .IsDir () {
44
+ if err == nil && ! info .IsDir () {
48
45
continue
49
46
}
47
+ // Include files that have deleted here.
48
+ // It's unclear whether they're files or folders.
50
49
r = append (r , ev )
51
50
52
51
}
53
52
return r
54
53
}
55
54
56
- // FileEvents returns the list of events that pertain to files .
57
- // The set of returns events is disjoint with DirectoryEvents .
58
- func (cache eventCache ) FileEvents () []timedEvent {
55
+ // ConcurrentEvents returns the list of events that are safe to process after SequentialEvents .
56
+ // The set of returned events is disjoint with SequentialEvents .
57
+ func (cache eventCache ) ConcurrentEvents () []timedEvent {
59
58
var r []timedEvent
60
59
for _ , ev := range cache {
61
60
info , err := os .Stat (ev .Path ())
62
61
if err != nil {
63
62
continue
64
63
}
65
- if info .IsDir () {
64
+ if info .IsDir () {
66
65
continue
67
66
}
68
67
r = append (r , ev )
0 commit comments