lnrpc: rename FloatValue to FloatMetric
This commit renames lnrpc.FloatValue to lnrpc.FloatMetric as requested in the final review of centrality PR.
This commit is contained in:
1 parent
a2336005e6
commit
93cb05142a
4 files changed
+719
-713
No files matched your search
+697
-694
File diff suppressed because it is too large.
Load diff
+11
-11
@@ -651,7 +651,6 @@ service Lightning {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** lncli: `getchaninfo`
|
/** lncli: `getchaninfo`
|
||||||
GetChanInfo returns the latest authenticated network announcement for the
|
GetChanInfo returns the latest authenticated network announcement for the
|
||||||
given channel identified by its channel ID: an 8-byte integer which
|
given channel identified by its channel ID: an 8-byte integer which
|
||||||
@@ -2527,13 +2526,14 @@ message ChannelGraph {
|
|||||||
repeated ChannelEdge edges = 2;
|
repeated ChannelEdge edges = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum NodeMetricType {
|
enum NodeMetricType {
|
||||||
BETWEENNESS_CENTRALITY = 0;
|
UNKNOWN = 0;
|
||||||
|
BETWEENNESS_CENTRALITY = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NodeMetricsRequest {
|
message NodeMetricsRequest {
|
||||||
/// The requesteded node metrics.
|
/// The requested node metrics.
|
||||||
repeated NodeMetricType types = 1;
|
repeated NodeMetricType types = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NodeMetricsResponse {
|
message NodeMetricsResponse {
|
||||||
@@ -2544,15 +2544,15 @@ message NodeMetricsResponse {
|
|||||||
Map of node pubkey to betweenness centrality of the node. Normalized
|
Map of node pubkey to betweenness centrality of the node. Normalized
|
||||||
values are in the [0,1] closed interval.
|
values are in the [0,1] closed interval.
|
||||||
*/
|
*/
|
||||||
map<string, FloatValue> betweenness_centrality = 1;
|
map<string, FloatMetric> betweenness_centrality = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message FloatValue {
|
message FloatMetric {
|
||||||
/// Arbitrary float value.
|
/// Arbitrary float value.
|
||||||
double value = 1;
|
double value = 1;
|
||||||
|
|
||||||
/// The value normalized to [0,1] or [-1,1].
|
/// The value normalized to [0,1] or [-1,1].
|
||||||
double normalized_value = 2;
|
double normalized_value = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ChanInfoRequest {
|
message ChanInfoRequest {
|
||||||
|
|||||||
@@ -733,13 +733,14 @@
|
|||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "types",
|
"name": "types",
|
||||||
"description": "/ The requesteded node metrics.",
|
"description": "/ The requested node metrics.",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"required": false,
|
"required": false,
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
"UNKNOWN",
|
||||||
"BETWEENNESS_CENTRALITY"
|
"BETWEENNESS_CENTRALITY"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -2717,7 +2718,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lnrpcFloatValue": {
|
"lnrpcFloatMetric": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"value": {
|
"value": {
|
||||||
@@ -3625,9 +3626,10 @@
|
|||||||
"lnrpcNodeMetricType": {
|
"lnrpcNodeMetricType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
"UNKNOWN",
|
||||||
"BETWEENNESS_CENTRALITY"
|
"BETWEENNESS_CENTRALITY"
|
||||||
],
|
],
|
||||||
"default": "BETWEENNESS_CENTRALITY"
|
"default": "UNKNOWN"
|
||||||
},
|
},
|
||||||
"lnrpcNodeMetricsResponse": {
|
"lnrpcNodeMetricsResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -3635,7 +3637,7 @@
|
|||||||
"betweenness_centrality": {
|
"betweenness_centrality": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"$ref": "#/definitions/lnrpcFloatValue"
|
"$ref": "#/definitions/lnrpcFloatMetric"
|
||||||
},
|
},
|
||||||
"description": "*\nBetweenness centrality is the sum of the ratio of shortest paths that pass\nthrough the node for each pair of nodes in the graph (not counting paths\nstarting or ending at this node).\nMap of node pubkey to betweenness centrality of the node. Normalized\nvalues are in the [0,1] closed interval."
|
"description": "*\nBetweenness centrality is the sum of the ratio of shortest paths that pass\nthrough the node for each pair of nodes in the graph (not counting paths\nstarting or ending at this node).\nMap of node pubkey to betweenness centrality of the node. Normalized\nvalues are in the [0,1] closed interval."
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -4688,7 +4688,7 @@ func (r *rpcServer) GetNodeMetrics(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp := &lnrpc.NodeMetricsResponse{
|
resp := &lnrpc.NodeMetricsResponse{
|
||||||
BetweennessCentrality: make(map[string]*lnrpc.FloatValue),
|
BetweennessCentrality: make(map[string]*lnrpc.FloatMetric),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the pointer to the global singleton channel graph, this will
|
// Obtain the pointer to the global singleton channel graph, this will
|
||||||
@@ -4712,9 +4712,10 @@ func (r *rpcServer) GetNodeMetrics(ctx context.Context,
|
|||||||
// Fill normalized and non normalized centrality.
|
// Fill normalized and non normalized centrality.
|
||||||
centrality := centralityMetric.GetMetric(true)
|
centrality := centralityMetric.GetMetric(true)
|
||||||
for nodeID, val := range centrality {
|
for nodeID, val := range centrality {
|
||||||
resp.BetweennessCentrality[hex.EncodeToString(nodeID[:])] = &lnrpc.FloatValue{
|
resp.BetweennessCentrality[hex.EncodeToString(nodeID[:])] =
|
||||||
NormalizedValue: val,
|
&lnrpc.FloatMetric{
|
||||||
}
|
NormalizedValue: val,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
centrality = centralityMetric.GetMetric(false)
|
centrality = centralityMetric.GetMetric(false)
|
||||||
|
|||||||
Reference in new issue
Block a user