-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Package logger provides a global logger interface for logging from plugins. | ||
// | ||
// This package is a wrapper for hclog, and it initializes the global logger on import. | ||
// You can freely write logs from anywhere via the public API according to the log level. | ||
// The log by hclog is interpreted as a structured log by go-plugin, and the log level | ||
// can be handled correctly. | ||
package logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Package fromproto contains an implementation to decode a structure | ||
// generated from *.proto into a real Go structure. This package is not | ||
// intended to be used directly from plugins. | ||
// | ||
// Many primitives can be handled as-is, but some interfaces and errors | ||
// require special decoding. The `hcl.Expression` restores the interface | ||
// by reparsed based on the bytes and their range. The `tflint.Rule` | ||
// restores the interface by filling the value in a pseudo-structure that | ||
// satisfies the interface. Error makes use of gRPC error details to recover | ||
// the wrapped error. Rewrap the error based on the error code obtained | ||
// from details. | ||
package fromproto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Package host2pluign contains a gRPC server (plugin) and client (host). | ||
// | ||
// In the plugin system, this communication is the first thing that happens, | ||
// and a plugin must use this package to provide a gRPC server. | ||
// However, the detailed implementation is hidden in the tflint.RuleSet interface, | ||
// and plugin developers usually don't need to be aware of gRPC server behavior. | ||
// | ||
// When the host initializes a gRPC client, go-plugin starts a gRPC server | ||
// on the plugin side as another process. This package acts as a wrapper for go-plugin. | ||
// Separately, the Check function initializes a new gRPC client for plugin-to-host | ||
// communication. See the plugin2host package for details. | ||
package host2plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Package interceptor contains gRPC interceptors. | ||
// This package is not intended to be used directly from plugins. | ||
// Its main use today is to insert shared processes such as logging. | ||
package interceptor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Package plugin2host contains a gRPC server (host) and client (plugin). | ||
// | ||
// Communication from the plugin to the host is the second one that occurs. | ||
// To understand what happens first, see the host2plugin package first. | ||
// The gRPC client used by the plugin is implicitly initialized by the host2plugin | ||
// package and hidden in the tflint.Runner interface. Normally, plugin developers | ||
// do not need to be aware of the details of this client. | ||
// | ||
// The host starts a gRPC server as goroutine to respond from the plugin side | ||
// when calling Check function in host2plugin. Please note that the gRPC server | ||
// and client startup in plugin2host is not due to go-plugin. | ||
package plugin2host |
Oops, something went wrong.