Skip to content

Commit

Permalink
multi: rename trmrpc to gvnrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
carlaKC committed Mar 5, 2020
1 parent 36dfb58 commit fcf64d6
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 162 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ goveralls: $(GOVERALLS_BIN)

rpc:
@$(call print, "Compiling protos.")
cd ./trmrpc; ./gen_protos.sh
cd ./gvnrpc; ./gen_protos.sh

travis-race: lint unit-race

Expand Down
6 changes: 3 additions & 3 deletions cmd/trmcli/channel_insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"

"github.com/lightninglabs/governator/trmrpc"
"github.com/lightninglabs/governator/gvnrpc"
"github.com/urfave/cli"
)

Expand All @@ -18,7 +18,7 @@ var channelInsightsCommand = cli.Command{
// insightsResp is used to display additional information that is calculated
// from the channel insight in the cli response.
type insightsResp struct {
*trmrpc.ChannelInsight
*gvnrpc.ChannelInsight
UptimeRatio float64 `json:"uptime_ratio"`
RevenuePerConfirmation float64 `json:"revenue_per_conf_msat"`
VolumePerConfirmation float64 `json:"volume_per_conf_msat"`
Expand All @@ -32,7 +32,7 @@ func queryChannelInsights(ctx *cli.Context) error {

rpcCtx := context.Background()
resp, err := client.ChannelInsights(
rpcCtx, &trmrpc.ChannelInsightsRequest{},
rpcCtx, &gvnrpc.ChannelInsightsRequest{},
)
if err != nil {
return err
Expand Down
30 changes: 15 additions & 15 deletions cmd/trmcli/close_recommendations.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/lightninglabs/governator/trmrpc"
"github.com/lightninglabs/governator/gvnrpc"
"github.com/urfave/cli"
)

Expand Down Expand Up @@ -110,8 +110,8 @@ func queryThresholdRecommendations(ctx *cli.Context) error {

// Set monitored value from cli values, this value will always be
// non-zero because the flag has a default.
req := &trmrpc.ThresholdRecommendationsRequest{
RecRequest: &trmrpc.CloseRecommendationRequest{
req := &gvnrpc.ThresholdRecommendationsRequest{
RecRequest: &gvnrpc.CloseRecommendationRequest{
MinimumMonitored: ctx.Int64("min_monitored"),
},
}
Expand All @@ -120,23 +120,23 @@ func queryThresholdRecommendations(ctx *cli.Context) error {
switch {
case ctx.IsSet("uptime"):
req.ThresholdValue = float32(ctx.Float64("uptime"))
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_UPTIME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_UPTIME

case ctx.IsSet("revenue"):
req.ThresholdValue = float32(ctx.Float64("revenue"))
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_REVENUE
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_REVENUE

case ctx.IsSet("incoming"):
req.ThresholdValue = float32(ctx.Float64("incoming"))
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_INCOMING_VOLUME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_INCOMING_VOLUME

case ctx.IsSet("outgoing"):
req.ThresholdValue = float32(ctx.Float64("outgoing"))
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_OUTGOING_VOLUME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_OUTGOING_VOLUME

case ctx.IsSet("volume"):
req.ThresholdValue = float32(ctx.Float64("volume"))
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_TOTAL_VOLUME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_TOTAL_VOLUME

default:
return fmt.Errorf("threshold required")
Expand Down Expand Up @@ -170,8 +170,8 @@ func queryOutlierRecommendations(ctx *cli.Context) error {
// outlier multiplier will be overwritten if the user provided it, and
// the monitored value will always be non-zero because the flag has a
// default value.
req := &trmrpc.OutlierRecommendationsRequest{
RecRequest: &trmrpc.CloseRecommendationRequest{
req := &gvnrpc.OutlierRecommendationsRequest{
RecRequest: &gvnrpc.CloseRecommendationRequest{
MinimumMonitored: ctx.Int64("min_monitored"),
},
OutlierMultiplier: float32(defaultOutlierMultiplier),
Expand All @@ -185,19 +185,19 @@ func queryOutlierRecommendations(ctx *cli.Context) error {
// Set metric based on uptime or revenue flags.
switch {
case ctx.IsSet("uptime"):
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_UPTIME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_UPTIME

case ctx.IsSet("revenue"):
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_REVENUE
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_REVENUE

case ctx.IsSet("incoming_volume"):
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_INCOMING_VOLUME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_INCOMING_VOLUME

case ctx.IsSet("outgoing_volume"):
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_OUTGOING_VOLUME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_OUTGOING_VOLUME

case ctx.IsSet("volume"):
req.RecRequest.Metric = trmrpc.CloseRecommendationRequest_TOTAL_VOLUME
req.RecRequest.Metric = gvnrpc.CloseRecommendationRequest_TOTAL_VOLUME

default:
return fmt.Errorf("uptime, revenue or volume realted flag " +
Expand Down
4 changes: 2 additions & 2 deletions cmd/trmcli/revenue_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"

"github.com/lightninglabs/governator/trmrpc"
"github.com/lightninglabs/governator/gvnrpc"
"github.com/urfave/cli"
)

Expand Down Expand Up @@ -48,7 +48,7 @@ func queryRevenueReport(ctx *cli.Context) error {

// Set start and end times from user specified values, defaulting
// to zero if they are not set.
req := &trmrpc.RevenueReportRequest{
req := &gvnrpc.RevenueReportRequest{
StartTime: uint64(ctx.Int64("start_time")),
EndTime: uint64(ctx.Int64("end_time")),
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/trmcli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net"
"os"

"github.com/lightninglabs/governator/trmrpc"
"github.com/lightninglabs/governator/gvnrpc"
"github.com/lightninglabs/protobuf-hex-display/jsonpb"
"github.com/lightninglabs/protobuf-hex-display/proto"
"github.com/lightningnetwork/lnd/lncfg"
Expand Down Expand Up @@ -57,8 +57,8 @@ func printJSON(resp interface{}) {
_, _ = out.WriteTo(os.Stdout)
}

// getClient returns a terminator client.
func getClient(ctx *cli.Context) (trmrpc.TerminatorServerClient, func()) {
// getClient returns a governator client.
func getClient(ctx *cli.Context) (gvnrpc.GovernatorServerClient, func()) {
conn := getClientConn(ctx)

cleanUp := func() {
Expand All @@ -67,7 +67,7 @@ func getClient(ctx *cli.Context) (trmrpc.TerminatorServerClient, func()) {
}
}

return trmrpc.NewTerminatorServerClient(conn), cleanUp
return gvnrpc.NewGovernatorServerClient(conn), cleanUp
}

// getClientConn gets a client connection to the address provided by the
Expand Down
8 changes: 4 additions & 4 deletions governator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package governator
import (
"fmt"

"github.com/lightninglabs/governator/trmrpc"
"github.com/lightninglabs/governator/gvnrpc"
"github.com/lightninglabs/loop/lndclient"
"github.com/lightningnetwork/lnd/signal"
)
Expand All @@ -30,9 +30,9 @@ func Main() error {
err)
}

// Instantiate the terminator gRPC server.
server := trmrpc.NewRPCServer(
&trmrpc.Config{
// Instantiate the governator gRPC server.
server := gvnrpc.NewRPCServer(
&gvnrpc.Config{
LightningClient: client,
RPCListen: config.RPCListen,
},
Expand Down
6 changes: 3 additions & 3 deletions trmrpc/README.md → gvnrpc/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
trmrpc
gvrpc
=====
This package implements terminator's RPC client and server.
This package implements governator's RPC client and server.

## Generate protobuf definitions
1. Follow the installation steps provided in lnd's [installation instructions](https://github.com/lightningnetwork/lnd/blob/master/lnrpc/README.md#generate-protobuf-definitions).

2. Run [`gen_protos.sh`](https://github.com/lightninglabs/governator/tree/master/trmrpc/gen_protos.sh) to generate new protobuf definitions.
2. Run [`gen_protos.sh`](https://github.com/lightninglabs/governator/tree/master/gvnrpc/gen_protos.sh) to generate new protobuf definitions.
2 changes: 1 addition & 1 deletion trmrpc/channel_insights.go → gvnrpc/channel_insights.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package trmrpc
package gvnrpc

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package trmrpc
package gvnrpc

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion trmrpc/gen_protos.sh → gvnrpc/gen_protos.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

echo "Generating terminator gRPC server protos"
echo "Generating governator gRPC server protos"

# Generate the protos.
protoc -I/usr/local/include -I. \
Expand Down
2 changes: 1 addition & 1 deletion trmrpc/log.go → gvnrpc/log.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package trmrpc
package gvnrpc

import (
"github.com/btcsuite/btclog"
Expand Down
2 changes: 1 addition & 1 deletion trmrpc/revenue_report.go → gvnrpc/revenue_report.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package trmrpc
package gvnrpc

import (
"context"
Expand Down
Loading

0 comments on commit fcf64d6

Please sign in to comment.