dispatcher

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsonMessage
	ProtobufMessage
)
View Source
const CoProcessName = apidef.GrpcDriver

CoProcessName specifies the driver name.

Variables

View Source
var MessageType = ProtobufMessage

MessageType sets the default message type.

Functions

func InitGlobalDispatch

func InitGlobalDispatch()

Types

type Dispatcher

type Dispatcher interface {
	// Dispatch takes and returns a pointer to a CoProcessMessage struct, see coprocess/api.h for details. This is used by CP bindings.
	Dispatch(unsafe.Pointer) unsafe.Pointer

	// DispatchEvent takes an event JSON, as bytes. Doesn't return.
	DispatchEvent([]byte)

	// DispatchObject takes and returns a coprocess.Object pointer, this is used by gRPC.
	DispatchObject(*coprocess.Object) (*coprocess.Object, error)
}

Dispatcher defines a basic interface for the CP dispatcher, check PythonDispatcher for reference.

var GlobalDispatcher Dispatcher

func NewCoProcessDispatcher

func NewCoProcessDispatcher() (Dispatcher, error)

NewCoProcessDispatcher wraps all the actions needed for this CP.

type GRPCDispatcher

type GRPCDispatcher struct {
	Dispatcher
}

GRPCDispatcher implements a coprocess.Dispatcher

func (*GRPCDispatcher) DispatchEvent

func (d *GRPCDispatcher) DispatchEvent(eventJSON []byte)

DispatchEvent dispatches a Tyk event.

func (*GRPCDispatcher) DispatchObject

func (d *GRPCDispatcher) DispatchObject(object *coprocess.Object) (*coprocess.Object, error)

Dispatch takes a CoProcessMessage and sends it to the CP.

func (*GRPCDispatcher) HandleMiddlewareCache

func (d *GRPCDispatcher) HandleMiddlewareCache(b *apidef.BundleManifest, basePath string)

HandleMiddlewareCache isn't used by gRPC.

func (*GRPCDispatcher) Reload

func (d *GRPCDispatcher) Reload()

Reload triggers a reload affecting CP middlewares and event handlers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL