Documentation ¶
Index ¶
- func EncodeData(m *Cluster) (error, []byte)
- type Cluster
- func (c *Cluster) AddNode(n *ClusterNode) error
- func (c *Cluster) AddService(s *ClusterService) error
- func (c *Cluster) ConsensusForDeletion(candidate string, from string, reached bool) (error, bool)
- func (c *Cluster) DeleteNode(node string) error
- func (c *Cluster) DeleteService(service string) error
- func (c *Cluster) GetCandidatesForDeletion() map[string]map[string]bool
- func (c *Cluster) GetNode(name string) (error, *ClusterNode)
- func (c *Cluster) GetNodes() map[string]*ClusterNode
- func (c *Cluster) GetService(name string) (error, *ClusterService)
- func (c *Cluster) GetServices() map[string]*ClusterService
- func (c *Cluster) SetCandidatesForDeletion(cs map[string]map[string]bool)
- func (c *Cluster) SetNodes(nodes map[string]*ClusterNode)
- func (c *Cluster) SetServices(services map[string]*ClusterService)
- func (c *Cluster) String() string
- type ClusterEngine
- func (c *ClusterEngine) AddNode(n *ClusterNode) error
- func (c *ClusterEngine) AddOutputChannel(o chan []byte, desc string) error
- func (c *ClusterEngine) AddService(s *ClusterService) error
- func (c *ClusterEngine) DeleteNode(nodename string) error
- func (c *ClusterEngine) GetCluster() *Cluster
- func (c *ClusterEngine) GetClusterInfo() (error, []byte)
- func (c *ClusterEngine) GetClusterNodes() (error, []byte)
- func (c *ClusterEngine) GetClusterServices() (error, []byte)
- func (c *ClusterEngine) GetInputChannel() chan interface{}
- func (c *ClusterEngine) GetOutputChannels() map[chan []byte]string
- func (c *ClusterEngine) ReceiveData(data interface{})
- func (c *ClusterEngine) SayHi()
- func (c *ClusterEngine) SelectNodesForSync() (error, []string)
- func (c *ClusterEngine) SendData(data []byte) error
- func (c *ClusterEngine) SendSyncMessage(url string, message []byte) error
- func (c *ClusterEngine) SetCluster(cluster *Cluster)
- func (c *ClusterEngine) SetInputChannel(i chan interface{})
- func (c *ClusterEngine) SetOutputChannels(o map[chan []byte]string)
- func (c *ClusterEngine) StartClusterSync() error
- func (c *ClusterEngine) StartReceiver() error
- func (c *ClusterEngine) String() string
- type ClusterMessage
- func (m *ClusterMessage) GetData() []byte
- func (m *ClusterMessage) GetFrom() string
- func (m *ClusterMessage) GetTimestamp() int64
- func (m *ClusterMessage) SetData(d []byte)
- func (m *ClusterMessage) SetFrom(f string)
- func (m *ClusterMessage) SetTimestamp(t int64)
- func (m *ClusterMessage) String() string
- type ClusterNode
- func (c *ClusterNode) AddService(s *service.ServiceObject) error
- func (c *ClusterNode) CopyClusterNode() *ClusterNode
- func (c *ClusterNode) DeleteService(service string) error
- func (c *ClusterNode) GetCandidateForDeletion() bool
- func (c *ClusterNode) GetName() string
- func (c *ClusterNode) GetNodeServices() map[string]*service.ServiceObject
- func (c *ClusterNode) GetStatus() int
- func (c *ClusterNode) GetTimestamp() int64
- func (c *ClusterNode) GetURL() string
- func (c *ClusterNode) HasService(s string) (error, *service.ServiceObject)
- func (c *ClusterNode) IncreaseTimestamp() error
- func (c *ClusterNode) SetCandidateForDeletion(d bool)
- func (c *ClusterNode) SetName(name string)
- func (c *ClusterNode) SetNodeServices(s map[string]*service.ServiceObject)
- func (c *ClusterNode) SetStatus(status int)
- func (c *ClusterNode) SetTimestamp(t int64)
- func (c *ClusterNode) SetURL(url string)
- func (c *ClusterNode) String() string
- type ClusterService
- func (c *ClusterService) AddServiceNode(n string, s *service.ServiceObject) error
- func (c *ClusterService) CalculateStatusForClusterService() error
- func (c *ClusterService) CountServiceNodes() int
- func (c *ClusterService) DeleteServiceNode(node string) error
- func (c *ClusterService) GetCandidateForDelation() bool
- func (c *ClusterService) GetName() string
- func (c *ClusterService) GetServiceNode(n string) (error, *service.ServiceObject)
- func (c *ClusterService) GetServiceNodes() map[string]*service.ServiceObject
- func (c *ClusterService) GetStatus() int
- func (c *ClusterService) SetCandidateForDelation(d bool)
- func (c *ClusterService) SetName(name string)
- func (c *ClusterService) SetServiceNodes(s map[string]*service.ServiceObject)
- func (c *ClusterService) SetStatus(status int)
- func (c *ClusterService) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct { // map to store the nodes that belong to the cluster Nodes map[string]*ClusterNode `json:"nodes"` // map to store the services that belong to the cluster Services map[string]*ClusterService `json:"services"` // contains filtered or unexported fields }
# # # Cluster struct: # Cluster is a set of nodes
func NewCluster ¶
NewCluster: return a CheckEngine instance to be run ¶
func (*Cluster) AddNode ¶
func (c *Cluster) AddNode(n *ClusterNode) error
AddNode: Add a new node into cluster ¶
func (*Cluster) AddService ¶
func (c *Cluster) AddService(s *ClusterService) error
AddNode: Add a new node into the cluster ¶
func (*Cluster) ConsensusForDeletion ¶
AddCandidatesForDeletion ¶
func (*Cluster) DeleteNode ¶
DeleteNode: Delete node from cluster ¶
func (*Cluster) DeleteService ¶
DeleteService: Delete service from cluster ¶
func (*Cluster) GetCandidatesForDeletion ¶
GetCandidatesForDeletion ¶
func (*Cluster) GetNode ¶
func (c *Cluster) GetNode(name string) (error, *ClusterNode)
GetNode: return a node from the cluster ¶
func (*Cluster) GetNodes ¶
func (c *Cluster) GetNodes() map[string]*ClusterNode
GetNodes: get attribute from Cluster ¶
func (*Cluster) GetService ¶
func (c *Cluster) GetService(name string) (error, *ClusterService)
GetService: return a service from the cluster ¶
func (*Cluster) GetServices ¶
func (c *Cluster) GetServices() map[string]*ClusterService
GetServices: get attribute from Cluster ¶
func (*Cluster) SetCandidatesForDeletion ¶
SetCandidatesForDeletion ¶
func (*Cluster) SetNodes ¶
func (c *Cluster) SetNodes(nodes map[string]*ClusterNode)
SetNodes: set attribute from Cluster ¶
func (*Cluster) SetServices ¶
func (c *Cluster) SetServices(services map[string]*ClusterService)
SetServices: set attribute from Cluster ¶
type ClusterEngine ¶
type ClusterEngine struct { //Ui ui.UI Cluster *Cluster `json:"cluster"` // contains filtered or unexported fields }
# # # ClusterEngine struct: # ClusterEngine defines a map to store the maps
func NewClusterEngine ¶
func NewClusterEngine(e *environment.Environment) (error, *ClusterEngine)
NewClusterEngine: return a CheckEngine instance to be run ¶
func (*ClusterEngine) AddNode ¶
func (c *ClusterEngine) AddNode(n *ClusterNode) error
AddNode: Add a new node into cluster ¶
func (*ClusterEngine) AddOutputChannel ¶
func (c *ClusterEngine) AddOutputChannel(o chan []byte, desc string) error
AddOutputSampleChan: Add a new channel to write service status ¶
func (*ClusterEngine) AddService ¶
func (c *ClusterEngine) AddService(s *ClusterService) error
AddNode: Add a new node into the cluster ¶
func (*ClusterEngine) DeleteNode ¶
func (c *ClusterEngine) DeleteNode(nodename string) error
DeleteNode: delete node from cluster ¶
func (*ClusterEngine) GetCluster ¶
func (c *ClusterEngine) GetCluster() *Cluster
GetCluster: attribute from ClusterNode ¶
func (*ClusterEngine) GetClusterInfo ¶
func (c *ClusterEngine) GetClusterInfo() (error, []byte)
GetCluster: get whole information from cluster ¶
func (*ClusterEngine) GetClusterNodes ¶
func (c *ClusterEngine) GetClusterNodes() (error, []byte)
GetClusterNodes: get all nodes from cluster ¶
func (*ClusterEngine) GetClusterServices ¶
func (c *ClusterEngine) GetClusterServices() (error, []byte)
GetClusterServices: get all nodes from cluster ¶
func (*ClusterEngine) GetInputChannel ¶
func (c *ClusterEngine) GetInputChannel() chan interface{}
GetInputChannel: attribute from Cluster ¶
func (*ClusterEngine) GetOutputChannels ¶
func (c *ClusterEngine) GetOutputChannels() map[chan []byte]string
SetOutputChannel: attribute from Cluster ¶
func (*ClusterEngine) ReceiveData ¶
func (c *ClusterEngine) ReceiveData(data interface{})
ReceiveData: method to receive data from the outdoor ¶
func (*ClusterEngine) SelectNodesForSync ¶
func (c *ClusterEngine) SelectNodesForSync() (error, []string)
SelectNodesForSync ¶
func (*ClusterEngine) SendData ¶
func (c *ClusterEngine) SendData(data []byte) error
SendData: method that send services to other engines ¶
func (*ClusterEngine) SendSyncMessage ¶
func (c *ClusterEngine) SendSyncMessage(url string, message []byte) error
SendSyncMessage ¶
func (*ClusterEngine) SetCluster ¶
func (c *ClusterEngine) SetCluster(cluster *Cluster)
SetCluster: attribute from Cluster ¶
func (*ClusterEngine) SetInputChannel ¶
func (c *ClusterEngine) SetInputChannel(i chan interface{})
SetInputChannel: attribute from Cluster ¶
func (*ClusterEngine) SetOutputChannels ¶
func (c *ClusterEngine) SetOutputChannels(o map[chan []byte]string)
SetOutputChannel: attribute from Cluster ¶
func (*ClusterEngine) StartClusterSync ¶
func (c *ClusterEngine) StartClusterSync() error
StartClusterSync ¶
func (*ClusterEngine) StartReceiver ¶
func (c *ClusterEngine) StartReceiver() error
StartServiceEngine: method prepares the system to wait sample and calculate the results for services ¶
func (*ClusterEngine) String ¶
func (c *ClusterEngine) String() string
String: convert a ClusterEngine object to string ¶
type ClusterMessage ¶
type ClusterMessage struct { From string `json:"from"` Timestamp int64 `json:"timestamp"` Data []byte `json:"data"` }
# # # ClusterMessage struct: # ClusterMessage is defined by a node name and its URL
func DecodeClusterMessage ¶
func DecodeClusterMessage(data []byte) (error, *ClusterMessage)
DecodeClusterMessage: return a *ClusterMessaged data ¶
func NewClusterMessage ¶
func NewClusterMessage(f string, t int64, i interface{}) (error, *ClusterMessage)
NewClusterMessage: return a CheckMessage ¶
func (*ClusterMessage) GetData ¶
func (m *ClusterMessage) GetData() []byte
GetData: attribute from ClusterMessage ¶
func (*ClusterMessage) GetFrom ¶
func (m *ClusterMessage) GetFrom() string
GetFrom: attribute from ClusterMessage ¶
func (*ClusterMessage) GetTimestamp ¶
func (m *ClusterMessage) GetTimestamp() int64
GetTimestamp: attribute from ClusterMessage ¶
func (*ClusterMessage) SetData ¶
func (m *ClusterMessage) SetData(d []byte)
SetData: attribute from ClusterMessage ¶
func (*ClusterMessage) SetFrom ¶
func (m *ClusterMessage) SetFrom(f string)
SetFrom: attribute from ClusterMessage ¶
func (*ClusterMessage) SetTimestamp ¶
func (m *ClusterMessage) SetTimestamp(t int64)
SetTimestamp: attribute from ClusterMessage ¶
func (*ClusterMessage) String ¶
func (m *ClusterMessage) String() string
String: convert a ClusterMessage object to string ¶
type ClusterNode ¶
type ClusterNode struct { Name string `json:"name"` URL string `json:"URL"` Timestamp int64 `json:"timestamp"` Status int `json:"status"` NodeServices map[string]*service.ServiceObject `json:"services"` CandidateForDetelion bool `json:"candidatefordeletion"` }
# # # ClusterNode struct: # ClusterNode is defined by a node name and its URL
func NewClusterNode ¶
func NewClusterNode(name string, url string) (error, *ClusterNode)
NewClusterNode: return a CheckEngine instance to be run ¶
func (*ClusterNode) AddService ¶
func (c *ClusterNode) AddService(s *service.ServiceObject) error
AddService: method add a service to cluster node ¶
func (*ClusterNode) CopyClusterNode ¶
func (c *ClusterNode) CopyClusterNode() *ClusterNode
CopyClusterNode: method copies a cluster node ¶
func (*ClusterNode) DeleteService ¶
func (c *ClusterNode) DeleteService(service string) error
DeleteService: method deletes a service to cluster node ¶
func (*ClusterNode) GetCandidateForDeletion ¶
func (c *ClusterNode) GetCandidateForDeletion() bool
SetCandidateForDetelion: attribute from ClusterNode ¶
func (*ClusterNode) GetName ¶
func (c *ClusterNode) GetName() string
GetName: attribute from ClusterNode ¶
func (*ClusterNode) GetNodeServices ¶
func (c *ClusterNode) GetNodeServices() map[string]*service.ServiceObject
GetNodeServices: attribute from ClusterNode ¶
func (*ClusterNode) GetStatus ¶
func (c *ClusterNode) GetStatus() int
GetStatus: attribute from ClusterNode ¶
func (*ClusterNode) GetTimestamp ¶
func (c *ClusterNode) GetTimestamp() int64
GetTimestamp: attribute from ClusterNode ¶
func (*ClusterNode) GetURL ¶
func (c *ClusterNode) GetURL() string
GetURL: attribute from ClusterNode ¶
func (*ClusterNode) HasService ¶
func (c *ClusterNode) HasService(s string) (error, *service.ServiceObject)
HasService: method return if a service is defined on cluster node ¶
func (*ClusterNode) IncreaseTimestamp ¶
func (c *ClusterNode) IncreaseTimestamp() error
IncreaseTimestamp: method increade the timestamp to cluster node ¶
func (*ClusterNode) SetCandidateForDeletion ¶
func (c *ClusterNode) SetCandidateForDeletion(d bool)
SetCandidateForDetelion: attribute from ClusterNode ¶
func (*ClusterNode) SetName ¶
func (c *ClusterNode) SetName(name string)
SetName: attribute from ClusterNode ¶
func (*ClusterNode) SetNodeServices ¶
func (c *ClusterNode) SetNodeServices(s map[string]*service.ServiceObject)
SetNodeServices: attribute from ClusterNode ¶
func (*ClusterNode) SetStatus ¶
func (c *ClusterNode) SetStatus(status int)
SetStatus: attribute from ClusterNode ¶
func (*ClusterNode) SetTimestamp ¶
func (c *ClusterNode) SetTimestamp(t int64)
SetTimestamp: attribute from ClusterNode ¶
func (*ClusterNode) SetURL ¶
func (c *ClusterNode) SetURL(url string)
SetURL: attribute from ClusterNode ¶
func (*ClusterNode) String ¶
func (c *ClusterNode) String() string
string: convert a ClusterService object to string ¶
type ClusterService ¶
type ClusterService struct { Name string `json:"name"` Status int `json:"status"` ServiceNodes map[string]*service.ServiceObject `json:"nodes"` CandidateForDelation bool `json:"candidatefordeletion"` }
# # # ClusterService struct: # ClusterService is defined by a node name and its URL
func NewClusterService ¶
func NewClusterService(name string) (error, *ClusterService)
NewClusterNode: return a ClusterService instance to be run ¶
func (*ClusterService) AddServiceNode ¶
func (c *ClusterService) AddServiceNode(n string, s *service.ServiceObject) error
# # Specific methods #---------------------------------------------------------------------
AddService: method add a service for the current node ¶
func (*ClusterService) CalculateStatusForClusterService ¶
func (c *ClusterService) CalculateStatusForClusterService() error
CalculateStatusForClusterService: method sends a sample to the sample channel ¶
func (*ClusterService) CountServiceNodes ¶
func (c *ClusterService) CountServiceNodes() int
CountServiceNodes: method deletes a node from cluster service ¶
func (*ClusterService) DeleteServiceNode ¶
func (c *ClusterService) DeleteServiceNode(node string) error
DeleteServiceNode: method deletes a node from cluster service ¶
func (*ClusterService) GetCandidateForDelation ¶
func (c *ClusterService) GetCandidateForDelation() bool
SetCandidateForDelation: attribute from ClusterNode ¶
func (*ClusterService) GetName ¶
func (c *ClusterService) GetName() string
GetName: attribute from ClusterService ¶
func (*ClusterService) GetServiceNode ¶
func (c *ClusterService) GetServiceNode(n string) (error, *service.ServiceObject)
GetServiceNode: get service from specifc node ¶
func (*ClusterService) GetServiceNodes ¶
func (c *ClusterService) GetServiceNodes() map[string]*service.ServiceObject
GetServiceNodes: attribute from ClusterService ¶
func (*ClusterService) GetStatus ¶
func (c *ClusterService) GetStatus() int
GetStatus: attribute from ClusterService ¶
func (*ClusterService) SetCandidateForDelation ¶
func (c *ClusterService) SetCandidateForDelation(d bool)
SetCandidateForDelation: attribute from ClusterNode ¶
func (*ClusterService) SetName ¶
func (c *ClusterService) SetName(name string)
SetName: attribute from ClusterService ¶
func (*ClusterService) SetServiceNodes ¶
func (c *ClusterService) SetServiceNodes(s map[string]*service.ServiceObject)
SetServiceNodes: attribute from ClusterService ¶
func (*ClusterService) SetStatus ¶
func (c *ClusterService) SetStatus(status int)
SetStatus: attribute from ClusterService ¶
func (*ClusterService) String ¶
func (c *ClusterService) String() string
string: convert a ClusterService object to string ¶
Click to show internal directories.
Click to hide internal directories.