enable logs

This commit is contained in:
Pavel Murygin 2021-10-29 18:10:01 +03:00
parent 6c20bbd407
commit 4498ad1c83
3 changed files with 108 additions and 99 deletions

View File

@ -23,7 +23,7 @@ func askAllAndSend(peer: PeerId, collectPeerInfo: PeerInfoCb, collectServiceInte
modules <- Dist.list_modules() modules <- Dist.list_modules()
services <- Srv.list() services <- Srv.list()
co collectPeerInfo(peer, ident, services, blueprints, modules) co collectPeerInfo(peer, ident, services, blueprints, modules)
collectServiceInterfaces(peer, services, collectServiceInterface, log) co collectServiceInterfaces(peer, services, collectServiceInterface, log)
func findAndAskNeighboursSchema(relayPeerId: PeerId, clientId: PeerId, collectPeerInfo: PeerInfoCb, collectServiceInterface: ServiceInterfaceCb, log: Log): func findAndAskNeighboursSchema(relayPeerId: PeerId, clientId: PeerId, collectPeerInfo: PeerInfoCb, collectServiceInterface: ServiceInterfaceCb, log: Log):
on relayPeerId: on relayPeerId:

View File

@ -192,47 +192,50 @@ export function askAllAndSend(...args) {
(seq (seq
(seq (seq
(seq (seq
(seq (call peer ("peer" "identify") [] ident)
(seq (call peer ("dist" "list_blueprints") [] blueprints)
(call peer ("peer" "identify") [] ident)
(call peer ("dist" "list_blueprints") [] blueprints)
)
(call peer ("dist" "list_modules") [] modules)
)
(call peer ("srv" "list") [] services)
) )
(par (call peer ("dist" "list_modules") [] modules)
)
(call peer ("srv" "list") [] services)
)
(par
(seq
(call -relay- ("op" "noop") [])
(xor
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(null)
)
)
(par
(seq
(seq
(xor
(fold services srv
(seq
(seq
(call peer ("srv" "get_interface") [srv.$.id!] iface)
(call peer ("op" "array") [srv.$.id! iface] $ifaces)
)
(next srv)
)
)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(xor (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
) )
(null)
) )
(call -relay- ("op" "noop") [])
) )
(xor (xor
(fold services srv (call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer $ifaces])
(seq (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
(seq
(call peer ("srv" "get_interface") [srv.$.id!] iface)
(call peer ("op" "array") [srv.$.id! iface] $ifaces)
)
(next srv)
)
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
) )
) )
(call -relay- ("op" "noop") []) (null)
)
(xor
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer $ifaces])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
) )
) )
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
@ -409,47 +412,50 @@ export function findAndAskNeighboursSchema(...args) {
(seq (seq
(seq (seq
(seq (seq
(seq (call n2 ("peer" "identify") [] ident)
(seq (call n2 ("dist" "list_blueprints") [] blueprints)
(call n2 ("peer" "identify") [] ident)
(call n2 ("dist" "list_blueprints") [] blueprints)
)
(call n2 ("dist" "list_modules") [] modules)
)
(call n2 ("srv" "list") [] services)
) )
(par (call n2 ("dist" "list_modules") [] modules)
)
(call n2 ("srv" "list") [] services)
)
(par
(seq
(call -relay- ("op" "noop") [])
(xor
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [n2 ident services blueprints modules])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(null)
)
)
(par
(seq
(seq
(xor
(fold services srv
(seq
(seq
(call n2 ("srv" "get_interface") [srv.$.id!] iface)
(call n2 ("op" "array") [srv.$.id! iface] $ifaces)
)
(next srv)
)
)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(xor (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [n2 ident services blueprints modules])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
) )
(null)
) )
(call -relay- ("op" "noop") [])
) )
(xor (xor
(fold services srv (call %init_peer_id% ("callbackSrv" "collectServiceInterface") [n2 $ifaces])
(seq (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
(seq
(call n2 ("srv" "get_interface") [srv.$.id!] iface)
(call n2 ("op" "array") [srv.$.id! iface] $ifaces)
)
(next srv)
)
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
) )
) )
(call -relay- ("op" "noop") []) (null)
)
(xor
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [n2 $ifaces])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
) )
) )
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
@ -624,47 +630,50 @@ export function getAll(...args) {
(seq (seq
(seq (seq
(seq (seq
(seq (call peer ("peer" "identify") [] ident)
(seq (call peer ("dist" "list_blueprints") [] blueprints)
(call peer ("peer" "identify") [] ident)
(call peer ("dist" "list_blueprints") [] blueprints)
)
(call peer ("dist" "list_modules") [] modules)
)
(call peer ("srv" "list") [] services)
) )
(par (call peer ("dist" "list_modules") [] modules)
)
(call peer ("srv" "list") [] services)
)
(par
(seq
(call -relay- ("op" "noop") [])
(xor
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(null)
)
)
(par
(seq
(seq
(xor
(fold services srv
(seq
(seq
(call peer ("srv" "get_interface") [srv.$.id!] iface)
(call peer ("op" "array") [srv.$.id! iface] $ifaces)
)
(next srv)
)
)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(xor (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
) )
(null)
) )
(call -relay- ("op" "noop") [])
) )
(xor (xor
(fold services srv (call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer $ifaces])
(seq (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
(seq
(call peer ("srv" "get_interface") [srv.$.id!] iface)
(call peer ("op" "array") [srv.$.id! iface] $ifaces)
)
(next srv)
)
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
) )
) )
(call -relay- ("op" "noop") []) (null)
)
(xor
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer $ifaces])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
) )
) )
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])

View File

@ -131,7 +131,7 @@ function genFlags(peerId, relays, relayIdx) {
// alias ServiceInterfaceCb: PeerId, string, Interface -> () // alias ServiceInterfaceCb: PeerId, string, Interface -> ()
function collectServiceInterface(peer_id, ifaces) { function collectServiceInterface(peer_id, ifaces) {
// console.count(`service interface from ${peer_id}`); console.log(`service interface from ${peer_id}`);
try { try {
for (let srvIdAndInterfaceTuple of ifaces) { for (let srvIdAndInterfaceTuple of ifaces) {
const eventRaw = { const eventRaw = {
@ -148,7 +148,7 @@ function genFlags(peerId, relays, relayIdx) {
// alias PeerInfoCb: PeerId, Info, []Service, []Blueprint, []Module -> () // alias PeerInfoCb: PeerId, Info, []Service, []Blueprint, []Module -> ()
function collectPeerInfo(peerId, identify, services, blueprints, modules, interfaces) { function collectPeerInfo(peerId, identify, services, blueprints, modules, interfaces) {
// console.log('peer info from %s, %s services', peerId, services.length); console.log('peer info from %s, %s services', peerId, services.length);
try { try {
const eventRaw = { const eventRaw = {
peerId, peerId,