update

open suspend override fun update(feature: Feature)(source)

Update an existing feature in the store.

Replaces the stored feature with the provided one. The feature UID must match an existing feature in the store.

Parameters

feature

Feature with updated values

Throws

if feature doesn't exist


open suspend override fun update(featureId: String, transform: (Feature) -> Feature)(source)

Update a feature using a transformation function.

This is a convenience method that reads the feature, applies the provided transformation, and saves the result back to the store atomically.

Implementations should ensure this operation is atomic to prevent race conditions.

Example:

store.update("my-feature") { feature ->
feature.copy(isEnabled = feature.isEnabled.not())
}

Parameters

featureId

Feature unique identifier

transform

Function to transform the feature

Throws

if feature doesn't exist