Skip to content

Commit

Permalink
Finish renaming Node to Visor
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Feb 3, 2020
1 parent bdc774e commit 36097ba
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cmd/hypervisor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/hypervisor/hypervisor.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"visors"
]
},
"description": "Provides a summary of all connected app visors."
"description": "Provides a summary of all connected visors."
},
"response": [
{
Expand Down
7 changes: 4 additions & 3 deletions pkg/hypervisor/hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion pkg/hypervisor/hypervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions pkg/setup/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion pkg/transport/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 36097ba

Please sign in to comment.