All Downloads are FREE. Search and download functionalities are using the official Maven repository.

androidMain.com.ditchoom.mqtt3.persistence.DefaultPersistence.kt Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.ditchoom.mqtt3.persistence

import com.ditchoom.mqtt.InMemoryPersistence
import com.ditchoom.mqtt.Persistence
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers

actual suspend fun newDefaultPersistence(androidContext: Any?, name: String, inMemory: Boolean): Persistence =
    try {
        SqlDatabasePersistence(sqlDriver(androidContext, name, inMemory)!!)
    } catch (t: Throwable) {
        InMemoryPersistence()
    }

actual fun defaultDispatcher(nThreads: Int, name: String): CoroutineDispatcher = Dispatchers.IO




© 2015 - 2025 Weber Informatics LLC | Privacy Policy