add graph service and "number of known channels" endpoint

This commit is contained in:
Carsten Otto
2022-05-17 16:52:41 +02:00
parent 393765c61d
commit 911e217aef
12 changed files with 113 additions and 15 deletions

View File

@@ -0,0 +1,23 @@
package de.cotto.lndmanagej.service;
import de.cotto.lndmanagej.grpc.GrpcGraph;
import org.springframework.stereotype.Service;
import java.util.Set;
@Service
public class GraphService {
private final GrpcGraph grpcGraph;
public GraphService(GrpcGraph grpcGraph) {
this.grpcGraph = grpcGraph;
}
public int getNumberOfChannels() {
return grpcGraph.getChannelEdges().map(Set::size).orElse(0);
}
public void resetCache() {
grpcGraph.resetCache();
}
}