package
0.0.0-20240823125516-aed94cdc2c2f
Repository: https://github.com/probe-lab/go-kademlia.git
Documentation: pkg.go.dev

# README

Simple Query

Author: Guillaume Michel

SimpleQuery is a simple multi threaded single worker query mechanism.

It takes as input the target Kademlia Key, the ProtocolID of the request, the request message, an empty response message (to parse the reponse once received), a concurrency paramter, a default message timeout value, the message endpoint used to communicate with remote peers, a routing table to select the closest peers and add newly discovered peers, a scheduler to give actions to the single worker, and a handleResultFn function that is defined by the called.

The handleResultFn is used by the caller to interact with the received responses, and to save a state for the query. It is through this function that the caller decides when the query terminates.

func NewSimpleQuery(ctx context.Context, kadid key.KadKey, proto address.ProtocolID,
	req message.MinKadMessage, resp message.MinKadResponseMessage, concurrency int,
	timeout time.Duration, msgEndpoint endpoint.Endpoint, rt routingtable.RoutingTable,
	sched scheduler.Scheduler, handleResultFn HandleResultFn) *SimpleQuery

Query setup

alt text

Query execution

alt text

# Functions

DefaultConfig is the default options for SimpleQuery.
NewSimpleQuery creates a new SimpleQuery.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Config is a structure containing all the options that can be used when constructing a SimpleQuery.
No description provided by the author
No description provided by the author

# Type aliases

note that the returned []kad.NodeID are expected to be of the same type as the type returned by the routing table's NearestNodes method.
No description provided by the author
No description provided by the author
Option type for SimpleQuery.