diff options
author | Jesse Hallam <jesse.hallam@gmail.com> | 2018-07-13 10:29:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 10:29:50 -0400 |
commit | 17f211c393772f30922bac595592e3fe60c2ef25 (patch) | |
tree | 4f8dfbe7949022d5da2de2db6d7b762e74fb4582 /plugin/supervisor.go | |
parent | 5ddb08dcb47f938c9ac3a3e6338d9b3cc61c20a7 (diff) | |
download | chat-17f211c393772f30922bac595592e3fe60c2ef25.tar.gz chat-17f211c393772f30922bac595592e3fe60c2ef25.tar.bz2 chat-17f211c393772f30922bac595592e3fe60c2ef25.zip |
MM-11292: clean up plugins GoDoc (#9109)
* clean up plugins GoDoc:
- eliminate plugin.NewBlankContext() as unnecessary
- export ValidIdRegex as a string vs. the less readable var
- add/update various documentation strings
- hide everything by default, except where used by client plugins or the mattermost-server. The exception to this rule are the `*(Args|Returns)` structs which must be public for go-plugin, but are now prefixed with `Z_` with a warning not to use.
- include a top-level example to get plugin authors started
This is not a breaking change for existing plugins compiled against
plugins-v2.
* remove commented out ServeHTTPResponseWriter
* update examples to match developer docs
* add missing plugin/doc.go license header
Diffstat (limited to 'plugin/supervisor.go')
-rw-r--r-- | plugin/supervisor.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugin/supervisor.go b/plugin/supervisor.go index 58a7aa783..1e1005f53 100644 --- a/plugin/supervisor.go +++ b/plugin/supervisor.go @@ -15,25 +15,25 @@ import ( "github.com/mattermost/mattermost-server/model" ) -type Supervisor struct { +type supervisor struct { pluginId string client *plugin.Client hooks Hooks implemented [TotalHooksId]bool } -func NewSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiImpl API) (*Supervisor, error) { - supervisor := Supervisor{} +func newSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiImpl API) (*supervisor, error) { + supervisor := supervisor{} wrappedLogger := pluginInfo.WrapLogger(parentLogger) - hclogAdaptedLogger := &HclogAdapter{ + hclogAdaptedLogger := &hclogAdapter{ wrappedLogger: wrappedLogger.WithCallerSkip(1), extrasKey: "wrapped_extras", } pluginMap := map[string]plugin.Plugin{ - "hooks": &HooksPlugin{ + "hooks": &hooksPlugin{ log: wrappedLogger, apiImpl: apiImpl, }, @@ -46,7 +46,7 @@ func NewSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiI executable = filepath.Join(pluginInfo.Path, executable) supervisor.client = plugin.NewClient(&plugin.ClientConfig{ - HandshakeConfig: Handshake, + HandshakeConfig: handshake, Plugins: pluginMap, Cmd: exec.Command(executable), SyncStdout: wrappedLogger.With(mlog.String("source", "plugin_stdout")).StdLogWriter(), @@ -71,7 +71,7 @@ func NewSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiI return nil, err } else { for _, hookName := range impl { - if hookId, ok := HookNameToId[hookName]; ok { + if hookId, ok := hookNameToId[hookName]; ok { supervisor.implemented[hookId] = true } } @@ -85,14 +85,14 @@ func NewSupervisor(pluginInfo *model.BundleInfo, parentLogger *mlog.Logger, apiI return &supervisor, nil } -func (sup *Supervisor) Shutdown() { +func (sup *supervisor) Shutdown() { sup.client.Kill() } -func (sup *Supervisor) Hooks() Hooks { +func (sup *supervisor) Hooks() Hooks { return sup.hooks } -func (sup *Supervisor) Implements(hookId int) bool { +func (sup *supervisor) Implements(hookId int) bool { return sup.implemented[hookId] } |