public override async Task <NodeList> GetNodes(NodesRequest request, ServerCallContext context) { if (request == null) { return(new NodeList()); } Logger.LogDebug($"Peer {context.GetPeerInfo()} requested {request.MaxCount} nodes."); NodeList nodes; try { nodes = await _peerDiscoveryService.GetNodesAsync(request.MaxCount); } catch (Exception e) { Logger.LogError(e, "Get nodes error: "); throw; } Logger.LogDebug($"Sending {nodes.Nodes.Count} to {context.GetPeerInfo()}."); return(nodes); }
public NodesController(IAuthenticationProvider authProvider) { _auth = authProvider; var k8s = new KubeRequestBuilder(_auth); _nodesRequest = k8s.Create <NodesRequest>(); }
public NodesController(IAuthenticationProvider authProvider, IOptions <KubeOptions> options) { _auth = authProvider; var k8s = new KubeRequestBuilder(_auth, options.Value); _nodesRequest = k8s.Create <NodesRequest>(); }
public override async Task <NodeList> GetNodes(NodesRequest request, ServerCallContext context) { if (request == null) { return(new NodeList()); } Logger.LogDebug($"Peer {context.GetPeerInfo()} requested {request.MaxCount} nodes."); var nodes = await _peerDiscoveryService.GetNodesAsync(request.MaxCount); Logger.LogDebug($"Sending {nodes.Nodes.Count} to {context.GetPeerInfo()}."); return(nodes); }
public async Task GetNodes_Test() { var context = BuildServerCallContext(); var result = await _serverService.GetNodes(null, context); result.ShouldBe(new NodeList()); var node = new NodeInfo { Endpoint = "127.0.0.1:2001", Pubkey = ByteString.CopyFromUtf8("pubkey1") }; await _nodeManager.AddOrUpdateNodeAsync(node); var request = new NodesRequest { MaxCount = 1 }; result = await _serverService.GetNodes(request, context); result.Nodes.Count.ShouldBe(1); result.Nodes[0].ShouldBe(node); }
private void RequestUpdate() { Log.v("RequestUpdate!!!"); var bbox = mapControl.GetBoundingBox(); if (bbox == null) { return; } if (DataHolder.Instance.QueryString?.Length >= 3) { // do not query new nodes when search is active return; } var task = new NodesRequest(bbox).Execute(); task.ContinueWith((items) => { DataHolder.Instance.Nodes = items.Result; }); }
/// <summary> Setter constructor. </summary> public Nodes(NodesRequest request) { Request = request; Response = new NodesResponse(); }