mirror of
https://github.com/fluencelabs/dashboard
synced 2024-12-04 23:30:20 +00:00
Add 'showStat', update fluenceJS & aqua (#32)
This commit is contained in:
parent
99ce91a47c
commit
f2d182c597
1029
package-lock.json
generated
1029
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/fluencelabs/fluence-admin#readme",
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "0.17.1",
|
||||
"@fluencelabs/fluence": "0.19.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.10",
|
||||
"css-spinners": "^1.0.1",
|
||||
"tachyons": "^4.12.0",
|
||||
@ -41,7 +41,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@fluencelabs/aqua": "^0.5.3-260",
|
||||
"@fluencelabs/aqua": "0.6.0-263",
|
||||
"@fluencelabs/aqua-lib": "0.3.3",
|
||||
"@types/yup": "^0.29.11",
|
||||
"babel-loader": "^8.1.0",
|
||||
|
69
src/_aqua/app.d.ts
vendored
69
src/_aqua/app.d.ts
vendored
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.4.0-235
|
||||
* Aqua version: 0.6.0-263
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -20,20 +20,71 @@ import {
|
||||
// Functions
|
||||
|
||||
|
||||
export function collectServiceInterfaces(peer_: string, services: { blueprint_id: string; id: string; owner_id: string; }[], collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function collectServiceInterfaces(peer: FluencePeer, peer_: string, services: { blueprint_id: string; id: string; owner_id: string; }[], collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function askAllAndSend(
|
||||
peer_: string,
|
||||
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function askAllAndSend(
|
||||
peer: FluencePeer,
|
||||
peer_: string,
|
||||
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
|
||||
|
||||
export function askAllAndSend(peer_: string, collectPeerInfo: (arg0: string, arg1: { external_addresses: string[]; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>, collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function askAllAndSend(peer: FluencePeer, peer_: string, collectPeerInfo: (arg0: string, arg1: { external_addresses: string[]; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>, collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function getAll(
|
||||
knownPeers: string[],
|
||||
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function getAll(
|
||||
peer: FluencePeer,
|
||||
knownPeers: string[],
|
||||
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
|
||||
|
||||
export function findAndAskNeighboursSchema(relayPeerId: string, clientId: string, collectPeerInfo: (arg0: string, arg1: { external_addresses: string[]; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>, collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function findAndAskNeighboursSchema(peer: FluencePeer, relayPeerId: string, clientId: string, collectPeerInfo: (arg0: string, arg1: { external_addresses: string[]; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>, collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function findAndAskNeighboursSchema(
|
||||
relayPeerId: string,
|
||||
clientId: string,
|
||||
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function findAndAskNeighboursSchema(
|
||||
peer: FluencePeer,
|
||||
relayPeerId: string,
|
||||
clientId: string,
|
||||
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
|
||||
|
||||
export function getAll(knownPeers: string[], collectPeerInfo: (arg0: string, arg1: { external_addresses: string[]; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>, collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function getAll(peer: FluencePeer, knownPeers: string[], collectPeerInfo: (arg0: string, arg1: { external_addresses: string[]; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>, collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>, config?: {ttl?: number}): Promise<void>;
|
||||
export function collectServiceInterfaces(
|
||||
peer_: string,
|
||||
services: { blueprint_id: string; id: string; owner_id: string; }[],
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function collectServiceInterfaces(
|
||||
peer: FluencePeer,
|
||||
peer_: string,
|
||||
services: { blueprint_id: string; id: string; owner_id: string; }[],
|
||||
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
|
577
src/_aqua/app.js
577
src/_aqua/app.js
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.4.0-235
|
||||
* Aqua version: 0.6.0-263
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -18,114 +18,10 @@ import {
|
||||
|
||||
// Functions
|
||||
|
||||
export function collectServiceInterfaces(...args) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "peer") [] peer)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "services") [] services)
|
||||
)
|
||||
(fold services srv
|
||||
(par
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call peer ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(next srv)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "collectServiceInterfaces",
|
||||
"returnType" : {
|
||||
"tag" : "void"
|
||||
},
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "peer",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "services",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "collectServiceInterface",
|
||||
"argType" : {
|
||||
"tag" : "callback",
|
||||
"callback" : {
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "arg0",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg1",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg2",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "void"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export function askAllAndSend(...args) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -152,38 +48,44 @@ export function askAllAndSend(...args) {
|
||||
(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])
|
||||
)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(fold services srv
|
||||
(par
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call peer ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
(seq
|
||||
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(next srv)
|
||||
)
|
||||
(par
|
||||
(fold services srv
|
||||
(par
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call peer ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
(next srv)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
|
||||
@ -293,10 +195,195 @@ export function askAllAndSend(...args) {
|
||||
}
|
||||
|
||||
|
||||
export function getAll(...args) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "knownPeers") [] knownPeers)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(par
|
||||
(fold knownPeers peer
|
||||
(par
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call peer ("peer" "identify") [] ident)
|
||||
(call peer ("dist" "list_blueprints") [] blueprints)
|
||||
)
|
||||
(call peer ("dist" "list_modules") [] modules)
|
||||
)
|
||||
(call peer ("srv" "list") [] services)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(seq
|
||||
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
)
|
||||
(par
|
||||
(fold services srv
|
||||
(par
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call peer ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
(next srv)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
)
|
||||
)
|
||||
(next peer)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "getAll",
|
||||
"returnType" : {
|
||||
"tag" : "void"
|
||||
},
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "knownPeers",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "collectPeerInfo",
|
||||
"argType" : {
|
||||
"tag" : "callback",
|
||||
"callback" : {
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "arg0",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg1",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg2",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg3",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg4",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "void"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "collectServiceInterface",
|
||||
"argType" : {
|
||||
"tag" : "callback",
|
||||
"callback" : {
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "arg0",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg1",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg2",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "void"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export function findAndAskNeighboursSchema(...args) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -310,85 +397,97 @@ export function findAndAskNeighboursSchema(...args) {
|
||||
)
|
||||
(xor
|
||||
(seq
|
||||
(call relayPeerId ("kad" "neighborhood") [clientId [] []] neighbors)
|
||||
(fold neighbors n
|
||||
(seq
|
||||
(call relayPeerId ("kad" "neighborhood") [clientId [] []] neighbors)
|
||||
(par
|
||||
(xor
|
||||
(seq
|
||||
(call n ("kad" "neighborhood") [clientId [] []] neighbors2)
|
||||
(fold neighbors2 n2
|
||||
(par
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(fold neighbors n
|
||||
(par
|
||||
(xor
|
||||
(seq
|
||||
(call n ("kad" "neighborhood") [clientId [] []] neighbors2)
|
||||
(par
|
||||
(fold neighbors2 n2
|
||||
(par
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call n2 ("peer" "identify") [] ident)
|
||||
(call n2 ("dist" "list_blueprints") [] blueprints)
|
||||
(seq
|
||||
(seq
|
||||
(call n2 ("peer" "identify") [] ident)
|
||||
(call n2 ("dist" "list_blueprints") [] blueprints)
|
||||
)
|
||||
(call n2 ("dist" "list_modules") [] modules)
|
||||
)
|
||||
(call n2 ("srv" "list") [] services)
|
||||
)
|
||||
(call n2 ("dist" "list_modules") [] modules)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call n2 ("srv" "list") [] services)
|
||||
)
|
||||
(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])
|
||||
)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(fold services srv
|
||||
(par
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(xor
|
||||
(seq
|
||||
(call n2 ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [n2 ident services blueprints modules])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [n2 srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
(seq
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
(par
|
||||
(fold services srv
|
||||
(par
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call n2 ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [n2 srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
(next srv)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(next srv)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
(next n2)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
)
|
||||
(next n2)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
|
||||
(next n)
|
||||
)
|
||||
)
|
||||
(next n)
|
||||
(null)
|
||||
)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 7])
|
||||
@ -504,136 +603,64 @@ export function findAndAskNeighboursSchema(...args) {
|
||||
}
|
||||
|
||||
|
||||
export function getAll(...args) {
|
||||
export function collectServiceInterfaces(...args) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "knownPeers") [] knownPeers)
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "peer") [] peer)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "services") [] services)
|
||||
)
|
||||
(xor
|
||||
(fold knownPeers peer
|
||||
(par
|
||||
(fold services srv
|
||||
(par
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call peer ("peer" "identify") [] ident)
|
||||
(call peer ("dist" "list_blueprints") [] blueprints)
|
||||
)
|
||||
(call peer ("dist" "list_modules") [] modules)
|
||||
)
|
||||
(call peer ("srv" "list") [] services)
|
||||
)
|
||||
(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])
|
||||
)
|
||||
)
|
||||
(call peer ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(fold services srv
|
||||
(par
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call peer ("srv" "get_interface") [srv.$.id!] iface)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(next srv)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(next peer)
|
||||
(next srv)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
|
||||
(null)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "getAll",
|
||||
"functionName" : "collectServiceInterfaces",
|
||||
"returnType" : {
|
||||
"tag" : "void"
|
||||
},
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "knownPeers",
|
||||
"name" : "peer",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "collectPeerInfo",
|
||||
"name" : "services",
|
||||
"argType" : {
|
||||
"tag" : "callback",
|
||||
"callback" : {
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "arg0",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg1",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg2",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg3",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "arg4",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "void"
|
||||
}
|
||||
}
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
114
src/index.js
114
src/index.js
@ -127,6 +127,118 @@ function genFlags(peerId, relays, relayIdx) {
|
||||
flags: flags,
|
||||
});
|
||||
|
||||
if (window) {
|
||||
window.collectedData = {
|
||||
// service ids
|
||||
services: new Map(),
|
||||
// services per creator
|
||||
creators: new Map(),
|
||||
// blueprints used in services
|
||||
serviceBlueprints: new Set(),
|
||||
// all blueprints
|
||||
blueprints: new Map(),
|
||||
// module hashes used in services
|
||||
serviceModules: new Set(),
|
||||
// unique module names used in services
|
||||
moduleNames: new Set(),
|
||||
// all modules
|
||||
modules: new Map(),
|
||||
// peer infos per PeerId
|
||||
peerInfos: new Map(),
|
||||
};
|
||||
|
||||
window.showStat = () => {
|
||||
/*
|
||||
1490 users created 3018 services
|
||||
from 280 blueprints
|
||||
from 299 modules of which there are 43 unique module names
|
||||
*/
|
||||
let usersCount = window.collectedData.creators.size;
|
||||
let serviceCount = window.collectedData.services.size;
|
||||
let blueprintCount = window.collectedData.serviceBlueprints.size;
|
||||
let moduleCount = window.collectedData.serviceModules.size;
|
||||
let nameCount = window.collectedData.moduleNames.size;
|
||||
let totalModules = window.collectedData.modules.size;
|
||||
|
||||
console.log(`${usersCount} users created ${serviceCount} services`);
|
||||
console.log(`from ${blueprintCount} blueprints`);
|
||||
console.log(`from ${moduleCount} modules of which there are ${nameCount} unique module names`);
|
||||
console.log(`total ${totalModules} modules were uploaded`);
|
||||
|
||||
let servicesPerHost = new Map();
|
||||
for (let service of window.collectedData.services.values()) {
|
||||
let perHost = servicesPerHost.has(service.host) ? servicesPerHost.get(service.host) : new Set();
|
||||
perHost.add(service.id);
|
||||
servicesPerHost.set(service.host, perHost);
|
||||
}
|
||||
|
||||
let N = 10;
|
||||
let sorted = [...servicesPerHost.entries()].sort((a, b) => b[1].size - a[1].size);
|
||||
console.log(`top ${N} nodes by hosted services:`)
|
||||
let slice = sorted.slice(0, 10);
|
||||
for (let entry of slice) {
|
||||
console.log(`\t node ${entry[0]} has ${entry[1].size} services`);
|
||||
}
|
||||
|
||||
let byNodeVersion = new Map();
|
||||
let byAirVersion = new Map();
|
||||
for (let info of window.collectedData.peerInfos.values()) {
|
||||
let byNodeCount = byNodeVersion.get(info.node_version) || 0;
|
||||
byNodeVersion.set(info.node_version, byNodeCount + 1)
|
||||
let byAirCount = byAirVersion.get(info.air_version) || 0;
|
||||
byAirVersion.set(info.air_version, byAirCount + 1)
|
||||
}
|
||||
|
||||
console.log("Nodes version distribution:");
|
||||
for (let entry of byNodeVersion.entries()) {
|
||||
let version = entry[0];
|
||||
let count = entry[1];
|
||||
console.log(`\t${version}: ${count} nodes`);
|
||||
}
|
||||
|
||||
console.log("AIR intepreter versions distribution:");
|
||||
for (let entry of byAirVersion.entries()) {
|
||||
let version = entry[0];
|
||||
let count = entry[1];
|
||||
console.log(`\t${version}: ${count} nodes`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function collectStats(peerId, identify, services, blueprints, modules) {
|
||||
if (window) {
|
||||
window.collectedData.peerInfos.set(peerId, identify);
|
||||
|
||||
for (let blueprint of blueprints) {
|
||||
window.collectedData.blueprints.set(blueprint.id, blueprint);
|
||||
}
|
||||
|
||||
for (let module of modules) {
|
||||
window.collectedData.modules.set(module.hash, module);
|
||||
}
|
||||
|
||||
for (let service of services) {
|
||||
service.host = peerId;
|
||||
window.collectedData.services.set(service.id, service);
|
||||
window.collectedData.serviceBlueprints.add(service.blueprint_id);
|
||||
|
||||
let blueprint = window.collectedData.blueprints.get(service.blueprint_id);
|
||||
for (let prefixedHash of blueprint.dependencies) {
|
||||
let moduleHash = prefixedHash.split(':')[1];
|
||||
window.collectedData.serviceModules.add(moduleHash);
|
||||
|
||||
let module = window.collectedData.modules.get(moduleHash);
|
||||
window.collectedData.moduleNames.add(module.name);
|
||||
}
|
||||
|
||||
let perCreator = window.collectedData.creators.has(service.owner_id) ? window.collectedData.creators.get(service.owner_id) : new Set();
|
||||
perCreator.add(service.id);
|
||||
window.collectedData.creators.set(service.owner_id, perCreator);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// alias ServiceInterfaceCb: PeerId, string, Interface -> ()
|
||||
function collectServiceInterface(peer_id, service_id, iface) {
|
||||
// console.count(`service interface from ${peer_id}`);
|
||||
@ -147,6 +259,8 @@ function genFlags(peerId, relays, relayIdx) {
|
||||
function collectPeerInfo(peerId, identify, services, blueprints, modules, interfaces) {
|
||||
// console.log('peer info from %s, %s services', peerId, services.length);
|
||||
try {
|
||||
collectStats(peerId, identify, services, blueprints, modules);
|
||||
|
||||
const eventRaw = {
|
||||
// HACK: show AIR interpreter version in the NODE ID field
|
||||
peerId: peerId + ' (' + identify.air_version + ')',
|
||||
|
Loading…
Reference in New Issue
Block a user