FeatureStore
Storage abstraction for Feature flags with Kotlin-idiomatic operator support.
This interface provides a comprehensive API for managing feature flags, including CRUD operations, group management, and permission handling. All operations are suspend functions to support asynchronous I/O across different storage backends.
Operator Support
This interface uses Kotlin operator overloading for common operations:
featureId in store- Check if a feature existsstore[featureId]- Read a featurestore += feature- Create a new featurestore -= featureId- Delete a feature
Example:
val store: FeatureStore = InMemoryFeatureStore()
// Create a feature
store += Feature("dark-mode", isEnabled = true)
// Check existence
if ("dark-mode" in store) {
// Read feature
val feature = store["dark-mode"]
}
// Delete feature
store -= "dark-mode"Inheritors
Functions
Add a feature to a group.
Check if a group exists in the store.
Create or update a feature (upsert operation).
Disable all features associated with the specified group.
Enable all features associated with the specified group.
Get all group names in the store.
Read a feature from the store or throw an exception if not found.
Grant a role/permission to a feature.
Delete a feature from the store.
Create a new feature in the store.
Remove a feature from its group.
Revoke a role/permission from a feature.
Update a feature using a transformation function.