eclipse-uprotocol / eclipse-uprotocol/up-streamer-rust

Clarify fetch_cache_entry_with_wildcard semantics (effective wildcard merge + explicit no-match contract)

Open
#81 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4
Forks
15
PR merge metrics
No merged PRs in 30d

Description

## Context
`fetch_cache_entry_with_wildcard` in `up-streamer/src/routing/subscription_cache.rs` is intended to compute the effective subscriber lookup for one egress authority by merging:
- exact authority rows (`entry`)
- wildcard authority rows (`"*"`)

(except when `entry == "*"`, where wildcard should not be double-counted).

That merge behavior is correct and should be preserved.

## Problem
The current return type `Option` overloads `None` with two meanings:
- no matching subscribers
- cache access/lock failure

This makes the API ambiguous and harder to reason about.

## Proposed Direction
- Represent no-match as an empty lookup.
- If failure signaling is needed, use an explicit `Result` contract:
- `Ok(empty_lookup)` = no matching subscribers
- `Err(...)` = lock/access failure
- Keep wildcard merge semantics unchanged (exact + wildcard).
- Update call sites/tests to align with the explicit contract.

## Why
Current call sites already treat `None` as empty in practice, so this change aligns the API with real behavior and makes intent explicit.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.