Skip to main content

GroupSelectorValidator

Trait GroupSelectorValidator 

Source
pub trait GroupSelectorValidator:
    Send
    + Sync
    + Debug {
    // Required method
    fn validate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        subject: &'life1 Subject,
        selector: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Resolves an untrusted group selector against the verified Subject’s membership (B′, ratified in #921 decision 5).

The group is never trusted from the annotation. The annotation is only a selector naming which of the groups the Subject provably belongs to a request should be partitioned under. This trait is the seam that resolves that selector against the authoritative membership source — the bidirectional-consent placement group (ai.hyprstream.placement.{group,groupItem} / PlacementIndex::is_member, in hyprstream-pds/hyprstream-discovery).

§Fail-closed

The default impl (DenyUnknownGroupValidator) denies every non-empty selector, so a pool constructed without an explicit membership-backed validator can never partition capacity by an unverified group. Wire a real membership-source-backed impl at construction (where the discovery / PDS client is available) to enable group partitioning.

Returning Ok(None) for an absent selector means no group partition — never a quota bypass.

Required Methods§

Source

fn validate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject: &'life1 Subject, selector: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve selector for subject:

  • Ok(None) — no selector present → no group partition.
  • Ok(Some(group)) — selector validated: subject is a consented member of group, which becomes the authoritative partition key.
  • Err(_) — selector present but subject is not a member → reject.

Implementors§