Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "DISPATCHER_PLUGIN",
MagicCookieValue: "opsPsgZd3qsXpjgj69j5",
}
Functions ¶
func Initialize ¶
func Initialize(cmd *exec.Cmd) (Dispatcher, KillFunc, error)
Initialize will start the given plugin and return its Dispatcher implementation.
The returned KillFunc must be executed once the plugin will no longer be used. This also applies in case of an error!
Example ¶
dispatcher, kill, err := Initialize(exec.Command("/path/to/plugin")) defer kill() if err != nil { panic(err) } dispatcher.Entity(context.Background(), "uuid")
Output:
Types ¶
type Dispatcher ¶
type Dispatcher interface { Entity(ctx context.Context, id string) (*api.Entity, error) Submit(ctx context.Context, records []*api.Record) (*SubmissionResult, error) Search(ctx context.Context, parameters map[string]interface{}) ([]*api.Entity, error) }
Dispatcher is the interface used for communicating between the public facing webserver API (typically GraphQL) and the internal TiloRes API.
This interface is mostly created to support different deployment types, e.g. a local deployment with a fake implementation and a serverless deployment with the actual implementation.
However, it might also offer the possibility to add data modifications on the customers side at a central place.
type KillFunc ¶
type KillFunc func()
KillFunc is used to shutdown the plugin once it is no longer used
type SubmissionResult ¶
type SubmissionResult struct {
RecordsAdded int
}
SubmissionResult provides additional information about a successful data submission.