Class SLORegistry

java.lang.Object
com.tnsai.quality.slo.SLORegistry

public final class SLORegistry extends Object
In-memory store of SLODefinitions, looked up by id (issue #92). The programmatic API foundation — a YAML config loader on top of this lands in a follow-up.

Concurrency: backed by ConcurrentHashMap. all() returns an immutable snapshot — callers iterate freely without worrying about a concurrent register(com.tnsai.quality.slo.SLODefinition) mutating the list.

Since:
0.5.0 (issue #92)
  • Constructor Details

    • SLORegistry

      public SLORegistry()
  • Method Details

    • register

      public void register(SLODefinition definition)
      Register a new SLO. If an SLO with the same id already exists, it is replaced — useful for hot-reload scenarios.
    • registerAll

      public void registerAll(List<SLODefinition> defs)
      Convenience: register many at once.
    • find

      public Optional<SLODefinition> find(String id)
      Look up an SLO by id.
    • remove

      public void remove(String id)
      Remove an SLO. No-op when the id is unknown.
    • all

      public List<SLODefinition> all()
      Snapshot of every registered SLO. Immutable; safe to iterate concurrently with register(com.tnsai.quality.slo.SLODefinition).
    • findApplicable

      public List<SLODefinition> findApplicable(EventScope eventScope)
      Find every SLO whose scope matches the given event scope — used by the (follow-up) SLOAwareHook to figure out which SLOs apply to an in-flight call.
    • size

      public int size()
    • clear

      public void clear()