Package com.helix.core.ml
Class LocalModelRegistry
java.lang.Object
com.helix.core.ml.LocalModelRegistry
- All Implemented Interfaces:
ModelRegistry
In-memory and filesystem-backed implementation of
ModelRegistry.
Provides thread-safe model registration, semantic version resolution, active version activation, and filesystem discovery for local ONNX model stores.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateModelVersion(String modelName, String version) Marks a specific version of a model as active for rule compilation and evaluation.booleanChecks if an active version exists for the specified model.booleanhasModelVersion(String modelName, String version) Checks if a specific version exists for the specified model.voidinvalidateModel(String modelName) Invalidates and deregisters all versions of the named model.voidinvalidateModelVersion(String modelName, String version) Invalidates a specific version of a model.Lists all registered models in their active versions.listVersions(String modelName) Lists all available versions for a specific model.voidregisterModel(OnnxModelDescriptor descriptor) Registers a new model descriptor or version in the registry.resolveModel(String modelName) Resolves the currently active version of a model by its identifier.resolveModel(String modelName, String version) Resolves a specific version of a model.intscanModels(Function<String, List<String>> featureProvider) Scans the configured base directory for `.onnx` model files and registers them.
-
Constructor Details
-
LocalModelRegistry
public LocalModelRegistry() -
LocalModelRegistry
-
-
Method Details
-
getBaseDirectory
-
resolveModel
Description copied from interface:ModelRegistryResolves the currently active version of a model by its identifier.- Specified by:
resolveModelin interfaceModelRegistry- Parameters:
modelName- unique name of the model (e.g., "fraud_model_v1")- Returns:
- optional containing the active model descriptor, or empty if not registered
-
resolveModel
Description copied from interface:ModelRegistryResolves a specific version of a model.- Specified by:
resolveModelin interfaceModelRegistry- Parameters:
modelName- unique name of the modelversion- semantic version string (e.g., "1.0.0")- Returns:
- optional containing the model descriptor, or empty if not found
-
registerModel
Description copied from interface:ModelRegistryRegisters a new model descriptor or version in the registry.- Specified by:
registerModelin interfaceModelRegistry- Parameters:
descriptor- descriptor containing model metadata and storage paths
-
activateModelVersion
Description copied from interface:ModelRegistryMarks a specific version of a model as active for rule compilation and evaluation.- Specified by:
activateModelVersionin interfaceModelRegistry- Parameters:
modelName- unique name of the modelversion- version string to activate
-
invalidateModel
Description copied from interface:ModelRegistryInvalidates and deregisters all versions of the named model.- Specified by:
invalidateModelin interfaceModelRegistry- Parameters:
modelName- unique name of the model to invalidate
-
invalidateModelVersion
Description copied from interface:ModelRegistryInvalidates a specific version of a model.- Specified by:
invalidateModelVersionin interfaceModelRegistry- Parameters:
modelName- unique name of the modelversion- version to invalidate
-
listModels
Description copied from interface:ModelRegistryLists all registered models in their active versions.- Specified by:
listModelsin interfaceModelRegistry- Returns:
- unmodifiable list of active model descriptors
-
listVersions
Description copied from interface:ModelRegistryLists all available versions for a specific model.- Specified by:
listVersionsin interfaceModelRegistry- Parameters:
modelName- unique name of the model- Returns:
- list of model descriptors across all registered versions
-
hasModel
Description copied from interface:ModelRegistryChecks if an active version exists for the specified model.- Specified by:
hasModelin interfaceModelRegistry- Parameters:
modelName- model name to verify- Returns:
- true if an active model exists
-
hasModelVersion
Description copied from interface:ModelRegistryChecks if a specific version exists for the specified model.- Specified by:
hasModelVersionin interfaceModelRegistry- Parameters:
modelName- model name to verifyversion- version string to verify- Returns:
- true if the specified model version exists
-
scanModels
Scans the configured base directory for `.onnx` model files and registers them.- Parameters:
featureProvider- function mapping model names to expected input feature signatures- Returns:
- count of discovered and registered model files
- Throws:
IOException- if directory traversal fails
-