validate_compatibility

Function validate_compatibility 

Source
pub fn validate_compatibility(
    algorithm: &Algorithm,
    stage_type: &str,
) -> Result<(), PipelineError>
Expand description

Validates algorithm compatibility with stage type

§Purpose

Ensures an algorithm is compatible with its intended processing stage type. Prevents misconfiguration like using compression algorithms for encryption stages. # Why Early validation of algorithm-stage compatibility:

  • Prevents runtime errors in processing pipelines
  • Ensures type safety across pipeline configuration
  • Provides clear error messages for configuration issues

§Arguments

  • algorithm - The algorithm to validate
  • stage_type - Stage type string (case-insensitive):
    • “compression” - Requires compression algorithm
    • “encryption” - Requires encryption algorithm
    • “hashing” - Requires hashing algorithm
    • “custom” - Accepts any algorithm

§Returns

  • Ok(()) - Algorithm is compatible with stage type
  • Err(PipelineError::InvalidConfiguration) - Incompatible or unknown stage type

§Errors

Returns PipelineError::InvalidConfiguration when:

  • Algorithm doesn’t match required stage type category
  • Stage type is unknown/unsupported

§Examples