Proposal: synchronous (non-blocking) flag evaluation API alongside the async one

Aperta
#141 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
api, backend

Direzione di ricerca

Inizia leggendo gli entry point esistenti Client::get_value/getdetails e FeatureProvider::resolve*, quindi esamina come viene usato tokio::sync::RwLock per lo stato del provider. Il lavoro è completato quando i maintainer concordano sul sync trait, sugli accessor di Client, sulla strategia per lo stato e sulla decisione relativa a cargo-feature, preservando l’async API.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

The Rust SDK currently exposes an async-only evaluation API: every Client::get_*_value/get_*_details method and every FeatureProvider::resolve_* method is async. This proposal asks for a complementary synchronous evaluation path for providers whose resolution is purely in-memory, without removing or changing the existing async API.

Motivation

Our backend servers resolve flags from a local, periodically refreshed in-memory cache (with state polled from S3 in a background task,). For such providers, evaluation itself performs no I/O , yet the async-only API still forces us to set.await through dozens of unrelated functions, even though the underlying evaluation is a hash-map lookup.

The Java SDK also provides a sync-first API (client.getBooleanValue(...))

Spec compliance

Requirement 1.4.12
states:

The client SHOULD provide asynchronous or non-blocking mechanisms for flag evaluation.

This is a SHOULD, not a MUST.

Design sketch (for discussion)

  1. SyncFeatureProvider trait: same surface as FeatureProvider but with plain fn resolve_*_value(...) -> EvaluationResult<ResolutionDetails<T>> methods. Intended for providers backed by local state (files, env vars, in-memory caches).
  2. Sync accessors on Client (e.g. get_bool_value_sync(...) -> EvaluationResult<bool>): available when the bound provider implements SyncFeatureProvider;
  3. Sync-safe internal state for the sync path: the sync accessors must not go through tokio::sync::RwLock::blocking_*. Options include a
    std::sync::RwLock/arc-swap-style snapshot for provider registration.

Open questions:

  • Should this live behind a cargo feature (e.g. sync) to keep the default dependency footprint unchanged?

If the maintainers are open to this direction, I'm happy to work on a PR implementing the agreed design.

Lingua principale
Rust
Stelle
53
Fork
15
Merge medio
1m
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-feature/rust-sdk

Tutte le issue di open-feature/rust-sdk

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.