Documentation ¶
Index ¶
- Variables
- func Run()
- type Plugin
- func (p *Plugin) Checksum() string
- func (p *Plugin) Close(timeout bool)
- func (p *Plugin) Connect(req procotol.RegistRequest, conn net.Conn) error
- func (p *Plugin) Connected() bool
- func (p *Plugin) Name() string
- func (p *Plugin) PID() int
- func (p *Plugin) Receive() (*spec.Data, error)
- func (p *Plugin) Run() error
- func (p *Plugin) Send(t spec.Task) error
- func (p *Plugin) Version() string
- type Server
Constants ¶
This section is empty.
Variables ¶
var SocketPath = "plugin.sock"
Functions ¶
Types ¶
type Plugin ¶
type Plugin struct { IO uint64 CPU float64 Counter atomic.Uint64 // contains filtered or unexported fields }
Plugin contains the process, socket, metadata and other information of a plugin
func (*Plugin) Close ¶
Close func is used to close this plugin, when closing it will kill all processes under the same process group
func (*Plugin) Connect ¶
Connect func is used to verify the connection request, if the pgid is inconsistent, an error will be returned Note that it is necessary to call Server's Delete func to clean up after this func returns error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the unix doamin socket listener of the plugin, and it maintains a plugin map
func GetServer ¶
GetServer func is used to obtain the server instance, please note: this function is not concurrently safe
func (*Server) Close ¶
func (s *Server) Close()
Close func closes the unix domain socket listener in the server and deletes all plugin instances
func (*Server) Delete ¶
Delete func deletes a plugin instance from the server, the Close() method of the plugin will be called before deleting from the map
func (*Server) ForEach ¶
ForEach is used to traverse all plugin instances with specified operations, for efficiency reasons, do not perform longer operations
func (*Server) Insert ¶
Insert a new plugin, note: if there is a plugin with the same name before, please close it first
func (*Server) PluginList ¶
PluginList func traverses the server map and returns all plugin names