PrefixFreeValidator
Utility for validating prefix-free properties of encoded table prefixes.
Prefix-free requirement (from ADR-0009):
- All table prefixes must be distinct (no two tables share the same prefix)
- No prefix may be a prefix of another (strict prefix-free property)
This validator operates at the byte level after encoding with length-prefix format: length(segment_bytes) ++ segment_bytes ++ 0x00
Attributes
- Source
- PrefixFreeValidator.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PrefixFreeValidator.type
Members list
Type members
Classlikes
Indicates two or more table prefixes encode to identical byte vectors.
Indicates two or more table prefixes encode to identical byte vectors.
Value parameters
- count
-
the number of occurrences
- prefix
-
the duplicated byte vector
Attributes
- Source
- PrefixFreeValidator.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ValidationResultclass Objecttrait Matchableclass AnyShow all
Indicates one encoded prefix is a strict prefix of another.
Indicates one encoded prefix is a strict prefix of another.
Value parameters
- prefix1
-
the shorter prefix that is a prefix of
prefix2 - prefix2
-
the longer prefix that starts with
prefix1
Attributes
- Source
- PrefixFreeValidator.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait ValidationResultclass Objecttrait Matchableclass AnyShow all
Indicates all prefixes are distinct and no prefix is a strict prefix of another.
Indicates all prefixes are distinct and no prefix is a strict prefix of another.
Attributes
- Source
- PrefixFreeValidator.scala
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ValidationResultclass Objecttrait Matchableclass AnyShow all
- Self type
-
Valid.type
Result of prefix-free validation, indicating whether a set of prefixes satisfies the prefix-free property.
Result of prefix-free validation, indicating whether a set of prefixes satisfies the prefix-free property.
Attributes
- Source
- PrefixFreeValidator.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Value members
Concrete methods
Collects encoded table prefixes from a schema tuple at compile time using inline expansion.
Collects encoded table prefixes from a schema tuple at compile time using inline expansion.
Type parameters
- Path
-
the mount path tuple
- Schema
-
the schema tuple of org.sigilaris.core.application.state.Entry types
Value parameters
- acc
-
accumulator for collected prefixes (defaults to empty)
Attributes
- Returns
-
list of encoded byte-vector prefixes, one per entry in the schema
- Source
- PrefixFreeValidator.scala
Example demonstrating how to validate a composed schema at runtime.
Example demonstrating how to validate a composed schema at runtime.
Attributes
- Source
- PrefixFreeValidator.scala
Formats a ValidationResult into a human-readable string for logging or test output.
Formats a ValidationResult into a human-readable string for logging or test output.
Value parameters
- result
-
the validation result to format
Attributes
- Returns
-
a multi-line string describing the outcome
- Source
- PrefixFreeValidator.scala
Checks whether byte vector a is a strict prefix of b (i.e. a is shorter and b starts with a).
Checks whether byte vector a is a strict prefix of b (i.e. a is shorter and b starts with a).
Value parameters
- a
-
the candidate prefix
- b
-
the byte vector to check against
Attributes
- Returns
-
true if
ais a strict prefix ofb - Source
- PrefixFreeValidator.scala
Validates that all prefixes in the given list are prefix-free.
Validates that all prefixes in the given list are prefix-free.
Value parameters
- prefixes
-
the list of encoded table prefixes to validate
Attributes
- Returns
-
Valid if all prefixes are distinct and prefix-free, PrefixCollision if one prefix is a strict prefix of another, or IdenticalPrefixes if duplicates exist
- Source
- PrefixFreeValidator.scala
Validates that the given schema produces prefix-free table prefixes when mounted at the given path.
Validates that the given schema produces prefix-free table prefixes when mounted at the given path.
This is a runtime check that can be used in tests or during module assembly.
Type parameters
- Path
-
the mount path tuple
- Schema
-
the schema tuple of org.sigilaris.core.application.state.Entry types
Attributes
- Returns
-
Valid if all entry prefixes are prefix-free, or an error result otherwise
- Source
- PrefixFreeValidator.scala
Validates prefixes with human-readable names for better error reporting.
Validates prefixes with human-readable names for better error reporting.
Value parameters
- prefixes
-
list of (name, encoded prefix) pairs; the names are used only for diagnostics
Attributes
- Returns
-
the ValidationResult for the underlying byte vectors
- Source
- PrefixFreeValidator.scala
Checks whether a new prefix would collide (be identical to or a strict prefix of) any existing prefix.
Checks whether a new prefix would collide (be identical to or a strict prefix of) any existing prefix.
Value parameters
- existing
-
the list of already-registered prefixes
- newPrefix
-
the candidate prefix to test
Attributes
- Returns
-
true if
newPrefixconflicts with any element inexisting - Source
- PrefixFreeValidator.scala