Documentation ¶
Overview ¶
Package plugin contains the implementations needed to make the built binary act as a plugin.
A plugin is implemented as an RPC server and the host acts as the client, sending analysis requests to the plugin. Note that the server-client relationship here is the opposite of the communication that takes place during the checking phase.
Implementation details are hidden in go-plugin. This package is essentially a wrapper for go-plugin.
Index ¶
- func NewClient(opts *ClientOpts) *plugin.Client
- func Serve(opts *ServeOpts)
- type Client
- type ClientOpts
- type RuleSetPlugin
- type ServeOpts
- type Server
- func (s *Server) ApplyConfig(config *tflint.Config, resp *interface{}) error
- func (s *Server) Check(brokerID uint32, resp *interface{}) error
- func (s *Server) RuleNames(args interface{}, resp *[]string) error
- func (s *Server) RuleSetName(args interface{}, resp *string) error
- func (s *Server) RuleSetVersion(args interface{}, resp *string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(opts *ClientOpts) *plugin.Client
NewClient is a wrapper of plugin.NewClient.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an RPC client for the host.
func (*Client) ApplyConfig ¶
ApplyConfig calls the server-side ApplyConfig method.
func (*Client) Check ¶
Check calls the server-side Check method. At the same time, it starts the server to respond to requests from the plugin side. Note that this server (tfserver.Server) serves clients that satisfy the Runner interface and is different from the server (plugin.Server) that provides the plugin system.
func (*Client) RuleNames ¶
RuleNames calls the server-side RuleNames method and returns the list of names.
func (*Client) RuleSetName ¶
RuleSetName calls the server-side RuleSetName method and returns its name.
func (*Client) RuleSetVersion ¶
RuleSetVersion calls the server-side RuleSetVersion method and returns its version.
type ClientOpts ¶
ClientOpts is an option for initializing a Client.
type RuleSetPlugin ¶
type RuleSetPlugin struct {
// contains filtered or unexported fields
}
RuleSetPlugin is a wrapper to satisfy the interface of go-plugin.
type ServeOpts ¶
ServeOpts is an option for serving a plugin. Each plugin can pass a RuleSet that represents its own functionality.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an RPC server acting as a plugin.
func (*Server) ApplyConfig ¶
ApplyConfig applies the passed config to its own plugin implementation.
func (*Server) Check ¶
Check calls its own plugin implementation with an RPC client that can send requests to the host process.
func (*Server) RuleSetName ¶
RuleSetName returns the name of the plugin.
func (*Server) RuleSetVersion ¶
RuleSetVersion returns the version of the plugin.