faas

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Frequencies = []Frequency{"days", "hours", "minutes"}

Functions

func NewWorkPool added in v0.9.0

func NewWorkPool(maxWorkers int) *workPool

Types

type ApiWorkerOptions added in v0.9.0

type ApiWorkerOptions struct {
	ApiName          string
	Path             string
	Security         map[string][]string
	SecurityDisabled bool
}

type BucketNotificationContext added in v0.9.0

type BucketNotificationContext struct {
	Request  BucketNotificationRequest
	Response *BucketNotificationResponse
	Extras   map[string]interface{}
}

type BucketNotificationHandler added in v0.9.0

type BucketNotificationHandler = func(*BucketNotificationContext) (*BucketNotificationContext, error)

type BucketNotificationMiddleware added in v0.9.0

func ComposeBucketNotificationMiddleware added in v0.9.0

func ComposeBucketNotificationMiddleware(funcs ...BucketNotificationMiddleware) BucketNotificationMiddleware

ComposeEventMiddleware - Composes an array of middleware into a single middleware

type BucketNotificationRequest added in v0.9.0

type BucketNotificationRequest interface {
	Key() string
	NotificationType() NotificationType
}

type BucketNotificationResponse added in v0.9.0

type BucketNotificationResponse struct {
	Success bool
}

type BucketNotificationWorkerOptions added in v0.9.0

type BucketNotificationWorkerOptions struct {
	Bucket                   string
	NotificationType         NotificationType
	NotificationPrefixFilter string
}

type CronWorkerOptions added in v0.9.0

type CronWorkerOptions struct {
	Description string
	Cron        string
}

type DataRequest added in v0.8.0

type DataRequest interface {
	Data() []byte
	MimeType() string
	Context() context.Context
}

type EventContext added in v0.8.0

type EventContext struct {
	Request  EventRequest
	Response *EventResponse
	Extras   map[string]interface{}
}

type EventHandler added in v0.8.0

type EventHandler = func(*EventContext) (*EventContext, error)

type EventMiddleware added in v0.8.0

type EventMiddleware = func(*EventContext, EventHandler) (*EventContext, error)

func ComposeEventMiddleware added in v0.8.0

func ComposeEventMiddleware(funcs ...EventMiddleware) EventMiddleware

ComposeEventMiddleware - Composes an array of middleware into a single middleware

type EventRequest added in v0.8.0

type EventRequest interface {
	DataRequest
	Topic() string
}

type EventResponse added in v0.8.0

type EventResponse struct {
	Success bool
}

type Frequency added in v0.9.0

type Frequency string //= "days" | "hours" | "minutes";

type HandlerBuilder added in v0.8.0

type HandlerBuilder interface {
	Http(string, ...HttpMiddleware) HandlerBuilder
	Event(...EventMiddleware) HandlerBuilder
	BucketNotification(...BucketNotificationMiddleware) HandlerBuilder
	Websocket(...WebsocketMiddleware) HandlerBuilder
	Default(...TriggerMiddleware) HandlerBuilder
	WithApiWorkerOpts(ApiWorkerOptions) HandlerBuilder
	WithRateWorkerOpts(RateWorkerOptions) HandlerBuilder
	WithCronWorkerOpts(CronWorkerOptions) HandlerBuilder
	WithSubscriptionWorkerOpts(SubscriptionWorkerOptions) HandlerBuilder
	WithBucketNotificationWorkerOptions(BucketNotificationWorkerOptions) HandlerBuilder
	WithWebsocketWorkerOptions(WebsocketWorkerOptions) HandlerBuilder
	Start() error
	String() string
}

func New added in v0.8.0

func New() HandlerBuilder

Creates a new HandlerBuilder

type HandlerProvider added in v0.8.0

type HandlerProvider interface {
	GetHttp(method string) HttpMiddleware
	GetEvent() EventMiddleware
	GetBucketNotification() BucketNotificationMiddleware
	GetWebsocket() WebsocketMiddleware
	GetDefault() TriggerMiddleware
}

type HttpContext added in v0.8.0

type HttpContext struct {
	Request  HttpRequest
	Response *HttpResponse
	Extras   map[string]interface{}
}

type HttpHandler added in v0.8.0

type HttpHandler = func(*HttpContext) (*HttpContext, error)

type HttpMiddleware added in v0.8.0

type HttpMiddleware = func(*HttpContext, HttpHandler) (*HttpContext, error)

func ComposeHttpMiddleware added in v0.9.0

func ComposeHttpMiddleware(funcs ...HttpMiddleware) HttpMiddleware

ComposeHttpMiddleware - Composes an array of middleware into a single middleware

type HttpRequest added in v0.8.0

type HttpRequest interface {
	DataRequest
	Context() context.Context
	Method() string
	Path() string
	Query() map[string][]string
	Headers() map[string][]string
	PathParams() map[string]string
}

type HttpResponse added in v0.8.0

type HttpResponse struct {
	Status  int
	Headers map[string][]string
	Body    []byte
}

type NotificationType added in v0.9.0

type NotificationType string
const (
	WriteNotification  NotificationType = "write"
	DeleteNotification NotificationType = "delete"
)

type RateWorkerOptions added in v0.9.0

type RateWorkerOptions struct {
	Description string
	Rate        int
	Frequency   Frequency
}

type SubscriptionWorkerOptions added in v0.9.0

type SubscriptionWorkerOptions struct {
	Topic string
}

type TriggerContext added in v0.8.0

type TriggerContext interface {
	Http() *HttpContext
	Event() *EventContext
	BucketNotification() *BucketNotificationContext
	Websocket() *WebsocketContext
}

type TriggerHandler added in v0.8.0

type TriggerHandler = func(TriggerContext) (TriggerContext, error)

type TriggerMiddleware added in v0.8.0

type TriggerMiddleware = func(TriggerContext, TriggerHandler) (TriggerContext, error)

func ComposeTriggerMiddleware added in v0.8.0

func ComposeTriggerMiddleware(funcs ...TriggerMiddleware) TriggerMiddleware

CreateTriggerMiddleware - Chains Trigger middleware functions together to single handler

type WebsocketContext added in v0.9.0

type WebsocketContext struct {
	Request  WebsocketRequest
	Response *WebsocketResponse
	Extras   map[string]interface{}
}

type WebsocketEventType added in v0.9.0

type WebsocketEventType string
const (
	WebsocketConnect    WebsocketEventType = "connect"
	WebsocketDisconnect WebsocketEventType = "disconnect"
	WebsocketMessage    WebsocketEventType = "message"
)

type WebsocketHandler added in v0.9.0

type WebsocketHandler = func(*WebsocketContext) (*WebsocketContext, error)

type WebsocketMiddleware added in v0.9.0

type WebsocketMiddleware = func(*WebsocketContext, WebsocketHandler) (*WebsocketContext, error)

func ComposeWebsocketMiddleware added in v0.9.0

func ComposeWebsocketMiddleware(funcs ...WebsocketMiddleware) WebsocketMiddleware

ComposeEventMiddleware - Composes an array of middleware into a single middleware

type WebsocketRequest added in v0.9.0

type WebsocketRequest interface {
	DataRequest

	Socket() string
	EventType() WebsocketEventType
	ConnectionID() string
	QueryParams() map[string][]string
}

type WebsocketResponse added in v0.9.0

type WebsocketResponse struct {
	Success bool
}

type WebsocketWorkerOptions added in v0.9.0

type WebsocketWorkerOptions struct {
	Socket    string
	EventType WebsocketEventType
}

Jump to

Keyboard shortcuts

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