Documentation ¶
Overview ¶
Package client contains code for interaction with clonemap modules
Index ¶
- type AMSClient
- func (cli *AMSClient) Alive() (alive bool)
- func (cli *AMSClient) DeleteAgent(masID int, agentID int) (httpStatus int, err error)
- func (cli *AMSClient) DeleteMAS(masID int) (httpStatus int, err error)
- func (cli *AMSClient) GetAgencies(masID int) (agencies schemas.Agencies, httpStatus int, err error)
- func (cli *AMSClient) GetAgencyInfo(masID int, imID int, agencyID int) (agency schemas.AgencyInfoFull, httpStatus int, err error)
- func (cli *AMSClient) GetAgent(masID int, agentID int) (agent schemas.AgentInfo, httpStatus int, err error)
- func (cli *AMSClient) GetAgentAddress(masID int, agentID int) (address schemas.Address, httpStatus int, err error)
- func (cli *AMSClient) GetAgents(masID int) (agents schemas.Agents, httpStatus int, err error)
- func (cli *AMSClient) GetCloneMAP() (cmap schemas.CloneMAP, httpStatus int, err error)
- func (cli *AMSClient) GetMAS(masID int) (mas schemas.MASInfo, httpStatus int, err error)
- func (cli *AMSClient) GetMASsShort() (mass []schemas.MASInfoShort, httpStatus int, err error)
- func (cli *AMSClient) PostAgents(masID int, ags []schemas.ImageGroupSpec) (httpStatus int, err error)
- func (cli *AMSClient) PostMAS(mas schemas.MASSpec) (httpStatus int, err error)
- type AgencyClient
- func (cli *AgencyClient) DeleteAgent(agency string, agentID int) (httpStatus int, err error)
- func (cli *AgencyClient) GetAgent(agency string, agentID int) (agentInfo schemas.AgentInfo, httpStatus int, err error)
- func (cli *AgencyClient) GetAgentStatus(agency string, agentID int) (agentStatus schemas.Status, httpStatus int, err error)
- func (cli *AgencyClient) GetAgents(agency string) (agentInfo []schemas.AgentInfo, httpStatus int, err error)
- func (cli *AgencyClient) GetInfo(agency string) (agencyInfo schemas.AgencyInfo, httpStatus int, err error)
- func (cli *AgencyClient) PostAgent(agency string, agent schemas.AgentInfo) (httpStatus int, err error)
- func (cli *AgencyClient) PostMsgs(agency string, msgs []schemas.ACLMessage) (httpStatus int, err error)
- func (cli *AgencyClient) PutAgentCustom(agency string, agentID int, custom string) (httpStatus int, err error)
- func (cli *AgencyClient) ReturnMsg(agency string, msg schemas.ACLMessage) (httpStatus int, err error)
- type AgentDF
- func (df *AgentDF) Close()
- func (df *AgentDF) DeregisterService(svcID string) (err error)
- func (df *AgentDF) RegisterService(svc schemas.Service) (id string, err error)
- func (df *AgentDF) SearchForLocalService(desc string, dist float64) (svc []schemas.Service, err error)
- func (df *AgentDF) SearchForService(desc string) (svc []schemas.Service, err error)
- type AgentLogger
- type DFClient
- func (cli *DFClient) Alive() (alive bool)
- func (cli *DFClient) DeleteSvc(masID int, svcID string) (httpStatus int, err error)
- func (cli *DFClient) GetGraph(masID int) (graph schemas.Graph, httpStatus int, err error)
- func (cli *DFClient) GetLocalSvc(masID int, desc string, nodeID int, dist float64) (svc []schemas.Service, httpStatus int, err error)
- func (cli *DFClient) GetSvc(masID int, desc string) (svc []schemas.Service, httpStatus int, err error)
- func (cli *DFClient) PostGraph(masID int, gr schemas.Graph) (httpStatus int, err error)
- func (cli *DFClient) PostSvc(masID int, svc schemas.Service) (retSvc schemas.Service, httpStatus int, err error)
- type LogCollector
- type LoggerClient
- func (cli *LoggerClient) Alive() (alive bool)
- func (cli *LoggerClient) GetLatestLogs(masID int, agentID int, topic string, num int) (msgs []schemas.LogMessage, httpStatus int, err error)
- func (cli *LoggerClient) GetState(masID int, agentID int) (state schemas.State, httpStatus int, err error)
- func (cli *LoggerClient) PostLogs(masID int, logs []schemas.LogMessage) (httpStatus int, err error)
- func (cli *LoggerClient) PutState(state schemas.State) (httpStatus int, err error)
- func (cli *LoggerClient) UpdateStates(masID int, states []schemas.State) (httpStatus int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AMSClient ¶
type AMSClient struct { Host string // ams host name Port int // ams port // contains filtered or unexported fields }
AMSClient is the ams client
func NewAMSClient ¶
AMSClient creates a new AMS client
func (*AMSClient) DeleteAgent ¶
DeleteAgent deletes an agent
func (*AMSClient) GetAgencies ¶
GetAgencies requests agency information
func (*AMSClient) GetAgencyInfo ¶
func (cli *AMSClient) GetAgencyInfo(masID int, imID int, agencyID int) (agency schemas.AgencyInfoFull, httpStatus int, err error)
GetAgencyInfo requests agency information
func (*AMSClient) GetAgent ¶
func (cli *AMSClient) GetAgent(masID int, agentID int) (agent schemas.AgentInfo, httpStatus int, err error)
GetAgent requests agent information
func (*AMSClient) GetAgentAddress ¶
func (cli *AMSClient) GetAgentAddress(masID int, agentID int) (address schemas.Address, httpStatus int, err error)
GetAgentAddress requests agent address
func (*AMSClient) GetCloneMAP ¶
GetCloneMAP requests CloneMAP information
func (*AMSClient) GetMASsShort ¶
func (cli *AMSClient) GetMASsShort() (mass []schemas.MASInfoShort, httpStatus int, err error)
GetMASsShort requests mas information
func (*AMSClient) PostAgents ¶
func (cli *AMSClient) PostAgents(masID int, ags []schemas.ImageGroupSpec) (httpStatus int, err error)
PostAgents post agents to mas
type AgencyClient ¶
type AgencyClient struct { Port int // ams port // contains filtered or unexported fields }
AgencyClient is the ams client
func NewAgencyClient ¶
NewAgencyClient creates a new AMS client
func (*AgencyClient) DeleteAgent ¶
func (cli *AgencyClient) DeleteAgent(agency string, agentID int) (httpStatus int, err error)
DeleteAgent requests an agent to terminate
func (*AgencyClient) GetAgent ¶
func (cli *AgencyClient) GetAgent(agency string, agentID int) (agentInfo schemas.AgentInfo, httpStatus int, err error)
GetAgent requests one agent running in agency
func (*AgencyClient) GetAgentStatus ¶
func (cli *AgencyClient) GetAgentStatus(agency string, agentID int) (agentStatus schemas.Status, httpStatus int, err error)
GetAgentStatus requests status from agent and returns it
func (*AgencyClient) GetAgents ¶
func (cli *AgencyClient) GetAgents(agency string) (agentInfo []schemas.AgentInfo, httpStatus int, err error)
GetAgents requests the agents running in agency
func (*AgencyClient) GetInfo ¶
func (cli *AgencyClient) GetInfo(agency string) (agencyInfo schemas.AgencyInfo, httpStatus int, err error)
GetInfo requests the agency info
func (*AgencyClient) PostAgent ¶
func (cli *AgencyClient) PostAgent(agency string, agent schemas.AgentInfo) (httpStatus int, err error)
PostAgent post an agent to agency
func (*AgencyClient) PostMsgs ¶
func (cli *AgencyClient) PostMsgs(agency string, msgs []schemas.ACLMessage) (httpStatus int, err error)
PostMsgs post an agent message to the agent
func (*AgencyClient) PutAgentCustom ¶
func (cli *AgencyClient) PutAgentCustom(agency string, agentID int, custom string) (httpStatus int, err error)
PutAgentCustom puts agent custom data
func (*AgencyClient) ReturnMsg ¶
func (cli *AgencyClient) ReturnMsg(agency string, msg schemas.ACLMessage) (httpStatus int, err error)
ReturnMsg return undeliverable msg
type AgentDF ¶
type AgentDF struct {
// contains filtered or unexported fields
}
AgentDF provides access to the functionality of the DF
func NewAgentDF ¶
func NewAgentDF(masID int, agentID int, nodeID int, active bool, dfCli *DFClient, logErr *log.Logger, logInf *log.Logger) (df *AgentDF)
NewAgentDF creates a new DF object
func (*AgentDF) DeregisterService ¶
DeregisterService registers a new service with the DF
func (*AgentDF) RegisterService ¶
RegisterService registers a new service with the DF
type AgentLogger ¶
type AgentLogger struct {
// contains filtered or unexported fields
}
AgentLogger is the endpoint for agents
func (*AgentLogger) NewLog ¶
func (agLog *AgentLogger) NewLog(topic string, message string, data string) (err error)
NewLog sends a new logging message to the logging service
func (*AgentLogger) RestoreState ¶
func (agLog *AgentLogger) RestoreState() (state string, err error)
RestoreState loads state saved in database and return it
func (*AgentLogger) UpdateState ¶
func (agLog *AgentLogger) UpdateState(state string) (err error)
UpdateState overrides the state stored in database
type DFClient ¶
type DFClient struct {
// contains filtered or unexported fields
}
DFClient is the ams client
func NewDFClient ¶
func NewDFClient(host string, port int, timeout time.Duration, del time.Duration, numRet int) (cli *DFClient)
NewDFClient creates a new AMS client
func (*DFClient) GetLocalSvc ¶
func (cli *DFClient) GetLocalSvc(masID int, desc string, nodeID int, dist float64) (svc []schemas.Service, httpStatus int, err error)
GetLocalSvc requests mas information
func (*DFClient) GetSvc ¶
func (cli *DFClient) GetSvc(masID int, desc string) (svc []schemas.Service, httpStatus int, err error)
GetSvc requests mas information
type LogCollector ¶
type LogCollector struct {
// contains filtered or unexported fields
}
LogCollector collects logs and states and sends them to the Logger service one LogCollector per agency is used; each agent obtains one AgentLogger
func NewLogCollector ¶
func NewLogCollector(masID int, config schemas.LoggerConfig, logErr *log.Logger, logInf *log.Logger) (logCol *LogCollector)
NewLogCollector creates an agency logger client
func (*LogCollector) NewAgentLogger ¶
func (logCol *LogCollector) NewAgentLogger(agentID int, logErr *log.Logger, logInf *log.Logger) (agLog *AgentLogger)
NewAgentLogger craetes a new object of type AgentLogger
type LoggerClient ¶
type LoggerClient struct {
// contains filtered or unexported fields
}
LoggerClient is the ams client
func NewLoggerClient ¶
func NewLoggerClient(host string, port int, timeout time.Duration, del time.Duration, numRet int) (cli *LoggerClient)
NewLoggerClient creates a new Logger client
func (*LoggerClient) GetLatestLogs ¶
func (cli *LoggerClient) GetLatestLogs(masID int, agentID int, topic string, num int) (msgs []schemas.LogMessage, httpStatus int, err error)
GetLatestLogs gets log messages
func (*LoggerClient) GetState ¶
func (cli *LoggerClient) GetState(masID int, agentID int) (state schemas.State, httpStatus int, err error)
GetState requests state from logger
func (*LoggerClient) PostLogs ¶
func (cli *LoggerClient) PostLogs(masID int, logs []schemas.LogMessage) (httpStatus int, err error)
PostLogs posts new log messages to logger
func (*LoggerClient) PutState ¶
func (cli *LoggerClient) PutState(state schemas.State) (httpStatus int, err error)
PutState updates the state
func (*LoggerClient) UpdateStates ¶
func (cli *LoggerClient) UpdateStates(masID int, states []schemas.State) (httpStatus int, err error)
UpdateStates updates the state