Documentation ¶
Index ¶
- Constants
- Variables
- func ClosePlugin(name string) error
- func Serve(opts *ServeOpts) error
- type BackendConfig
- type Client
- func (c *Client) Check() error
- func (c *Client) Disable() error
- func (c *Client) Get(req *Request) (*Response, error)
- func (c *Client) GetDriverInfo(req *Request) (*Response, error)
- func (c *Client) Open() error
- func (c *Client) Restart(req *Request) (*Response, error)
- func (c *Client) Set(req *Request) (*Response, error)
- func (c *Client) SetConfig(req *Request) (*Response, error)
- func (c *Client) Setup(config *BackendConfig) (*Response, error)
- func (c *Client) Start(req *Request) (*Response, error)
- func (c *Client) Status() (enable, on bool)
- func (c *Client) Stop(req *Request) (*Response, error)
- type Driver
- type DriverConfig
- type DriverGRPCPlugin
- type Entry
- type Factory
- type Report
- type Request
- type Response
- type ServeOpts
- type TLSProviderFunc
Constants ¶
View Source
const PluginName = "driver"
View Source
const (
ProgramEntryYaml = "program.yml" // in program package to specify entry
)
Variables ¶
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "DRIVER_PLUGIN",
MagicCookieValue: "ON",
}
Handshake is a common handshake that is shared by plugin and host.
View Source
var PluginFactories = make(map[string]*Client)
View Source
var PluginLock sync.Mutex
View Source
var PluginMap = map[string]plugin.Plugin{ PluginName: &DriverGRPCPlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
func ClosePlugin ¶
Types ¶
type BackendConfig ¶
type Client ¶
func RegisterPlugin ¶
func RegisterPlugin(driver DriverConfig) (*Client, error)
type Driver ¶
type Driver interface { // GetDriverInfo 获取驱动信息 GetDriverInfo(req *Request) (*Response, error) // SetConfig 配置驱动,目前只配置了驱动的配置文件路径 SetConfig(req *Request) (*Response, error) // Setup 宿主进程上报接口传递,必须调用下述逻辑,其余可用户自定义 Setup(config *BackendConfig) (*Response, error) // Start 驱动采集启动,用户自定义实现 Start(req *Request) (*Response, error) // Restart 驱动重启,用户自定义实现 Restart(req *Request) (*Response, error) // Stop 驱动停止,用户自定义实现 Stop(req *Request) (*Response, error) // Get 召测,用户自定义实现 Get(req *Request) (*Response, error) // Set 置数,用户自定义实现 Set(req *Request) (*Response, error) }
type DriverConfig ¶
type DriverGRPCPlugin ¶
func (*DriverGRPCPlugin) GRPCClient ¶
func (p *DriverGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (any, error)
func (*DriverGRPCPlugin) GRPCServer ¶
func (p *DriverGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type Factory ¶
type Factory func(context.Context, *BackendConfig) (Driver, error)
Factory is the factory function to create a logical driver backend.
type Report ¶
type Report interface { Post(req *Request) (*Response, error) State(req *Request) (*Response, error) }
Report 驱动 --> 宿主
type ServeOpts ¶
type ServeOpts struct { FactoryFunc Factory TLSProviderFunc TLSProviderFunc Logger log.Logger }
type TLSProviderFunc ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.