Skip to main content

SimilaritySessionResolver

Trait SimilaritySessionResolver 

Source
pub trait SimilaritySessionResolver:
    Send
    + Sync
    + 'static {
    // Required method
    fn resolve_for_node(
        &self,
        session: &SimilaritySession,
        node: &SimilaritySessionNode,
        entities: &[SimilarityEntityId],
        completion: &SimilaritySessionCompletion,
        resolver_id: SimilaritySessionResolverId,
    );

    // Provided methods
    fn update_settings(&self, _settings: &Settings) -> bool { ... }
    fn prepare_for_node(
        &self,
        _session: &SimilaritySession,
        _node: &SimilaritySessionNode,
        _completion: &SimilaritySessionCompletion,
        _resolver_id: SimilaritySessionResolverId,
    ) { ... }
}
Expand description

Selects provider results for session entities.

Calls for nodes in the same processing group may run at the same time. Do not keep the session after a callback returns.

Required Methods§

Source

fn resolve_for_node( &self, session: &SimilaritySession, node: &SimilaritySessionNode, entities: &[SimilarityEntityId], completion: &SimilaritySessionCompletion, resolver_id: SimilaritySessionResolverId, )

Selects results after a node’s providers have run.

To select a result, call SimilaritySessionNode::set_resolved_result for the given entity. To request another provider and resolver round, call SimilaritySessionNode::add_scheduled_entity.

Provided Methods§

Source

fn update_settings(&self, _settings: &Settings) -> bool

Replaces this resolver’s settings only if they are valid.

Return false without changing the current settings when the new settings are invalid or updates are not supported. Use SimilaritySession::update_resolver_settings so affected entities are resolved again.

Source

fn prepare_for_node( &self, _session: &SimilaritySession, _node: &SimilaritySessionNode, _completion: &SimilaritySessionCompletion, _resolver_id: SimilaritySessionResolverId, )

Prepares a node after its entities are created and before providers run.

This is useful for large graphs where not all views are available, but the resolver needs to change the scheduled entities or add new entities.

Implementors§