Class BloomFilterServiceImpl
java.lang.Object
it.gov.pagopa.onboarding.citizen.service.BloomFilterServiceImpl
- All Implemented Interfaces:
BloomFilterService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void> Adds a fiscal code to the Bloom Filter.reactor.core.publisher.Mono<Boolean> Checks if a fiscal code is present in the Bloom Filter (boolean response).reactor.core.publisher.Mono<String> mightContain(String fiscalCode) Checks if a fiscal code might be present in the Bloom Filter.
-
Constructor Details
-
BloomFilterServiceImpl
-
-
Method Details
-
add
Adds a fiscal code to the Bloom Filter.
- Parameters:
value- the fiscal code to add (plain text, will be hashed for logging)- Returns:
Mono<Void>completing when the value is added
-
mightContain
Checks if a fiscal code might be present in the Bloom Filter.
Note: False negatives are impossible, false positives occur with ~1% probability.
Implementation note: Returns string literals for backward compatibility with existing API contracts:
"OK"→ Fiscal code might exist (proceed with database verification)"NO CHANNELS ENABLED"→ Fiscal code definitely absent (skip database query)
For internal usage, consider using
contains(String)which returns a boolean.- Specified by:
mightContainin interfaceBloomFilterService- Parameters:
fiscalCode- plain fiscal code- Returns:
"true"if might exist (requires DB check),"false"if definitely absent
-
contains
Checks if a fiscal code is present in the Bloom Filter (boolean response).
Preferred over
mightContain(String)for internal usage as it returns a strongly-typed boolean instead of string literals.- Parameters:
value- the fiscal code to check- Returns:
Mono<Boolean>emittingtrueif might exist,falseif definitely absent
-