RegistryStorage

interface RegistryStorage<K, T>

Interface for interaction based registries like ComponentRegistry and ApplicationCommandRegistry.

The purpose of this interface is to provide a generic way to store Components/ApplicationCommands in a dynamic manner.

Inheritors

Types

Link copied to clipboard
data class StorageEntry<K, V>(val key: K, val value: V)

Data class to represent an entry in the RegistryStorage.

Functions

Link copied to clipboard
abstract fun constructUniqueIdentifier(data: T): String

Constructs a unique key for the given data.

Link copied to clipboard
abstract fun entryFlow(): Flow<RegistryStorage.StorageEntry<K, T>>

Creates a flow of all entries in this registry.

Link copied to clipboard
abstract suspend fun get(id: K): T?

Reads a value from the registry at the given key.

Link copied to clipboard
abstract suspend fun register(data: T)

Lets the registry know about the specified type T, this may store the object in a local map, which is used for reconstructing later.

Link copied to clipboard
abstract suspend fun remove(id: K): T?

Deletes a value from the registry with the given key.

Link copied to clipboard
abstract suspend fun set(id: K, data: T)

Creates or updates an existing entry at the given unique key.