Начало LocalVault
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.github.nullptroma.wallenc.domain.models
|
||||
|
||||
import java.net.URI
|
||||
import java.time.LocalDateTime
|
||||
|
||||
|
||||
@@ -10,5 +9,5 @@ interface IMetaInfo {
|
||||
val isDeleted: Boolean
|
||||
val isHidden: Boolean
|
||||
val lastModified: LocalDateTime
|
||||
val path: URI
|
||||
val path: String
|
||||
}
|
||||
@@ -4,12 +4,10 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
import java.util.UUID
|
||||
|
||||
interface IStorage {
|
||||
val size: StateFlow<Int?>
|
||||
val size: StateFlow<Long?>
|
||||
val numberOfFiles: StateFlow<Int?>
|
||||
val uuid: UUID
|
||||
val name: StateFlow<String>
|
||||
val totalSpace: StateFlow<Int?>
|
||||
val availableSpace: StateFlow<Int?>
|
||||
val isAvailable: StateFlow<Boolean>
|
||||
val accessor: IStorageAccessor
|
||||
|
||||
|
||||
@@ -6,37 +6,38 @@ import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.net.URI
|
||||
|
||||
interface IStorageAccessor {
|
||||
val size: StateFlow<Long?>
|
||||
val numberOfFiles: StateFlow<Int?>
|
||||
val isAvailable: StateFlow<Boolean>
|
||||
val filesUpdates: SharedFlow<DataPackage<IFile>>
|
||||
val dirsUpdates: SharedFlow<DataPackage<IDirectory>>
|
||||
|
||||
suspend fun getAllFiles(): List<IFile>
|
||||
suspend fun getFiles(path: URI): List<IFile>
|
||||
suspend fun getFiles(path: String): List<IFile>
|
||||
/**
|
||||
* Получение списка файлов в директории
|
||||
* @param path Путь к директории
|
||||
* @return Поток файлов
|
||||
*/
|
||||
fun getFilesFlow(path: URI): Flow<DataPackage<IFile>>
|
||||
fun getFilesFlow(path: String): Flow<DataPackage<IFile>>
|
||||
|
||||
suspend fun getAllDirs(): List<IDirectory>
|
||||
suspend fun getDirs(path: URI): List<IDirectory>
|
||||
suspend fun getDirs(path: String): List<IDirectory>
|
||||
/**
|
||||
* Получение списка директорий в директории
|
||||
* @param path Путь к директории
|
||||
* @return Поток директорий
|
||||
*/
|
||||
fun getDirsFlow(path: URI): Flow<DataPackage<IDirectory>>
|
||||
fun getDirsFlow(path: String): Flow<DataPackage<IDirectory>>
|
||||
|
||||
suspend fun touchFile(path: URI)
|
||||
suspend fun touchDir(path: URI)
|
||||
suspend fun delete(path: URI)
|
||||
suspend fun getFileInfo(path: URI)
|
||||
suspend fun getDirInfo(path: URI)
|
||||
suspend fun openWrite(path: URI): InputStream
|
||||
suspend fun openRead(path: URI): OutputStream
|
||||
suspend fun moveToTrash(path: URI)
|
||||
suspend fun touchFile(path: String)
|
||||
suspend fun touchDir(path: String)
|
||||
suspend fun delete(path: String)
|
||||
suspend fun getFileInfo(path: String)
|
||||
suspend fun getDirInfo(path: String)
|
||||
suspend fun openWrite(path: String): InputStream
|
||||
suspend fun openRead(path: String): OutputStream
|
||||
suspend fun moveToTrash(path: String)
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.github.nullptroma.wallenc.domain.models
|
||||
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import java.net.URL
|
||||
|
||||
interface IStorageExplorer {
|
||||
val currentPath: StateFlow<URL>
|
||||
val currentPath: StateFlow<String>
|
||||
|
||||
// TODO
|
||||
// пока бесполезный интерфейс
|
||||
|
||||
@@ -4,8 +4,8 @@ import com.github.nullptroma.wallenc.domain.datatypes.EncryptKey
|
||||
import java.util.UUID
|
||||
|
||||
interface IVault : IVaultInfo {
|
||||
suspend fun createStorage(name: String): IStorage
|
||||
suspend fun createStorage(name: String, key: EncryptKey): IStorage
|
||||
suspend fun createStorage(name: String, key: EncryptKey, uuid: UUID): IStorage
|
||||
suspend fun createStorage(): IStorage
|
||||
suspend fun createStorage(key: EncryptKey): IStorage
|
||||
suspend fun createStorage(key: EncryptKey, uuid: UUID): IStorage
|
||||
suspend fun remove(storage: IStorage)
|
||||
}
|
||||
@@ -9,4 +9,6 @@ interface IVaultInfo {
|
||||
val uuid: UUID
|
||||
val storages: StateFlow<List<IStorage>>
|
||||
val isAvailable: StateFlow<Boolean>
|
||||
val totalSpace: StateFlow<Int?>
|
||||
val availableSpace: StateFlow<Int?>
|
||||
}
|
||||
Reference in New Issue
Block a user