DataAdapter
Abstract class representing a data adapter. In charge of caching, storing and loading data for extensions, plugins, and other parts of your bot.
This class exists because it's intended for you to be able to create your own data adapters. As your bot is configured to use a single, global adapter, this allows you to switch up how your configuration is stored, as long as the eventual data translation happens via kotlinx.serialization.
As storage units may provide contextual information but may not necessarily point to different actual data objects, data adapters also include the concept of data IDs. These IDs are identifiers that provide a mapping between storage units and the actual data objects they refer to. As an example, a file-backed data adapter will likely use the path to the file here - so all storage units pointing to the same file will point at the same data object.
Data IDs allow you to point at contextual data sources when required, allowing for quite a few different possibilities in configuration. For example, different guilds, users, and so on may have their own separate configurations, if you so desire. It's up to your extensions to work with this system, and only provide the extra storage unit context that makes sense for the specific use-case.
Parameters
A typevar representing what you use to identify specific instances of data storage, referred to as data IDs. This will often be a string, but you can use anything that can reasonably be used as the key for a map. File-based data adapters will likely just use the file path here.
Inheritors
Functions
Retrieve the data object represented by the given storage unit, or store the data object returned by the callback if no respective data could be found.
Save the cached data represented by the given storage unit to persistent storage, creating any files and folders as needed.
Save the given data represented by the given storage unit to persistent storage, creating any files and folders as needed, and storing the given data object in the dataCache.