Skip to content

Commit

Permalink
rename loop to routegroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kifen committed Mar 5, 2020
1 parent 8e03b43 commit 749b11c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pkg/hypervisor/hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (hv *Hypervisor) ServeHTTP(w http.ResponseWriter, req *http.Request) {
r.Get("/visors/{pk}/routes/{rid}", hv.getRoute())
r.Put("/visors/{pk}/routes/{rid}", hv.putRoute())
r.Delete("/visors/{pk}/routes/{rid}", hv.deleteRoute())
r.Get("/visors/{pk}/loops", hv.getLoops())
r.Get("/visors/{pk}/routegroup", hv.getRouteGroup())
r.Get("/visors/{pk}/restart", hv.restart())
r.Post("/visors/{pk}/exec", hv.exec())
r.Post("/visors/{pk}/update", hv.update())
Expand Down Expand Up @@ -672,9 +672,9 @@ func makeLoopResp(info visor.LoopInfo) loopResp {
}
}

func (hv *Hypervisor) getLoops() http.HandlerFunc {
func (hv *Hypervisor) getRouteGroup() http.HandlerFunc {
return hv.withCtx(hv.visorCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) {
loops, err := ctx.RPC.Loops()
loops, err := ctx.RPC.RouteGroups()
if err != nil {
httputil.WriteJSON(w, r, http.StatusInternalServerError, err)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func (r *router) Close() error {
return nil
}

r.logger.Info("Closing all App connections and Loops")
r.logger.Info("Closing all App connections and RouteGroups")

r.once.Do(func() {
close(r.done)
Expand Down
4 changes: 2 additions & 2 deletions pkg/visor/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ type LoopInfo struct {
FwdRule routing.Rule
}

// Loops retrieves loops via rules of the routing table.
// RouteGroups retrieves loops via rules of the routing table.
func (r *RPC) Loops(_ *struct{}, out *[]LoopInfo) (err error) {
defer r.logReq("Loops", nil)(out, &err)
defer r.logReq("RouteGroups", nil)(out, &err)

var loops []LoopInfo

Expand Down
12 changes: 6 additions & 6 deletions pkg/visor/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type RPCClient interface {
SaveRoutingRule(rule routing.Rule) error
RemoveRoutingRule(key routing.RouteID) error

Loops() ([]LoopInfo, error)
RouteGroups() ([]LoopInfo, error)

Restart() error
Exec(command string) ([]byte, error)
Expand Down Expand Up @@ -230,10 +230,10 @@ func (rc *rpcClient) RemoveRoutingRule(key routing.RouteID) error {
return rc.Call("RemoveRoutingRule", &key, &struct{}{})
}

// Loops calls Loops.
func (rc *rpcClient) Loops() ([]LoopInfo, error) {
// RouteGroups calls RouteGroups.
func (rc *rpcClient) RouteGroups() ([]LoopInfo, error) {
var loops []LoopInfo
err := rc.Call("Loops", &struct{}{}, &loops)
err := rc.Call("RouteGroups", &struct{}{}, &loops)
return loops, err
}

Expand Down Expand Up @@ -580,8 +580,8 @@ func (mc *mockRPCClient) RemoveRoutingRule(key routing.RouteID) error {
return nil
}

// Loops implements RPCClient.
func (mc *mockRPCClient) Loops() ([]LoopInfo, error) {
// RouteGroups implements RPCClient.
func (mc *mockRPCClient) RouteGroups() ([]LoopInfo, error) {
var loops []LoopInfo

rules := mc.rt.AllRules()
Expand Down

0 comments on commit 749b11c

Please sign in to comment.