pub struct EpContextRegistry { /* private fields */ }Expand description
Registry mapping an EPContext node’s source key → the EpId that owns
it (docs/ORT2.md §55.6).
EPs register the source key(s) they accept; dispatch (claim) is a pure
lookup. There are no hardcoded vendor names here — the keys come entirely
from each EP’s ExecutionProvider::context_source_keys.
§Duplicate keys are rejected (reject-duplicate-key)
register returns EpError::DuplicateContextSource if a source key is
already claimed by another EP, rather than silently overwriting
(last-writer-wins) it. Rationale: two EPs claiming the same source is a
configuration error (the model would dispatch ambiguously), and silently
dropping one binding would make which EP restores a context depend on
registration order — a non-deterministic, hard-to-debug failure at load. A
registrant re-declaring the same (key, ep) binding is idempotent and
accepted (it is not a conflict).
Implementations§
Source§impl EpContextRegistry
impl EpContextRegistry
Sourcepub fn register(&mut self, ep: EpId, source_keys: &[String]) -> Result<()>
pub fn register(&mut self, ep: EpId, source_keys: &[String]) -> Result<()>
Declare that ep accepts each key in source_keys for EPContext
dispatch. Keys come from the EP’s own config/data (§55.6), never
hardcoded here.
§Errors
Returns EpError::DuplicateContextSource if any key is already
registered to a different EP (reject-duplicate-key). Re-registering
the same (key, ep) binding is idempotent. On error, keys processed
before the conflict remain registered (the caller should treat a
duplicate as a fatal configuration error).
Sourcepub fn claim(&self, source: Option<&str>) -> Option<EpId>
pub fn claim(&self, source: Option<&str>) -> Option<EpId>
Look up the EP that owns a node’s source attribute (§55.6).
A pure lookup: None source (attribute absent) or a source matching no
registered EP both yield None — the node is unclaimed. The session
turns an unclaimed node into a clear EpError::NoEpForContext rather
than guessing.
Trait Implementations§
Source§impl Clone for EpContextRegistry
impl Clone for EpContextRegistry
Source§fn clone(&self) -> EpContextRegistry
fn clone(&self) -> EpContextRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more