Documentation ¶
Overview ¶
Package common encapulates data structures and functions that will be used by plugin executables and the plugin subsystem in the stash server.
Index ¶
Constants ¶
const (
HookContextKey = "hookContext"
)
Variables ¶
This section is empty.
Functions ¶
func ServePlugin ¶
ServePlugin is used by plugin instances to serve the plugin via RPC, using the provided RPCRunner interface.
Types ¶
type ArgsMap ¶
type ArgsMap map[string]PluginArgValue
ArgsMap is a map of argument key to value.
type HookContext ¶ added in v0.8.0
type HookContext struct { ID int `json:"id,omitempty"` Type string `json:"type"` Input interface{} `json:"input"` InputFields []string `json:"inputFields,omitempty"` }
HookContext is passed as a PluginArgValue and indicates what hook triggered this plugin task.
type PluginArgValue ¶
type PluginArgValue interface{}
PluginArgValue represents a single value parameter for plugin operations.
type PluginInput ¶
type PluginInput struct { // Server details to connect to the stash server. ServerConnection StashServerConnection `json:"server_connection"` // Arguments to the plugin operation. Args ArgsMap `json:"args"` }
PluginInput is the data structure that is sent to plugin instances when they are spawned.
type PluginOutput ¶
type PluginOutput struct { Error *string `json:"error"` Output interface{} `json:"output"` }
PluginOutput is the data structure that is expected to be output by plugin processes when execution has concluded. It is expected that this data will be encoded as JSON.
func (*PluginOutput) SetError ¶
func (o *PluginOutput) SetError(err error)
SetError is a convenience method that sets the Error field based on the provided error.
type RPCRunner ¶
type RPCRunner interface { // Perform the operation, using the provided input and populating the // output object. Run(input PluginInput, output *PluginOutput) error // Stop any running operations, if possible. No input is sent and any // output is ignored. Stop(input struct{}, output *bool) error }
RPCRunner is the interface that RPC plugins are expected to fulfil.
type StashServerConnection ¶
type StashServerConnection struct { // http or https Scheme string Host string Port int // Cookie for authentication purposes SessionCookie *http.Cookie // Dir specifies the directory containing the stash server's configuration // file. Dir string // PluginDir specifies the directory containing the plugin configuration // file. PluginDir string }
StashServerConnection represents the connection details needed for a plugin instance to connect to its parent stash server.
Directories ¶
Path | Synopsis |
---|---|
Package log provides a number of logging utility functions for encoding and decoding log messages between a stash server and a plugin instance.
|
Package log provides a number of logging utility functions for encoding and decoding log messages between a stash server and a plugin instance. |