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 {
5353
5454 override suspend fun addAll (parent : StorageNode .StorageDirectory , nodes : List <StorageNode >): Collection <StorageNode > {
5555 add(parent)
56+
57+ if (nodes.isEmpty()) {
58+ return fileIndex[parent]?.values ? : listOf ()
59+ }
60+
5661 nodes.asSequence()
5762 .filterIsInstance<StorageNode .StorageDirectory >()
5863 .forEach { node ->
@@ -78,17 +83,11 @@ class InMemoryStorageIndex : MutableStorageIndex {
7883
7984 override suspend fun sync (parent : StorageNode .StorageDirectory , nodes : List <StorageNode >): Collection <StorageNode > {
8085 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
9291
9392 nodes.asSequence()
9493 .filterIsInstance<StorageNode .StorageDirectory >()
You can’t perform that action at this time.
0 commit comments