Skip to main content

Runtime Operations

API reference for managing namespace configuration lifecycle: loading, rollback, and kill-switch operations.

update / rollback / historyMetadata are runtime-only extensions from io.amichne.konditional.runtime.


Namespace.update(configuration)

Atomically replace the active configuration snapshot.

fun Namespace.update(configuration: Configuration)

Parameters

  • configuration - trusted snapshot (typically from NamespaceSnapshotLoader.load(...) or ConfigurationSnapshotCodec.decode(json, schema, options))

Behavior

  • Performs atomic swap via AtomicReference.set(...)
  • Readers see either old or new snapshot (never mixed)
  • Adds current config to rollback history (bounded)

Example

NamespaceSnapshotLoader.forNamespace(AppFeatures)
.load(json)
.onSuccess { configuration ->
AppFeatures.update(configuration)
}
.onFailure { failure ->
val parseError = failure.parseErrorOrNull()
logError(parseError?.message ?: failure.message.orEmpty())
}

Namespace.configuration: ConfigurationView

Get the current active configuration snapshot.

val Namespace.configuration: ConfigurationView

Example

val current = AppFeatures.configuration
println("Version: ${current.metadata.version}")

Advanced Options

Namespace.rollback(steps): Boolean

Revert to a prior configuration from rollback history.

fun Namespace.rollback(steps: Int = 1): Boolean

Returns

  • true if rollback succeeded
  • false if not enough history is available

Namespace.historyMetadata: List<ConfigurationMetadataView>

Read metadata for the rollback history.

val Namespace.historyMetadata: List<ConfigurationMetadataView>

Namespace.disableAll() / Namespace.enableAll()

Emergency kill-switch to return defaults for all features.

fun Namespace.disableAll()
fun Namespace.enableAll()
  • Guarantee: When disabled, evaluations return declared defaults. → C-09

  • Mechanism: Registry-level boolean kill-switch.

  • Boundary: This does not change feature definitions or loaded configuration.


Namespace.setHooks(hooks)

Attach dependency-free logging/metrics hooks to a namespace registry.

fun Namespace.setHooks(hooks: RegistryHooks)

See Observability for RegistryHooks and related interfaces.


Next steps