diff --git a/cmd/hypervisor/commands/root.go b/cmd/hypervisor/commands/root.go index 8d8085e2e1..6b371dc461 100644 --- a/cmd/hypervisor/commands/root.go +++ b/cmd/hypervisor/commands/root.go @@ -35,8 +35,8 @@ func init() { rootCmd.Flags().StringVarP(&configPath, "config", "c", "./hypervisor-config.json", "hypervisor config path") rootCmd.Flags().BoolVarP(&mock, "mock", "m", false, "whether to run hypervisor with mock data") rootCmd.Flags().BoolVar(&mockEnableAuth, "mock-enable-auth", false, "whether to enable user management in mock mode") - rootCmd.Flags().IntVar(&mockVisors, "mock-visors", 5, "number of app visors to have in mock mode") - rootCmd.Flags().IntVar(&mockMaxTps, "mock-max-tps", 10, "max number of transports per mock app visor") + rootCmd.Flags().IntVar(&mockVisors, "mock-visors", 5, "number of visors to have in mock mode") + rootCmd.Flags().IntVar(&mockMaxTps, "mock-max-tps", 10, "max number of transports per mock visor") rootCmd.Flags().IntVar(&mockMaxRoutes, "mock-max-routes", 30, "max number of routes per visor") } @@ -66,7 +66,7 @@ var rootCmd = &cobra.Command{ rpcAddr = config.Interfaces.RPCAddr ) - m, err := hypervisor.NewNode(config) + m, err := hypervisor.New(config) if err != nil { log.Fatalln("Failed to start hypervisor:", err) } diff --git a/cmd/hypervisor/hypervisor.postman_collection.json b/cmd/hypervisor/hypervisor.postman_collection.json index ead4e9f354..3e1ae6b2df 100644 --- a/cmd/hypervisor/hypervisor.postman_collection.json +++ b/cmd/hypervisor/hypervisor.postman_collection.json @@ -26,7 +26,7 @@ "visors" ] }, - "description": "Provides a summary of all connected app visors." + "description": "Provides a summary of all connected visors." }, "response": [ { diff --git a/pkg/hypervisor/hypervisor.go b/pkg/hypervisor/hypervisor.go index 808365759f..62191fac81 100644 --- a/pkg/hypervisor/hypervisor.go +++ b/pkg/hypervisor/hypervisor.go @@ -41,6 +41,7 @@ var ( log = logging.MustGetLogger("hypervisor") // nolint: gochecknoglobals ) +// VisorConn represents a visor connection. type VisorConn struct { Addr dmsg.Addr Client visor.RPCClient @@ -54,8 +55,8 @@ type Hypervisor struct { mu *sync.RWMutex } -// NewNode creates a new Hypervisor. -func NewNode(config Config) (*Hypervisor, error) { +// New creates a new Hypervisor. +func New(config Config) (*Hypervisor, error) { boltUserDB, err := NewBoltUserStore(config.DBPath) if err != nil { return nil, err @@ -148,9 +149,9 @@ func (m *Hypervisor) ServeHTTP(w http.ResponseWriter, req *http.Request) { r.Get("/user", m.users.UserInfo()) r.Post("/change-password", m.users.ChangePassword()) r.Get("/visors", m.getVisors()) + r.Get("/visors/{pk}", m.getVisor()) r.Get("/visors/{pk}/health", m.getHealth()) r.Get("/visors/{pk}/uptime", m.getUptime()) - r.Get("/visors/{pk}", m.getVisor()) r.Get("/visors/{pk}/apps", m.getApps()) r.Get("/visors/{pk}/apps/{app}", m.getApp()) r.Put("/visors/{pk}/apps/{app}", m.putApp()) diff --git a/pkg/hypervisor/hypervisor_test.go b/pkg/hypervisor/hypervisor_test.go index 3b3bb79e0f..bb1befe083 100644 --- a/pkg/hypervisor/hypervisor_test.go +++ b/pkg/hypervisor/hypervisor_test.go @@ -84,7 +84,7 @@ func makeStartNode(t *testing.T, config Config) (string, *http.Client, func()) { EnableAuth: true, } - visor, err := NewNode(config) + visor, err := New(config) require.NoError(t, err) require.NoError(t, visor.AddMockData(defaultMockConfig)) diff --git a/pkg/setup/node_test.go b/pkg/setup/node_test.go index 3ce014e1de..5bc1813491 100644 --- a/pkg/setup/node_test.go +++ b/pkg/setup/node_test.go @@ -66,7 +66,7 @@ func TestNode(t *testing.T) { reservedIDs := []routing.RouteID{1, 2} - // TEST: Emulates the communication between 4 visor nodes and a setup node, + // TEST: Emulates the communication between 4 visors and a setup node, // where the first client visor initiates a route to the last. t.Run("DialRouteGroup", func(t *testing.T) { testDialRouteGroup(t, keys, nEnv, reservedIDs) @@ -75,7 +75,7 @@ func TestNode(t *testing.T) { func testDialRouteGroup(t *testing.T, keys []snettest.KeyPair, nEnv *snettest.Env, reservedIDs []routing.RouteID) { // client index 0 is for setup node. - // clients index 1 to 4 are for visor nodes. + // clients index 1 to 4 are for visors. clients, closeClients := prepClients(t, keys, nEnv, reservedIDs, 5) defer closeClients() diff --git a/pkg/transport/handshake.go b/pkg/transport/handshake.go index 687a1f0b18..c944b8db7e 100644 --- a/pkg/transport/handshake.go +++ b/pkg/transport/handshake.go @@ -130,7 +130,7 @@ func MakeSettlementHS(init bool) SettlementHS { log.WithError(err).Error("Failed to register transports") } - // inform initiating visor visor. + // inform initiating visor. if _, err := conn.Write([]byte{1}); err != nil { return fmt.Errorf("failed to accept transport settlement: write failed: %v", err) }