koi_net.components.resolver

Classes

NetworkResolver(log, config, cache, ...)

Handles resolving nodes or knowledge objects from the network.

class koi_net.components.resolver.NetworkResolver(log, config, cache, identity, graph, request_handler)[source]

Bases: object

Handles resolving nodes or knowledge objects from the network.

Parameters:
cache: Cache
config: BaseNodeConfig
fetch_remote_bundle(rid)[source]

Attempts to fetch a bundle by RID from known peer nodes.

Return type:

tuple[Bundle | None, KoiNetNode | None]

Parameters:

rid (RID)

fetch_remote_manifest(rid)[source]

Attempts to fetch a manifest by RID from known peer nodes.

Return type:

tuple[Bundle | None, KoiNetNode | None]

Parameters:

rid (RID)

get_state_providers(rid_type)[source]

Returns list of node RIDs which provide state for specified RID type.

Return type:

list[KoiNetNode]

Parameters:

rid_type (RIDType)

graph: NetworkGraph
identity: NodeIdentity
log: Logger
poll_event_queue: dict
poll_neighbors()[source]

Polls all neighbor nodes and returns compiled list of events.

Neighbor nodes include any node this node shares an edge with, or the first contact, if no neighbors are found.

NOTE: This function does not poll nodes that don’t share edges with this node. Events sent by non neighboring nodes will not be polled.

Return type:

dict[KoiNetNode, list[Event]]

request_handler: RequestHandler
webhook_event_queue: dict