DataStorage

interface DataStorage(source)

Represents the persistent storage for KarlContainer state and user metadata. Implementations will wrap specific storage solutions (like SQLDelight or Room). This interface resides in the data package as it's specific to data persistence.

Functions

Link copied to clipboard
abstract suspend fun deleteUserData(userId: String)

Deletes all stored data for a specific user.

Link copied to clipboard
abstract suspend fun initialize()

Initializes the storage, potentially setting up databases/tables.

Link copied to clipboard
abstract suspend fun loadContainerState(userId: String): KarlContainerState?

Loads the state of a KarlContainer for a user.

Link copied to clipboard
abstract suspend fun loadRecentInteractionData(userId: String, limit: Int, type: String? = null): List<InteractionData>

Loads recent interaction data for a user, optionally filtered by type. Useful for providing context to the LearningEngine for prediction.

Link copied to clipboard
abstract suspend fun release()

Releases any resources held by the storage.

Link copied to clipboard
abstract suspend fun saveContainerState(userId: String, state: KarlContainerState)

Saves the current state of a KarlContainer.

Link copied to clipboard
abstract suspend fun saveInteractionData(data: InteractionData)

Saves user interaction data.