github.com/dbernstein1/tyk@v2.9.0-beta9-dl-apic+incompatible/coprocess/grpc_dispatcher.go (about) 1 // +build coprocess 2 // +build grpc 3 4 package coprocess 5 6 import ( 7 "github.com/TykTechnologies/tyk/apidef" 8 ) 9 10 const ( 11 _ = iota 12 JsonMessage 13 ProtobufMessage 14 ) 15 16 // Dispatcher defines a basic interface for the CP dispatcher, check PythonDispatcher for reference. 17 type Dispatcher interface { 18 // Dispatch takes and returns a pointer to a CoProcessMessage struct, see coprocess/api.h for details. This is used by CP bindings. 19 Dispatch(*Object) (*Object, error) 20 21 // DispatchEvent takes an event JSON, as bytes. Doesn't return. 22 DispatchEvent([]byte) 23 24 // DispatchObject takes and returns a coprocess.Object pointer, this is used by gRPC. 25 DispatchObject(*Object) (*Object, error) 26 27 // LoadModules is called the first time a CP binding starts. Used by Lua. 28 LoadModules() 29 30 // HandleMiddlewareCache is called when a bundle has been loaded and the dispatcher needs to cache its contents. Used by Lua. 31 HandleMiddlewareCache(*apidef.BundleManifest, string) 32 33 // Reload is called when a hot reload is triggered. Used by all the CPs. 34 Reload() 35 }