schemas

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: 2 Imported by: 0

Documentation

Overview

Package schemas defines the data structures used for the REST APIs

Index

Constants

View Source
const (
	// initialization performative
	FIPAPerfNone = iota
	// The action of accepting a previously submitted proposal to perform an action
	FIPAPerfAcceptProposal = iota
	// The action of agreeing to perform some action, possibly in the future
	FIPAPerfAgree = iota
	// The action of one agent informing another agent that the first agent no longer has the
	// intention that the second agent perform some action
	FIPAPerfCancel = iota
	// The action of calling for proposals to perform a given action
	FIPAPerfCallForProposal = iota
	// The sender informs the receiver that a given proposition is true, where the receiver is
	// known to be uncertain about the proposition
	FIPAPerfConfirm = iota
	// The sender informs the receiver that a given proposition is false, where the receiver is
	// known to believe, or believe it likely that, the proposition is true
	FIPAPerfDisconfirm = iota
	// The action of telling another agent that an action was attempted but the attempt failed
	FIPAPerfFailure = iota
	// The sender informs the receiver that a given proposition is true
	FIPAPerfInform = iota
	// A macro action for the agent of the action to inform the recipient whether or not a
	// proposition is true
	FIPAPerfInformIf = iota
	// A macro action for sender to inform the receiver the object which corresponds to a
	// descriptor, for example, a name
	FIPAPerfInformRef = iota
	// The sender of the act (for example, i) informs the receiver (for example, j) that it
	// perceived that j performed some action, but that i did not understand what j just did.
	// A particular core case is that i tells j that i did not understand the message that j has
	// just sent to i
	FIPAPerfNotUnderstood = iota
	// The sender intends that the receiver treat the embedded message as sent directly to the
	// receiver, and wants the receiver to identify the agents denoted by the given descriptor and
	// send the received propagate message to them
	FIPAPerfPropagate = iota
	// The action of submitting a proposal to perform a certain action, given certain preconditions
	FIPAPerfPropose = iota
	// The  sender wants the receiver to select target agents denoted by a given description and
	// to send an embedded message to them
	FIPAPerfProxy = iota
	// The action of asking another agent whether or not a given proposition is true
	FIPAPerfQueryIf = iota
	// The action of asking another agent for the object referred to by a referential expression
	FIPAPerfQueryRef = iota
	// The action of refusing to perform a given action, and explaining the reason for the refusal
	FIPAPerfRefuse = iota
	// The action of rejecting a proposal to perform some action during a negotiation
	FIPAPerfRejectProposal = iota
	// The sender requests the receiver to perform some action. One important class of uses of the
	// request act is to request the receiver to perform another communicative act
	FIPAPerfRequest = iota
	// The sender wants the receiver to perform some action when some given proposition becomes true
	FIPAPerfRequestWhen = iota
	// The sender wants the receiver to perform some action as soon as some proposition becomes
	// true and thereafter each time the proposition becomes true again
	FIPAPerfRequestWhenever = iota
	// The act of requesting a persistent intention to notify the sender of the value of a
	// reference, and to notify again whenever the object identified by the reference changes
	FIPAPerfSubscribe = iota
)

FIPA performatives

View Source
const (
	// initialization protocol
	FIPAProtNone                = iota
	FIPAProtRequest             = iota
	FIPAProtQuery               = iota
	FIPAProtRequestWhen         = iota
	FIPAProtContractNet         = iota
	FIPAProtIteratedContractNet = iota
	FIPAProtEnglishAuction      = iota
	FIPAProtDutchAuction        = iota
	FIPAProtBrokering           = iota
	FIPAProtRecruiting          = iota
	FIPAProtSubscribe           = iota
	FIPAProtPropose             = iota
)

FIPA protocols

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLMessage

type ACLMessage struct {
	Timestamp      time.Time `json:"ts"`                // sending time
	Performative   int       `json:"perf"`              // Denotes the type of the communicative act of the ACL message
	Sender         int       `json:"sender"`            // Denotes the identity of the sender of the message
	AgencySender   string    `json:"agencys"`           // denotes the name of the sender agency
	Receiver       int       `json:"receiver"`          // Denotes the identity of the intended recipients of the message
	AgencyReceiver string    `json:"agencyr"`           // denotes the name of the receiver agency
	ReplyTo        int       `json:"repto,omitempty"`   // This parameter indicates that subsequent messages in this conversation thread are to be directed to the agent named in the reply-to parameter, instead of to the agent named in the sender parameter
	Content        string    `json:"content"`           // Denotes the content of the message
	Language       string    `json:"lang,omitempty"`    // Denotes the language in which the content parameter is expressed
	Encoding       string    `json:"enc,omitempty"`     // Denotes the specific encoding of the content language expression
	Ontology       string    `json:"ont,omitempty"`     // Denotes the ontology(s) used to give a meaning to the symbols in the content expression
	Protocol       int       `json:"prot"`              // Denotes the interaction protocol that the sending agent is employing with this ACL message
	ConversationID int       `json:"convid,omitempty"`  // Introduces an expression which is used to identify the ongoing sequence of communicative acts that together form a conversation
	ReplyWith      string    `json:"repwith,omitempty"` // Introduces an expression that will be used by the responding agent to identify this message
	InReplyTo      int       `json:"inrepto,omitempty"` // Denotes an expression that references an earlier action to which this message is a reply
	ReplyBy        time.Time `json:"repby,omitempty"`   // Denotes a time and/or date expression which indicates the latest time by which the sending agent would like to receive a reply
}

ACLMessage struct representing agent message

func (ACLMessage) String

func (msg ACLMessage) String() (ret string)

String outputs message

type AMSConfig

type AMSConfig struct {
	Host string `json:"host,omitempty"` // hostname of AMS
	Port int    `json:"port,omitempty"` // port of AMS
}

AMSConfig contains the host and port configuration of the AMS

type Address

type Address struct {
	Agency string `json:"agency"`
}

Address holds the address information of an agent

type Agencies

type Agencies struct {
	Counter int          `json:"counter"`   // counter for agents
	Inst    []AgencyInfo `json:"instances"` // agencies
}

Agencies contains information about how many agencies are running

type AgencyInfo

type AgencyInfo struct {
	MASID        int    `json:"masid"` // ID of MAS
	Name         string `json:"name"`  // name of agency (hostname of pod given by kubernetes)
	ID           int    `json:"id"`    // within image group unique ID (contained in name)
	ImageGroupID int    `json:"imid"`  // ID of agency image group
	// Logger       LoggerConfig `json:"logger"` // logger configuration
	// MQTT         MQTTConfig   `json:"mqtt"`   // MQTT configuration
	// DF           DFConfig     `json:"df"`     // DF configuration
	// MASName      string       `json:"masname"`          // name of MAS as specified by user in MASConfig
	// MASCustom    string       `json:"custom,omitempty"` // custom global configuration data from MASConfig
	Agents []int  `json:"agents"`
	Status Status `json:"status"`
}

AgencyInfo contains information about agency spec and status (for storage)

type AgencyInfoFull

type AgencyInfoFull struct {
	MASID        int          `json:"masid"`               // ID of MAS
	Name         string       `json:"name"`                // name of agency (hostname of pod given by kubernetes)
	ID           int          `json:"id"`                  // within image group unique ID (contained in name)
	ImageGroupID int          `json:"imid"`                // ID of agency image group
	Logger       LoggerConfig `json:"logger"`              // logger configuration
	MQTT         MQTTConfig   `json:"mqtt"`                // MQTT configuration
	DF           DFConfig     `json:"df"`                  // DF configuration
	MASName      string       `json:"masname"`             // name of MAS as specified by user in MASConfig
	MASCustom    string       `json:"mascustom,omitempty"` // custom global configuration data from MASConfig
	Agents       []AgentInfo  `json:"agents"`
	Status       Status       `json:"status"`
}

AgencyInfoFull contains information about agency and full info about agents it conatins (for api)

type AgencyStatus

type AgencyStatus struct {
	Status Status        `json:"status"` // statuscode
	Agents []AgentStatus `json:"agents"` // status of all agents in agency
}

AgencyStatus contains status of agent

type AgentInfo

type AgentInfo struct {
	Spec         AgentSpec `json:"spec"`
	MASID        int       `json:"masid"`    // ID of MAS
	AgencyID     int       `json:"agencyid"` // name of the agency
	ImageGroupID int       `json:"imid"`     // ID of agency image
	ID           int       `json:"id"`       // ID of agent
	Address      Address   `json:"address"`
	Status       Status    `json:"status"`
}

AgentInfo contains information about agent spec, address, communication, mqtt and status

type AgentSpec

type AgentSpec struct {
	NodeID   int    `json:"nodeid"`            // id of the node the agent is attached to
	Name     string `json:"name,omitempty"`    // name/description of agent
	AType    string `json:"type,omitempty"`    // type of agent (application dependent)
	ASubtype string `json:"subtype,omitempty"` // subtype of agent (application dependent)
	Custom   string `json:"custom,omitempty"`  // custom configuration data
}

AgentSpec contains information about a agent running in a MAS

type AgentStatus

type AgentStatus struct {
	ID     int    `json:"id"`     // unique ID
	Status Status `json:"status"` // statuscode
}

AgentStatus contains status of agency

type Agents

type Agents struct {
	Counter int         `json:"counter"`   // counter for agents
	Inst    []AgentInfo `json:"instances"` // agent ids
}

Agents contains information about how many agents are running

type CloneMAP

type CloneMAP struct {
	Version string    `json:"version,omitempty"` // version of clonemap
	Uptime  time.Time `json:"uptime,omitempty"`  // uptime of clonemap instance
}

CloneMAP contains information about clonemap

type Communication

type Communication struct {
	ID         int `json:"id"`      // id of other agent
	NumMsgSent int `json:"numsent"` // number of messages sent to this agent
	NumMsgRecv int `json:"numrecv"` // number of messages received from this agent
}

Communication contains information regarding communication with another agent

type DFConfig

type DFConfig struct {
	Active bool   `json:"active"`         // indicates if DF is active/usable
	Host   string `json:"host,omitempty"` // hostname of DF
	Port   int    `json:"port,omitempty"` // port of DF
}

DFConfig contains the host and port configuration of the DF and indicates if it is active

type Edge

type Edge struct {
	Node1  int     `json:"n1"`     // id of node 1
	Node2  int     `json:"n2"`     // id of node 2
	Weight float64 `json:"weight"` // weight of edge
}

Edge is one dge of graph

type Graph

type Graph struct {
	Node []Node `json:"node"` // list of graph nodes
	Edge []Edge `json:"edge"` // list of graph edges
}

Graph stores one mas graph for topological search

type ImageGroupConfig

type ImageGroupConfig struct {
	Image      string `json:"image"`            // docker image to be used for agencies
	PullSecret string `json:"secret,omitempty"` // image pull secret
}

ImageGroupConfig contains information about the image group

type ImageGroupInfo

type ImageGroupInfo struct {
	Config   ImageGroupConfig `json:"config"`
	ID       int              `json:"id"`
	Agencies Agencies         `json:"agencies"`
}

ImageGroupInfo contains information about all agents that have the same image

type ImageGroupSpec

type ImageGroupSpec struct {
	Config ImageGroupConfig `json:"config"`
	Agents []AgentSpec      `json:"agents"`
}

ImageGroupSpec contains information about all agents that have the same image

type ImageGroups

type ImageGroups struct {
	Counter int              `json:"counter"`   // counter for agents
	Inst    []ImageGroupInfo `json:"instances"` // image groups
}

ImageGroups contains information about how many image groups are running

type LogMessage

type LogMessage struct {
	MASID          int       `json:"masid"`          // ID of MAS agent runs in
	AgentID        int       `json:"agentid"`        // ID of agent
	Timestamp      time.Time `json:"timestamp"`      // time of message
	Topic          string    `json:"topic"`          // log type (error, debug, msg, status, app)
	Message        string    `json:"msg"`            // log message
	AdditionalData string    `json:"data,omitempty"` // additional information e.g in json
}

LogMessage contains data of a single agent log message

type LoggerConfig

type LoggerConfig struct {
	Active      bool   `json:"active"`           // indicates if logger is active/usable
	TopicMsg    bool   `json:"msg,omitempty"`    // activation of msg log topic
	TopicApp    bool   `json:"app,omitempty"`    // activation of app log topic
	TopicStatus bool   `json:"status,omitempty"` // activation of status log topic
	TopicDebug  bool   `json:"debug,omitempty"`  // activation of debug log topic
	Host        string `json:"host,omitempty"`   // hostname of Logger
	Port        int    `json:"port,omitempty"`   // port of Logger
}

LoggerConfig contains configuration of logger service

type MASConfig

type MASConfig struct {
	Name               string       `json:"name,omitempty"`   // name/description of MAS
	NumAgentsPerAgency int          `json:"agentsperagency"`  // number of agents per agency
	MQTT               MQTTConfig   `json:"mqtt"`             //switch for mqtt
	DF                 DFConfig     `json:"df"`               //switch for df
	Logger             LoggerConfig `json:"logger"`           // logger configuration
	Custom             string       `json:"custom,omitempty"` // custom configuration data
}

MASConfig contains configuration of MAS

type MASInfo

type MASInfo struct {
	// Spec        MASSpec          `json:"spec"`
	ID          int         `json:"id"`
	Config      MASConfig   `json:"config"`
	Graph       Graph       `json:"graph"`
	ImageGroups ImageGroups `json:"imagegroups"`
	Agents      Agents      `json:"agents"`
	Uptime      time.Time   `json:"uptime"`
	Status      Status      `json:"status"`
}

MASInfo contains info about MAS spec, agents and agencies in MAS

type MASInfoShort

type MASInfoShort struct {
	ID        int       `json:"id"`
	Config    MASConfig `json:"config"`
	NumAgents int       `json:"numagents"`
	Uptime    time.Time `json:"uptime"`
	Status    Status    `json:"status"`
}

MASInfoShort contains info about MAS spec, agents in MAS

type MASSpec

type MASSpec struct {
	Config      MASConfig        `json:"config"`
	ImageGroups []ImageGroupSpec `json:"imagegroups"`
	Graph       Graph            `json:"graph"`
}

MASSpec contains information about a MAS running in clonemap

type MASs

type MASs struct {
	Counter int       `json:"counter"`   // number of running mas
	Inst    []MASInfo `json:"instances"` // mas ids
}

MASs contains informaton about how many MASs are running

type MQTTConfig

type MQTTConfig struct {
	Active bool   `json:"active"`         // indicates if MQTT is active/usable
	Host   string `json:"host,omitempty"` // hostname of MQTT
	Port   int    `json:"port,omitempty"` // port of MQTT
}

MQTTConfig contains the host and port configuration of the broker and indicates if it is active

type MQTTMessage

type MQTTMessage struct {
	Topic   string // Topic of message
	Content []byte // Denotes the content of the message
}

MQTTMessage struct representing mqtt message

func (MQTTMessage) String

func (msg MQTTMessage) String() (ret string)

String outputs message

type ModuleConfig

type ModuleConfig struct {
	AMS    AMSConfig    `json:"ams"`    // AMS config
	DF     DFConfig     `json:"df"`     // df config
	Logger LoggerConfig `json:"logger"` // logger config
	MQTT   MQTTConfig   `json:"mqtt"`   // MQTT config
}

ModuleConfig shows the config of all modules

type ModuleStatus

type ModuleStatus struct {
	Core   bool `json:"core"`   // Core module
	DF     bool `json:"df"`     // DF module
	Logger bool `json:"logger"` // Logging module
}

ModuleStatus shows the status of clonemaps modules

type Node

type Node struct {
	ID    int   `json:"id"`               // unique ID of node
	Agent []int `json:"agents,omitempty"` // list of agents attached to node
}

Node is one graph node

type Service

type Service struct {
	GUID      string    `json:"id"`        // unique svc id
	AgentID   int       `json:"agentid"`   // ID of agent who registered service
	NodeID    int       `json:"nodeid"`    // ID of node agent is located at
	MASID     int       `json:"masid"`     // ID of MAS agent lives in
	CreatedAt time.Time `json:"createdat"` // time of service creation
	ChangedAt time.Time `json:"changedat"` // time of last change
	Desc      string    `json:"desc"`      // description
	Dist      float64   `json:"dist"`      // distance (only if local search was executed)
}

Service holds information about an agent service that can be registered and searched with the DF

type State

type State struct {
	MASID     int       `json:"masid"`     // ID of MAS agent runs in
	AgentID   int       `json:"agentid"`   // ID of agent
	Timestamp time.Time `json:"timestamp"` // time of state
	State     string    `json:"state"`     // State
}

State contains the state of an agent as byte array (json)

type Status

type Status struct {
	Code       int       `json:"code"`       // status code
	LastUpdate time.Time `json:"lastupdate"` // time of last update
}

Status contains information about an agent's or agency's status

type StubAgencyConfig

type StubAgencyConfig struct {
	MASID        int    `json:"masid"`
	AgencyID     int    `json:"agencyid"`
	ImageGroupID int    `json:"imid"` // ID of agency image
	Image        string `json:"image"`
	Logging      bool   `json:"logger"` // switch for logging module
	MQTT         bool   `json:"mqtt"`   //switch for mqtt
	DF           bool   `json:"df"`     //switch for df
}

StubAgencyConfig holds configuration of agency to be started or terminated

Jump to

Keyboard shortcuts

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