Class DistributedQuery<T>
A query that is sent to multiple peers.
Inherited Members
Namespace: PeerTalk.Routing
Assembly: PeerTalk.dll
Syntax
public class DistributedQuery<T>
    where T : class
  Type Parameters
| Name | Description | 
|---|---|
| T | The type of answer returned by a peer.  | 
      
Properties
| Improve this Doc View SourceAnswers
The received answers for the query.
Declaration
public IEnumerable<T> Answers { get; }
  Property Value
| Type | Description | 
|---|---|
| IEnumerable<T> | 
AnswersNeeded
The number of answers needed.
Declaration
public int AnswersNeeded { get; set; }
  Property Value
| Type | Description | 
|---|---|
| Int32 | 
Remarks
When the numbers Answers reaches this limit the RunAsync(CancellationToken) will stop.
ConcurrencyLevel
The maximum number of concurrent peer queries to perform for one distributed query.
Declaration
public int ConcurrencyLevel { get; set; }
  Property Value
| Type | Description | 
|---|---|
| Int32 | The default is 16.  | 
      
Remarks
The number of peers that are asked for the answer.
Dht
The distributed hash table.
Declaration
public Dht1 Dht { get; set; }
  Property Value
| Type | Description | 
|---|---|
| Dht1 | 
Id
The unique identifier of the query.
Declaration
public int Id { get; }
  Property Value
| Type | Description | 
|---|---|
| Int32 | 
QueryKey
The key to find.
Declaration
public MultiHash QueryKey { get; set; }
  Property Value
| Type | Description | 
|---|---|
| MultiHash | 
QueryType
The type of query to perform.
Declaration
public MessageType QueryType { get; set; }
  Property Value
| Type | Description | 
|---|---|
| MessageType | 
Methods
| Improve this Doc View SourceAddAnswer(T)
Add a answer to the query.
Declaration
public void AddAnswer(T answer)
  Parameters
| Type | Name | Description | 
|---|---|---|
| T | answer | An answer.  | 
      
RunAsync(CancellationToken)
Starts the distributed query.
Declaration
public Task RunAsync(CancellationToken cancel)
  Parameters
| Type | Name | Description | 
|---|---|---|
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised.  | 
      
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the asynchronous operation.  | 
      
Events
| Improve this Doc View SourceAnswerObtained
Raised when an answer is obtained.
Declaration
public event EventHandler<T> AnswerObtained
  Event Type
| Type | Description | 
|---|---|
| EventHandler<T> |