gateway

package
v1.13.0-preview-1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: AGPL-3.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle added in v1.12.0

type Handle struct {
	// contains filtered or unexported fields
}

func (*Handle) NewSourceStat added in v1.12.0

func (gw *Handle) NewSourceStat(arctx *gwtypes.AuthRequestContext, reqType string) *gwstats.SourceStat

NewSourceStat creates a new source stat for a gateway request

func (*Handle) ProcessWebRequest added in v1.12.0

func (gw *Handle) ProcessWebRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, arctx *gwtypes.AuthRequestContext) string

ProcessWebRequest is an interface wrapper for webhook

func (*Handle) SaveWebhookFailures added in v1.12.0

func (gw *Handle) SaveWebhookFailures(reqs []*model.FailedWebhookPayload) error

SaveWebhookFailures saves errors to the error db

func (*Handle) Setup added in v1.12.0

func (gw *Handle) Setup(
	ctx context.Context,
	config *config.Config, logger logger.Logger, stat stats.Stats,
	application app.App, backendConfig backendconfig.BackendConfig, jobsDB, errDB jobsdb.JobsDB,
	rateLimiter throttler.Throttler, versionHandler func(w http.ResponseWriter, r *http.Request),
	rsourcesService rsources.JobService, sourcehandle sourcedebugger.SourceDebugger,
) error

Setup initializes this module: - Monitors backend config for changes. - Starts web request batching goroutine, that batches incoming messages. - Starts web request batch db writer goroutine, that writes incoming batches to JobsDB. - Starts debugging goroutine that prints gateway stats.

This function will block until backend config is initially received.

func (*Handle) Shutdown added in v1.12.0

func (gw *Handle) Shutdown() error

Shutdown the gateway

func (*Handle) StartWebHandler added in v1.12.0

func (gw *Handle) StartWebHandler(ctx context.Context) error

StartWebHandler starts all gateway web handlers, listening on gateway port. Supports CORS from all origins. This function will block.

func (*Handle) TrackRequestMetrics added in v1.12.0

func (gw *Handle) TrackRequestMetrics(errorMessage string)

TrackRequestMetrics updates the track counters (success and failure counts)

type ImportRequestHandler added in v0.1.10

type ImportRequestHandler struct {
	*Handle
}

ImportRequestHandler is an empty struct to capture import specific request handling functionality

func (*ImportRequestHandler) ProcessRequest added in v0.1.10

func (irh *ImportRequestHandler) ProcessRequest(w *http.ResponseWriter, r *http.Request, _ string, payload []byte, arctx *gwtypes.AuthRequestContext) string

ProcessRequest on ImportRequestHandler splits payload by user and throws them into the webrequestQ and waits for all their responses before returning

type RegularRequestHandler added in v0.1.10

type RegularRequestHandler struct {
	*Handle
}

RegularRequestHandler is an empty struct to capture non-import specific request handling functionality

func (*RegularRequestHandler) ProcessRequest added in v0.1.10

func (rrh *RegularRequestHandler) ProcessRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, arctx *gwtypes.AuthRequestContext) string

ProcessRequest throws a webRequest into the queue and waits for the response before returning

type RequestHandler added in v0.1.10

type RequestHandler interface {
	ProcessRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, arctx *gwtypes.AuthRequestContext) string
}

RequestHandler interface for abstracting out server-side import request processing and rest of the calls

Directories

Path Synopsis
internal
bot
Package mockwebhook is a generated GoMock package.
Package mockwebhook is a generated GoMock package.

Jump to

Keyboard shortcuts

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