mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 14:29:44 +08:00
refactor: relocate files
This commit is contained in:
14
plugin/inner/interface.go
Normal file
14
plugin/inner/interface.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package pluginInternal
|
||||||
|
|
||||||
|
// FuncCaller is the interface that we're exposing as a plugin.
|
||||||
|
type FuncCaller interface {
|
||||||
|
GetNames() ([]string, error) // get all plugin function names list
|
||||||
|
Call(funcName string, args ...interface{}) (interface{}, error) // call plugin function
|
||||||
|
}
|
||||||
|
|
||||||
|
type IPlugin interface {
|
||||||
|
Init(path string) error // init plugin
|
||||||
|
Has(funcName string) bool // check if plugin has function
|
||||||
|
Call(funcName string, args ...interface{}) (interface{}, error) // call function
|
||||||
|
Quit() error // quit plugin
|
||||||
|
}
|
||||||
@@ -18,12 +18,6 @@ type funcData struct {
|
|||||||
Args []interface{} // function arguments
|
Args []interface{} // function arguments
|
||||||
}
|
}
|
||||||
|
|
||||||
// FuncCaller is the interface that we're exposing as a plugin.
|
|
||||||
type FuncCaller interface {
|
|
||||||
GetNames() ([]string, error) // get all plugin function names list
|
|
||||||
Call(funcName string, args ...interface{}) (interface{}, error) // call plugin function
|
|
||||||
}
|
|
||||||
|
|
||||||
// functionRPC runs on the host side.
|
// functionRPC runs on the host side.
|
||||||
type functionRPC struct {
|
type functionRPC struct {
|
||||||
client *rpc.Client
|
client *rpc.Client
|
||||||
@@ -101,10 +95,3 @@ func (p *HRPPlugin) Server(*plugin.MuxBroker) (interface{}, error) {
|
|||||||
func (HRPPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) {
|
func (HRPPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) {
|
||||||
return &functionRPC{client: c}, nil
|
return &functionRPC{client: c}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPlugin interface {
|
|
||||||
Init(path string) error // init plugin
|
|
||||||
Has(funcName string) bool // check if plugin has function
|
|
||||||
Call(funcName string, args ...interface{}) (interface{}, error) // call function
|
|
||||||
Quit() error // quit plugin
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user