Остался LocalMetaInfo

This commit is contained in:
Roman Pytkov
2024-12-20 20:30:31 +03:00
parent a481868039
commit cf443487ee
3 changed files with 43 additions and 47 deletions

View File

@@ -7,6 +7,7 @@ import com.github.nullptroma.wallenc.domain.models.IStorageAccessor
import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
@@ -25,6 +26,8 @@ class LocalStorageAccessor(
private val _size = MutableStateFlow<Long?>(null) private val _size = MutableStateFlow<Long?>(null)
private val _numberOfFiles = MutableStateFlow<Int?>(null) private val _numberOfFiles = MutableStateFlow<Int?>(null)
private val _isAvailable = MutableStateFlow(false) private val _isAvailable = MutableStateFlow(false)
private val _filesUpdates = MutableSharedFlow<DataPackage<IFile>>()
private val _dirsUpdates = MutableSharedFlow<DataPackage<IDirectory>>()
override val size: StateFlow<Long?> override val size: StateFlow<Long?>
get() = _size get() = _size
@@ -33,9 +36,9 @@ class LocalStorageAccessor(
override val isAvailable: StateFlow<Boolean> override val isAvailable: StateFlow<Boolean>
get() = _isAvailable get() = _isAvailable
override val filesUpdates: SharedFlow<DataPackage<IFile>> override val filesUpdates: SharedFlow<DataPackage<IFile>>
get() = TODO("Not yet implemented") get() = _filesUpdates
override val dirsUpdates: SharedFlow<DataPackage<IDirectory>> override val dirsUpdates: SharedFlow<DataPackage<IDirectory>>
get() = TODO("Not yet implemented") get() = _dirsUpdates
init { init {
CoroutineScope(ioDispatcher).launch { CoroutineScope(ioDispatcher).launch {
@@ -77,15 +80,15 @@ class LocalStorageAccessor(
_numberOfFiles.value = numOfFiles _numberOfFiles.value = numOfFiles
} }
override suspend fun getAllFiles(): List<IFile> { override suspend fun getAllFiles(): List<IFile> = withContext(ioDispatcher) {
if(checkAvailable() == false) if(checkAvailable() == false)
return listOf() return@withContext listOf()
val list = mutableListOf<IFile>() val list = mutableListOf<IFile>()
return@withContext listOf()
} }
override suspend fun getFiles(path: String): List<IFile> { override suspend fun getFiles(path: String): List<IFile> = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
@@ -93,11 +96,11 @@ class LocalStorageAccessor(
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun getAllDirs(): List<IDirectory> { override suspend fun getAllDirs(): List<IDirectory> = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun getDirs(path: String): List<IDirectory> { override suspend fun getDirs(path: String): List<IDirectory> = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
@@ -105,35 +108,35 @@ class LocalStorageAccessor(
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun touchFile(path: String) { override suspend fun touchFile(path: String) = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun touchDir(path: String) { override suspend fun touchDir(path: String) = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun delete(path: String) { override suspend fun delete(path: String) = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun getFileInfo(path: String) { override suspend fun getFileInfo(path: String) = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun getDirInfo(path: String) { override suspend fun getDirInfo(path: String) = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun openWrite(path: String): InputStream { override suspend fun openWrite(path: String): InputStream = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun openRead(path: String): OutputStream { override suspend fun openRead(path: String): OutputStream = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun moveToTrash(path: String) { override suspend fun moveToTrash(path: String) = withContext(ioDispatcher) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
} }

View File

@@ -4,12 +4,7 @@ import com.github.nullptroma.wallenc.domain.models.IMetaInfo
import java.time.LocalDateTime import java.time.LocalDateTime
class LocalMetaInfo : IMetaInfo { class LocalMetaInfo : IMetaInfo {
init {
}
override val name: String override val name: String
get() = TODO("Not yet implemented")
override val size: Int override val size: Int
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
override val isDeleted: Boolean override val isDeleted: Boolean
@@ -20,4 +15,8 @@ class LocalMetaInfo : IMetaInfo {
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
override val path: String override val path: String
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
init {
name = ""
}
} }

View File

@@ -535,8 +535,6 @@ existing classes or even new classes with specific responsibilities.</val>
<ref refid="7674e432-ac14-11ef-8a1c-ed3b97af40b9"/> <ref refid="7674e432-ac14-11ef-8a1c-ed3b97af40b9"/>
<ref refid="c6ecf183-93dd-11ef-9baf-9fe103139892"/> <ref refid="c6ecf183-93dd-11ef-9baf-9fe103139892"/>
<ref refid="eeb188ee-937f-11ef-800c-1711e1dd68e8"/> <ref refid="eeb188ee-937f-11ef-800c-1711e1dd68e8"/>
<ref refid="fca97806-949f-11ef-b39e-9b5d5b59175b"/>
<ref refid="a2e9abed-94a0-11ef-830c-9b5d5b59175b"/>
<ref refid="a0ee97e8-96af-11ef-8117-23eecc9d3f9f"/> <ref refid="a0ee97e8-96af-11ef-8117-23eecc9d3f9f"/>
<ref refid="9760e377-96ef-11ef-9ee1-3ba703bb2331"/> <ref refid="9760e377-96ef-11ef-9ee1-3ba703bb2331"/>
<ref refid="33660996-962b-11ef-9319-830924f9008e"/> <ref refid="33660996-962b-11ef-9319-830924f9008e"/>
@@ -1303,17 +1301,6 @@ existing classes or even new classes with specific responsibilities.</val>
<ref refid="260a8ffc-9491-11ef-b16d-9b5d5b59175b"/> <ref refid="260a8ffc-9491-11ef-b16d-9b5d5b59175b"/>
</supplier> </supplier>
</Dependency> </Dependency>
<Property id="fca97806-949f-11ef-b39e-9b5d5b59175b">
<interface_>
<ref refid="bf08f1ce-937f-11ef-815c-1711e1dd68e8"/>
</interface_>
<isReadOnly>
<val>1</val>
</isReadOnly>
<name>
<val>+ totalSpace: StateFlow&lt;Integer[0..1]&gt;</val>
</name>
</Property>
<Operation id="7ad15a7c-94a0-11ef-90c1-9b5d5b59175b"> <Operation id="7ad15a7c-94a0-11ef-90c1-9b5d5b59175b">
<interface_> <interface_>
<ref refid="bf08f1ce-937f-11ef-815c-1711e1dd68e8"/> <ref refid="bf08f1ce-937f-11ef-815c-1711e1dd68e8"/>
@@ -1341,17 +1328,6 @@ existing classes or even new classes with specific responsibilities.</val>
<val>String</val> <val>String</val>
</typeValue> </typeValue>
</Parameter> </Parameter>
<Property id="a2e9abed-94a0-11ef-830c-9b5d5b59175b">
<interface_>
<ref refid="bf08f1ce-937f-11ef-815c-1711e1dd68e8"/>
</interface_>
<isReadOnly>
<val>1</val>
</isReadOnly>
<name>
<val>+ availableSpace: StateFlow&lt;Integer[0..1]&gt;</val>
</name>
</Property>
<Operation id="65a4baa8-9613-11ef-86f7-830924f9008e"> <Operation id="65a4baa8-9613-11ef-86f7-830924f9008e">
<interface_> <interface_>
<ref refid="44426384-949b-11ef-8612-9b5d5b59175b"/> <ref refid="44426384-949b-11ef-8612-9b5d5b59175b"/>
@@ -3366,6 +3342,8 @@ existing classes or even new classes with specific responsibilities.</val>
<ref refid="43879923-af11-11ef-8c68-cf9202569821"/> <ref refid="43879923-af11-11ef-8c68-cf9202569821"/>
<ref refid="466a8346-af11-11ef-9976-cf9202569821"/> <ref refid="466a8346-af11-11ef-9976-cf9202569821"/>
<ref refid="4a7b6f2c-af11-11ef-aee3-cf9202569821"/> <ref refid="4a7b6f2c-af11-11ef-aee3-cf9202569821"/>
<ref refid="6fedb071-beda-11ef-993b-e90029242394"/>
<ref refid="74102473-beda-11ef-9bee-e90029242394"/>
</reflist> </reflist>
</ownedAttribute> </ownedAttribute>
<package> <package>
@@ -3393,7 +3371,7 @@ existing classes or even new classes with specific responsibilities.</val>
<val>355.0</val> <val>355.0</val>
</width> </width>
<height> <height>
<val>134.0</val> <val>168.0</val>
</height> </height>
<diagram> <diagram>
<ref refid="7a8a9c2d-9248-11ef-bfb6-d5c6949dbfe2"/> <ref refid="7a8a9c2d-9248-11ef-bfb6-d5c6949dbfe2"/>
@@ -3425,7 +3403,7 @@ existing classes or even new classes with specific responsibilities.</val>
<val>(1.0, 0.0, 0.0, 1.0, 29.099681659149553, 1343.3520695479824)</val> <val>(1.0, 0.0, 0.0, 1.0, 29.099681659149553, 1343.3520695479824)</val>
</matrix> </matrix>
<points> <points>
<val>[(283.40031834085045, -3.35206954798241), (283.40031834085045, -168.3520695479824)]</val> <val>[(283.40031834085045, -3.35206954798241), (283.40031834085045, -134.3520695479824)]</val>
</points> </points>
<head-connection> <head-connection>
<ref refid="a9689781-945a-11ef-a65b-21844220910b"/> <ref refid="a9689781-945a-11ef-a65b-21844220910b"/>
@@ -3567,4 +3545,20 @@ existing classes or even new classes with specific responsibilities.</val>
<val>1</val> <val>1</val>
</upperValue> </upperValue>
</Property> </Property>
<Property id="6fedb071-beda-11ef-993b-e90029242394">
<interface_>
<ref refid="04645ae3-af11-11ef-b181-cf9202569821"/>
</interface_>
<name>
<val>+ totalSpace: StateFlow&lt;Integer[0..1]&gt;</val>
</name>
</Property>
<Property id="74102473-beda-11ef-9bee-e90029242394">
<interface_>
<ref refid="04645ae3-af11-11ef-b181-cf9202569821"/>
</interface_>
<name>
<val>+ availableSpace: StateFlow&lt;Integer[0..1]&gt;</val>
</name>
</Property>
</gaphor> </gaphor>