MosaicRepositoryImpl

class MosaicRepositoryImpl(network: MosaicNetwork, database: MosaicDatabase, fileSystem: MosaicFileSystem, networkParametersHolder: NetworkParametersHolder) : MosaicRepository

Constructors

Link copied to clipboard
constructor(network: MosaicNetwork, database: MosaicDatabase, fileSystem: MosaicFileSystem, networkParametersHolder: NetworkParametersHolder)

Functions

Link copied to clipboard
open suspend override fun deleteFile(fileName: String): Result<Unit>
Link copied to clipboard
open suspend override fun deletePlainData(dataKey: String): Result<Unit>
Link copied to clipboard
open suspend override fun deletePlainDataByIds(dataKeys: List<String>): Result<Unit>
Link copied to clipboard
open suspend override fun deleteSegmentedData(segmentKey: String, dataKey: String): Result<Unit>
Link copied to clipboard
open suspend override fun deleteSegmentedDataByIds(segmentKey: String, dataKeys: List<String>): Result<Unit>
Link copied to clipboard
open suspend override fun downloadFile(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, targetFileName: String, mimeType: String?, onProgress: suspend (Float) -> Unit, onDownloadFinished: suspend () -> Unit, onDownloadFailure: suspend (Throwable) -> Unit): Result<Unit>

Downloads a file into the device's public/general storage (system Downloads location). See dev.catbit.mosaic.core.data.schemas.event.events.networking.DownloadFileEventSchema for the full per-platform behavior contract.

Link copied to clipboard
open suspend override fun downloadFileToDisk(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, targetFileName: String, onProgress: suspend (Float) -> Unit, onDownloadFinished: suspend () -> Unit, onDownloadFailure: suspend (Throwable) -> Unit): Result<Unit>
Link copied to clipboard
open suspend override fun downloadFileToMemory(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, onProgress: suspend (Float) -> Unit, onDownloadFinished: suspend (ByteArray) -> Unit, onDownloadFailure: suspend (Throwable) -> Unit): Result<Unit>
Link copied to clipboard
open suspend override fun dropCaches(dropScreensCache: Boolean, dropInitialGraphCache: Boolean, dropVersionCache: Boolean): Result<Unit>
Link copied to clipboard
open suspend override fun fileExists(fileName: String): Result<Boolean>
Link copied to clipboard
open suspend override fun getAllPlainData(): Result<Map<String, Any>>
Link copied to clipboard
open suspend override fun getAllSegmentedData(segmentKey: String): Result<Map<String, Any>>
Link copied to clipboard
open suspend override fun getFile(fileName: String): Result<ByteArray?>
Link copied to clipboard
open suspend override fun getFilePlatformFile(fileName: String): Result<PlatformFile?>
Link copied to clipboard
open suspend override fun getFileStreaming(fileName: String): Result<Flow<ByteArray>?>
Link copied to clipboard
open suspend override fun getInitialGraph(): Result<GraphModel>
Link copied to clipboard
open suspend override fun getPlainData(dataKey: String): Result<Any>
Link copied to clipboard
open suspend override fun getPlainDataByIds(dataKeys: List<String>): Result<Map<String, Any>>
Link copied to clipboard
open suspend override fun getScreen(screenId: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, timeoutMillis: Long?): Result<ScreenModel>
Link copied to clipboard
open suspend override fun getSegmentedData(segmentKey: String, dataKey: String): Result<Any>
Link copied to clipboard
open suspend override fun getSegmentedDataByIds(segmentKey: String, dataKeys: List<String>): Result<Map<String, Any>>
Link copied to clipboard
open suspend override fun getVersion(): Result<Unit>

Checks the backend's cache-busting version against the locally stored one, wiping the graph/screens cache when the remote version is newer. Never blocks the caller for long (offline or any failure is captured in the returned Result rather than thrown).

Link copied to clipboard
open suspend override fun saveFile(fileName: String, data: ByteArray): Result<Unit>
Link copied to clipboard
open suspend override fun savePlainData(dataKey: String, data: Any): Result<Unit>
Link copied to clipboard
open suspend override fun saveSegmentedData(segmentKey: String, dataKey: String, data: Any): Result<Unit>
Link copied to clipboard
open suspend override fun sendHttpRequest(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, timeoutMillis: Long?): Result<HttpResponse>
Link copied to clipboard
open suspend override fun uploadFile(url: String?, headers: Map<String, String>?, httpMethod: HttpMethod, contentType: String?, platformFile: PlatformFile, onProgress: suspend (Float) -> Unit): Result<UploadResult>
Link copied to clipboard
open suspend override fun wipePlainData(): Result<Unit>
Link copied to clipboard
open suspend override fun wipeSegmentedData(segmentKey: String): Result<Unit>