storage: Address experimental time API errors
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
parent
c48aa73ad0
commit
288daadd8b
5 changed files with 8 additions and 1 deletions
|
@ -116,6 +116,7 @@ internal class Backup(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(IOException::class, GeneralSecurityException::class)
|
@Throws(IOException::class, GeneralSecurityException::class)
|
||||||
|
@OptIn(ExperimentalTime::class)
|
||||||
private suspend fun backupFiles(
|
private suspend fun backupFiles(
|
||||||
filesResult: FileScannerResult,
|
filesResult: FileScannerResult,
|
||||||
availableChunkIds: HashSet<String>,
|
availableChunkIds: HashSet<String>,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.calyxos.backup.storage.measure
|
||||||
import org.calyxos.backup.storage.plugin.SnapshotRetriever
|
import org.calyxos.backup.storage.plugin.SnapshotRetriever
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.security.GeneralSecurityException
|
import java.security.GeneralSecurityException
|
||||||
import java.util.concurrent.TimeUnit.MILLISECONDS
|
import kotlin.time.DurationUnit.MILLISECONDS
|
||||||
import kotlin.time.ExperimentalTime
|
import kotlin.time.ExperimentalTime
|
||||||
import kotlin.time.toDuration
|
import kotlin.time.toDuration
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.calyxos.backup.storage.plugin.saf.DocumentFileExt.listFilesBlocking
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
|
import kotlin.time.ExperimentalTime
|
||||||
|
|
||||||
private val folderRegex = Regex("^[a-f0-9]{16}\\.sv$")
|
private val folderRegex = Regex("^[a-f0-9]{16}\\.sv$")
|
||||||
private val chunkFolderRegex = Regex("[a-f0-9]{2}")
|
private val chunkFolderRegex = Regex("[a-f0-9]{2}")
|
||||||
|
@ -89,6 +90,7 @@ public abstract class SafStoragePlugin(
|
||||||
* Chunk folders will get cached in the given [chunkFolders] for faster access.
|
* Chunk folders will get cached in the given [chunkFolders] for faster access.
|
||||||
*/
|
*/
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
|
@OptIn(ExperimentalTime::class)
|
||||||
private suspend fun populateChunkFolders(
|
private suspend fun populateChunkFolders(
|
||||||
folder: DocumentFile,
|
folder: DocumentFile,
|
||||||
chunkFolders: HashMap<String, DocumentFile>,
|
chunkFolders: HashMap<String, DocumentFile>,
|
||||||
|
@ -126,6 +128,7 @@ public abstract class SafStoragePlugin(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
|
@OptIn(ExperimentalTime::class)
|
||||||
private fun createMissingChunkFolders(
|
private fun createMissingChunkFolders(
|
||||||
root: DocumentFile,
|
root: DocumentFile,
|
||||||
chunkFolders: HashMap<String, DocumentFile>,
|
chunkFolders: HashMap<String, DocumentFile>,
|
||||||
|
|
|
@ -52,6 +52,7 @@ internal class Restore(
|
||||||
MultiChunkRestore(context, storagePlugin, fileRestore, streamCrypto, streamKey)
|
MultiChunkRestore(context, storagePlugin, fileRestore, streamCrypto, streamKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalTime::class)
|
||||||
fun getBackupSnapshots(): Flow<SnapshotResult> = flow {
|
fun getBackupSnapshots(): Flow<SnapshotResult> = flow {
|
||||||
val numSnapshots: Int
|
val numSnapshots: Int
|
||||||
val time = measure {
|
val time = measure {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.calyxos.backup.storage.content.DocFile
|
||||||
import org.calyxos.backup.storage.content.MediaFile
|
import org.calyxos.backup.storage.content.MediaFile
|
||||||
import org.calyxos.backup.storage.db.UriStore
|
import org.calyxos.backup.storage.db.UriStore
|
||||||
import org.calyxos.backup.storage.measure
|
import org.calyxos.backup.storage.measure
|
||||||
|
import kotlin.time.ExperimentalTime
|
||||||
|
|
||||||
internal class FileScannerResult(
|
internal class FileScannerResult(
|
||||||
val smallFiles: List<ContentFile>,
|
val smallFiles: List<ContentFile>,
|
||||||
|
@ -30,6 +31,7 @@ internal class FileScanner(
|
||||||
private const val FILES_LARGE = "large"
|
private const val FILES_LARGE = "large"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalTime::class)
|
||||||
fun getFiles(): FileScannerResult {
|
fun getFiles(): FileScannerResult {
|
||||||
// scan both APIs
|
// scan both APIs
|
||||||
val mediaFiles = ArrayList<ContentFile>()
|
val mediaFiles = ArrayList<ContentFile>()
|
||||||
|
|
Loading…
Add table
Reference in a new issue