gateway

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: AGPL-3.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DELIMITER = string("<<>>")
)

Variables

View Source
var (
	ReadTimeout       time.Duration
	ReadHeaderTimeout time.Duration
	WriteTimeout      time.Duration
	IdleTimeout       time.Duration

	Diagnostics diagnostics.DiagnosticsI
)
View Source
var BatchEvent = []byte(`
	{
		"batch": [
		]
	}
`)
View Source
var CustomVal string

CustomVal is used as a key in the jobsDB customval column

Functions

func Init added in v0.1.10

func Init()

func IsEnableRateLimit added in v0.1.10

func IsEnableRateLimit() bool

IsEnableRateLimit is true if rate limiting is enabled on gateway

func SetEnableEventSchemasFeature added in v0.1.10

func SetEnableEventSchemasFeature(b bool) bool

SetEnableEventSchemasFeature overrides enableEventSchemasFeature configuration and returns previous value

func SetEnableRateLimit added in v0.1.10

func SetEnableRateLimit(b bool) bool

SetEnableRateLimit overrides enableRateLimit configuration and returns previous value

func SetEnableSuppressUserFeature added in v0.1.10

func SetEnableSuppressUserFeature(b bool) bool

SetEnableSuppressUserFeature overrides enableSuppressUserFeature configuration and returns previous value

func WithContentType added in v1.2.0

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

Types

type HandleT

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

HandleT is the struct returned by the Setup call

func (*HandleT) GetWebhookSourceDefName added in v0.1.10

func (*HandleT) GetWebhookSourceDefName(writeKey string) (name string, ok bool)

GetWebhookSourceDefName returns the webhook source definition name by write key

func (*HandleT) IncrementAckCount added in v0.1.10

func (gateway *HandleT) IncrementAckCount(count uint64)

IncrementAckCount increments the acknowledged count for gateway requests

func (*HandleT) IncrementRecvCount added in v0.1.10

func (gateway *HandleT) IncrementRecvCount(count uint64)

IncrementRecvCount increments the received count for gateway requests

func (*HandleT) MaxReqSize added in v0.1.10

func (*HandleT) MaxReqSize() int

MaxReqSize is the maximum request body size, in bytes, accepted by gateway web handlers

func (*HandleT) NewSourceStat added in v1.5.0

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

func (*HandleT) ProcessWebRequest added in v0.1.10

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

ProcessWebRequest is an Interface wrapper for webhook

func (*HandleT) SaveWebhookFailures added in v1.11.0

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

SaveErrors saves errors to the error db

func (*HandleT) Setup

func (gateway *HandleT) Setup(
	ctx context.Context,
	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 (*HandleT) Shutdown added in v0.1.10

func (gateway *HandleT) Shutdown() error

func (*HandleT) StartAdminHandler added in v0.1.10

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

StartAdminHandler for Admin Operations

func (*HandleT) StartWebHandler added in v0.1.10

func (gateway *HandleT) 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 (*HandleT) TrackRequestMetrics added in v0.1.10

func (gateway *HandleT) TrackRequestMetrics(errorMessage string)

TrackRequestMetrics provides access to add request success/failure telemetry

type ImportRequestHandler added in v0.1.10

type ImportRequestHandler struct{}

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

func (*ImportRequestHandler) ProcessRequest added in v0.1.10

func (*ImportRequestHandler) ProcessRequest(gateway *HandleT, 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{}

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

func (*RegularRequestHandler) ProcessRequest added in v0.1.10

func (*RegularRequestHandler) ProcessRequest(gateway *HandleT, 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(gateway *HandleT, 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