gateway

package
v1.12.0-rc.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContentType added in v1.2.0

func WithContentType(contentType string, delegate http.HandlerFunc) http.HandlerFunc

Types

type Handle added in v1.12.0

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

func (*Handle) GetWebhookSourceDefName added in v1.12.0

func (gateway *Handle) GetWebhookSourceDefName(writeKey string) (name string, ok bool)

GetWebhookSourceDefName returns the webhook source definition name by write key

func (*Handle) IncrementAckCount added in v1.12.0

func (gateway *Handle) IncrementAckCount(count uint64)

IncrementAckCount increments the acknowledged count for gateway requests

func (*Handle) IncrementRecvCount added in v1.12.0

func (gateway *Handle) IncrementRecvCount(count uint64)

IncrementRecvCount increments the received count for gateway requests

func (*Handle) NewSourceStat added in v1.12.0

func (gateway *Handle) NewSourceStat(writeKey, reqType string) *gwstats.SourceStat

func (*Handle) ProcessWebRequest added in v1.12.0

func (gateway *Handle) ProcessWebRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, writeKey string) string

ProcessWebRequest is an interface wrapper for webhook

func (*Handle) SaveWebhookFailures added in v1.12.0

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

SaveErrors saves errors to the error db

func (*Handle) Setup added in v1.12.0

func (gateway *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 (gateway *Handle) Shutdown() error

func (*Handle) StartAdminHandler added in v1.12.0

func (gateway *Handle) StartAdminHandler(ctx context.Context) error

StartAdminHandler for Admin Operations

func (*Handle) StartWebHandler added in v1.12.0

func (gateway *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 (gateway *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, writeKey string) 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, writeKey string) 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, writeKey string) 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