client

package
v0.0.0-...-a556200 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 12 Imported by: 0

Documentation

Overview

Package client contains code for interaction with clonemap modules

Index

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

func NewAMSClient(timeout time.Duration, del time.Duration, numRet int) (cli *AMSClient)

AMSClient creates a new AMS client

func (*AMSClient) Alive

func (cli *AMSClient) Alive() (alive bool)

Alive tests if alive

func (*AMSClient) DeleteAgent

func (cli *AMSClient) DeleteAgent(masID int, agentID int) (httpStatus int, err error)

DeleteAgent deletes an agent

func (*AMSClient) DeleteMAS

func (cli *AMSClient) DeleteMAS(masID int) (httpStatus int, err error)

DeleteMAS deletes a MAS

func (*AMSClient) GetAgencies

func (cli *AMSClient) GetAgencies(masID int) (agencies schemas.Agencies, httpStatus int, err error)

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) GetAgents

func (cli *AMSClient) GetAgents(masID int) (agents schemas.Agents, httpStatus int, err error)

GetAgents requests agent information

func (*AMSClient) GetCloneMAP

func (cli *AMSClient) GetCloneMAP() (cmap schemas.CloneMAP, httpStatus int, err error)

GetCloneMAP requests CloneMAP information

func (*AMSClient) GetMAS

func (cli *AMSClient) GetMAS(masID int) (mas schemas.MASInfo, httpStatus int, err error)

GetMAS requests mas 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

func (*AMSClient) PostMAS

func (cli *AMSClient) PostMAS(mas schemas.MASSpec) (httpStatus int, err error)

PostMAS post an mas

type AgencyClient

type AgencyClient struct {
	Port int // ams port
	// contains filtered or unexported fields
}

AgencyClient is the ams client

func NewAgencyClient

func NewAgencyClient(timeout time.Duration, del time.Duration, numRet int) (cli *AgencyClient)

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) Close

func (df *AgentDF) Close()

close closes the DF module

func (*AgentDF) DeregisterService

func (df *AgentDF) DeregisterService(svcID string) (err error)

DeregisterService registers a new service with the DF

func (*AgentDF) RegisterService

func (df *AgentDF) RegisterService(svc schemas.Service) (id string, err error)

RegisterService registers a new service with the DF

func (*AgentDF) SearchForLocalService

func (df *AgentDF) SearchForLocalService(desc string, dist float64) (svc []schemas.Service, err error)

SearchForLocalService search for a service with given description

func (*AgentDF) SearchForService

func (df *AgentDF) SearchForService(desc string) (svc []schemas.Service, err error)

SearchForService search for a service with given description

type AgentLogger

type AgentLogger struct {
	// contains filtered or unexported fields
}

AgentLogger is the endpoint for agents

func (*AgentLogger) Close

func (agLog *AgentLogger) Close()

close closes the logger

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) Alive

func (cli *DFClient) Alive() (alive bool)

Alive tests if alive

func (*DFClient) DeleteSvc

func (cli *DFClient) DeleteSvc(masID int, svcID string) (httpStatus int, err error)

DeleteSvc removes service from df

func (*DFClient) GetGraph

func (cli *DFClient) GetGraph(masID int) (graph schemas.Graph, httpStatus int, err error)

GetGraph returns graph of mas

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

func (*DFClient) PostGraph

func (cli *DFClient) PostGraph(masID int, gr schemas.Graph) (httpStatus int, err error)

PostGraph post the graph of a mas

func (*DFClient) PostSvc

func (cli *DFClient) PostSvc(masID int, svc schemas.Service) (retSvc schemas.Service, httpStatus int,
	err error)

PostSvc post an mas

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) Alive

func (cli *LoggerClient) Alive() (alive bool)

Alive tests if alive

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

Jump to

Keyboard shortcuts

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