Files
evm/peer
Dan LaineandGitHub 53a0b4a668 Add contexts (#874)
* add context to SendAppRequest signature

* stop waiting on app response upon context cancellation

* add contexts in other network send functions

* crosschain cancellation

* app request cancellation

* app request any on cancellation

* fixes

* change ErrorContains to ErrorIs

* treat as fatal TODO

* use context

* simplify texts

* test nits

* comment; make responseChan buffer length 1

* update test

* peer: remove TODOs for treating appSender err as fatal
2023-10-03 19:51:51 -04:00
..
2023-01-23 14:06:36 -05:00
2023-10-03 19:51:51 -04:00
2023-10-03 19:51:51 -04:00
2023-10-03 19:51:51 -04:00
2022-12-06 18:09:37 -07:00
2022-09-22 18:42:37 +09:00
2023-10-03 19:51:51 -04:00

Peer Package

The peer package handles networking for the VM.

Network

The Network interface implements the networking portion of the required VM interface. The VM utilizes the Network interface to:

  • Set an App Gossip handler for incoming VM gossip messages
  • Set an App Request handler for incoming VM request messages
  • Send App Requests to peers in the network and specify a response handler to be called upon receiving a response or failure notification
  • Send App Gossip messages to the network

Client

The client utilizes the Network interface to send requests to peers on the network and utilizes the waitingHandler to wait until a response or failure is received from the AvalancheGo networking layer.

This allows the user of Client to treat it as if it were returning results from the network synchronously.

result, err := client.Request(nodeID, request) // Blocks until receiving a response from the network
if err != nil {
    return err
}

foo(result) // do something with the result