ConfigBackend

interface ConfigBackend

Backend for ConfigStorage that handles loading config data, change detection, and error reporting.

Functions

Link copied to clipboard
abstract fun getLastModified(id: Key): Long

Returns the last modified timestamp (epoch millis) for the config with id. Used to determine whether a config needs to be reloaded.

Link copied to clipboard
abstract fun load(id: Key): JsonElement?

Loads the config for id and returns the parsed kotlinx.serialization.json.JsonElement, or an empty kotlinx.serialization.json.JsonObject if no config exists for the given id, or null if the config could not be loaded for any other reason.

Link copied to clipboard
abstract fun onError(id: Key, path: List<String>, exception: SerializationException)

Called when a deserialization failure on path in the config with id occurs.

Link copied to clipboard
abstract fun postReload()

Called after configs have been reloaded.