Bedrock.ControlPlane.Config.TSLTypeValidator (bedrock v0.5.3)
View SourceTSL (Transaction System Layout) type safety validation to prevent data corruption.
This module provides comprehensive type checking for TSL fields to prevent issues like integer-to-binary version conversion errors that can cause MVCC lookup failures. The critical distinction is between:
- Log ranges: should contain integers (not binary versions)
- Version fields: should contain Version.t() binary versions
Provides both defensive validation (returns errors) and assertive validation (raises).
Summary
Functions
Validates TSL type safety assertively, raising on errors.
Validates TSL type safety defensively, returning error tuples.
Functions
@spec assert_type_safety!(Bedrock.ControlPlane.Config.TransactionSystemLayout.t()) :: Bedrock.ControlPlane.Config.TransactionSystemLayout.t()
Validates TSL type safety assertively, raising on errors.
Use this for validating new data where type mismatches indicate programmer errors.
@spec validate_type_safety(Bedrock.ControlPlane.Config.TransactionSystemLayout.t()) :: :ok | {:error, term()}
Validates TSL type safety defensively, returning error tuples.
Use this for validating old/recovered data where corruption should be handled gracefully.