File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
src/main/java/org/radarbase/output/source Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ class InMemoryStorageIndex : MutableStorageIndex {
53
53
54
54
override suspend fun addAll (parent : StorageNode .StorageDirectory , nodes : List <StorageNode >): Collection <StorageNode > {
55
55
add(parent)
56
+
57
+ if (nodes.isEmpty()) {
58
+ return fileIndex[parent]?.values ? : listOf ()
59
+ }
60
+
56
61
nodes.asSequence()
57
62
.filterIsInstance<StorageNode .StorageDirectory >()
58
63
.forEach { node ->
@@ -78,17 +83,11 @@ class InMemoryStorageIndex : MutableStorageIndex {
78
83
79
84
override suspend fun sync (parent : StorageNode .StorageDirectory , nodes : List <StorageNode >): Collection <StorageNode > {
80
85
add(parent)
81
- val newMap = fileIndex.compute(parent) { _, map ->
82
- if (map == null ) {
83
- buildMap(nodes.size) {
84
- nodes.forEach { put(it.path, it) }
85
- }
86
- } else {
87
- buildMap(nodes.size) {
88
- nodes.forEach { put(it.path, it) }
89
- }
90
- }
91
- } ? : mapOf ()
86
+ val newMap = buildMap(nodes.size) {
87
+ nodes.forEach { put(it.path, it) }
88
+ }
89
+
90
+ fileIndex[parent] = newMap
92
91
93
92
nodes.asSequence()
94
93
.filterIsInstance<StorageNode .StorageDirectory >()
You can’t perform that action at this time.
0 commit comments