Interface PluginConfigRegistry
Obtain this service from PluginContext.config(); do not
construct paths beneath turboism.home. The runtime confines data to the plugin
configuration scope, validates schemas, runs declared migrations, and schedules persistence.
Typed methods can be absent in compatibility contexts and then throw
UnsupportedOperationException.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordLegacy path scope paired with the permission identifier that controls it. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> CompletionStage<ConfigReadResult<T>>Asynchronously reads a registered typed key.Declares a legacy string-read scope.readString(String relativePath, String key) Reads a legacy string value from a declared read scope.default CompletionStage<Void>registerSchema(ConfigSchema schema, List<ConfigMigration> migrations) Validates and asynchronously registers a typed schema and its migration route.default <T> CompletionStage<ConfigWriteResult>Asynchronously writes a registered typed key using optimistic revision control.writeScope(String relativePath) Declares a legacy string-write scope.voidwriteString(String relativePath, String key, String value) Writes a legacy string value to a declared write scope.
-
Method Details
-
readScope
Declares a legacy string-read scope.- Parameters:
relativePath- plugin-relative configuration path- Returns:
- reversible scope registration; close it when the declaration is no longer needed
-
writeScope
Declares a legacy string-write scope.- Parameters:
relativePath- plugin-relative configuration path- Returns:
- reversible scope registration; close it when the declaration is no longer needed
-
readString
Reads a legacy string value from a declared read scope.- Parameters:
relativePath- plugin-relative configuration pathkey- logical string key- Returns:
- stored value, or empty when absent or inaccessible according to the legacy contract
-
writeString
Writes a legacy string value to a declared write scope.- Parameters:
relativePath- plugin-relative configuration pathkey- logical string keyvalue- value to persist- Throws:
PluginConfigException- if the legacy write cannot complete
-
registerSchema
Validates and asynchronously registers a typed schema and its migration route.Schema defects throw
ConfigSchemaValidationExceptionsynchronously. Operational denial, unavailability, or publication failure completes the returned stage exceptionally withConfigRegistrationException.- Parameters:
schema- non-null plugin-owned schemamigrations- non-null migration declarations leading toschema.version()- Returns:
- completion stage for accepted registration
- Throws:
ConfigSchemaValidationException- if the schema or migration graph is invalidUnsupportedOperationException- if typed configuration is not available in this context
-
read
Asynchronously reads a registered typed key.The result always includes an effective default when storage, migration, permissions, or runtime availability prevent a stored read; inspect source and error before treating it as persisted state.
- Type Parameters:
T- key value type- Parameters:
key- non-null key from an accepted schema- Returns:
- completion stage with the effective value and provenance
- Throws:
UnsupportedOperationException- if typed configuration is not available in this context
-
write
default <T> CompletionStage<ConfigWriteResult> write(ConfigKey<T> key, T value, long expectedRevision) Asynchronously writes a registered typed key using optimistic revision control.Pass the revision observed from
ConfigValue.revision(). The returned result distinguishes invalid values, conflicts, permission denial, persistence failure, and runtime unavailability without exposing backing paths.- Type Parameters:
T- key value type- Parameters:
key- non-null key from an accepted schemavalue- candidate value accepted by the key's codecexpectedRevision- non-negative revision observed by the caller- Returns:
- completion stage with write success or typed failure
- Throws:
IllegalArgumentException- ifexpectedRevisionis negativeUnsupportedOperationException- if typed configuration is not available in this context
-