node

package
v0.0.0-...-b0339d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2017 Samsung Electronics All Rights Reserved. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License. * ******************************************************************************

Index

Constants

View Source
const (
	DB_NAME         = "DeploymentManagerDB"
	NODE_COLLECTION = "NODE"
	DB_URL          = "127.0.0.1:27017"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// AddNode insert new Node.
	AddNode(id, ip, status string, config map[string]interface{}, apps []string) (map[string]interface{}, error)

	// UpdateNodeAddress updates ip,port of node from db related to node.
	UpdateNodeAddress(nodeId string, host string, port string) error

	// UpdateNodeStatus updates status of node from db related to node.
	UpdateNodeStatus(nodeId string, status string) error

	// UpdateNodeConfiguration updates configuration information of node from db related to node.
	UpdateNodeConfiguration(nodeId string, config map[string]interface{}) error

	// GetNode returns single document from db related to node.
	GetNode(nodeId string) (map[string]interface{}, error)

	// GetNodes returns all matches for the query-string which is passed in call to function.
	GetNodes(queryOptional ...map[string]interface{}) ([]map[string]interface{}, error)

	// GetNodeByAppID returns single document including specific app.
	GetNodeByAppID(nodeId string, appId string) (map[string]interface{}, error)

	// GetNodeByIP returns single document from db related to node.
	GetNodeByIP(ip string) (map[string]interface{}, error)

	// AddAppToNode add specific app to the target node.
	AddAppToNode(nodeId string, appId string) error

	// DeleteAppFromNode delete specific app from the target node.
	DeleteAppFromNode(nodeId string, appId string) error

	// DeleteNode delete single document from db related to node.
	DeleteNode(nodeId string) error
}

type Executor

type Executor struct{}

func (Executor) AddAppToNode

func (Executor) AddAppToNode(nodeId string, appId string) error

AddAppToNode adds the specific app to the target node. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

func (Executor) AddNode

func (Executor) AddNode(id, ip, status string, config map[string]interface{}, apps []string) (map[string]interface{}, error)

AddNode inserts new node to 'node' collection. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

func (Executor) DeleteAppFromNode

func (Executor) DeleteAppFromNode(nodeId string, appId string) error

DeleteAppFromNode deletes the specific app from the target node. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

func (Executor) DeleteNode

func (Executor) DeleteNode(nodeId string) error

DeleteNode deletes single document from 'node' collection. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

func (Executor) GetNode

func (Executor) GetNode(nodeId string) (map[string]interface{}, error)

GetNode returns single document specified by nodeId parameter. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

func (Executor) GetNodeByAppID

func (Executor) GetNodeByAppID(nodeId string, appId string) (map[string]interface{}, error)

GetNodeByAppID returns single document specified by nodeId parameter. If successful, this function returns an error as nil. But if the target node does not include the given appId, an appropriate error will be returned.

func (Executor) GetNodeByIP

func (Executor) GetNodeByIP(ip string) (map[string]interface{}, error)

GetNodeByIP returns single document specified by ip parameter. If successful, this function returns an error as nil. But if the target node does not include the given appId, an appropriate error will be returned.

func (Executor) GetNodes

func (Executor) GetNodes(queryOptional ...map[string]interface{}) ([]map[string]interface{}, error)

GetNodes returns all documents from 'node' collection. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

func (Executor) UpdateNodeAddress

func (Executor) UpdateNodeAddress(nodeId string, host string, port string) error

UpdateNodeAddress updates ip,port of node specified by nodeId parameter. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

func (Executor) UpdateNodeConfiguration

func (Executor) UpdateNodeConfiguration(nodeId string, config map[string]interface{}) error

func (Executor) UpdateNodeStatus

func (Executor) UpdateNodeStatus(nodeId string, status string) error

UpdateNodeStatus updates status of node specified by nodeId parameter. If successful, this function returns an error as nil. otherwise, an appropriate error will be returned.

type Node

type Node struct {
	ID     string `bson:"_id,omitempty"`
	IP     string
	Apps   []string
	Status string
	Config map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL