Documentation ¶
Index ¶
- Variables
- func NewGrpcListener(stream v1.FaasService_TriggerStreamServer) *grpcWorkerBase
- func ScheduleKeyToTopicName(key string) string
- type FaasHttpWorker
- func (h *FaasHttpWorker) HandleEvent(trigger *triggers.Event) error
- func (h *FaasHttpWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
- func (s *FaasHttpWorker) HandlesEvent(trigger *triggers.Event) bool
- func (s *FaasHttpWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
- type FaasWorker
- type GetWorkerOptions
- type GrpcWorker
- type HttpWorker
- func (h *HttpWorker) HandleEvent(trigger *triggers.Event) error
- func (h *HttpWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
- func (s *HttpWorker) HandlesEvent(trigger *triggers.Event) bool
- func (s *HttpWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
- type ProcessPool
- func (p *ProcessPool) AddWorker(wrkr Worker) error
- func (p *ProcessPool) GetMaxWorkers() int
- func (p *ProcessPool) GetMinWorkers() int
- func (p *ProcessPool) GetWorker(opts *GetWorkerOptions) (Worker, error)
- func (p *ProcessPool) GetWorkerCount() int
- func (p *ProcessPool) GetWorkers(opts *GetWorkerOptions) []Worker
- func (p *ProcessPool) Monitor() error
- func (p *ProcessPool) RemoveWorker(wrkr Worker) error
- func (p *ProcessPool) WaitForMinimumWorkers(timeout int) error
- type ProcessPoolOptions
- type RouteWorker
- func (s *RouteWorker) Api() string
- func (s *RouteWorker) HandleEvent(trigger *triggers.Event) error
- func (s *RouteWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
- func (s *RouteWorker) HandlesEvent(trigger *triggers.Event) bool
- func (s *RouteWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
- type RouteWorkerOptions
- type ScheduleWorker
- type ScheduleWorkerOptions
- type SubscriptionWorker
- func (s *SubscriptionWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
- func (s *SubscriptionWorker) HandlesEvent(trigger *triggers.Event) bool
- func (s *SubscriptionWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
- func (s *SubscriptionWorker) Topic() string
- type SubscriptionWorkerOptions
- type UnimplementedWorker
- func (*UnimplementedWorker) HandleEvent(trigger *triggers.Event) error
- func (*UnimplementedWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
- func (*UnimplementedWorker) HandlesEvent(trigger *triggers.Event) bool
- func (*UnimplementedWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
- type Worker
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
var METHOD_TYPE = []byte("POST")
Functions ¶
func NewGrpcListener ¶ added in v0.13.0
func NewGrpcListener(stream v1.FaasService_TriggerStreamServer) *grpcWorkerBase
func ScheduleKeyToTopicName ¶ added in v0.13.0
ScheduleKeyToTopicName - converts a schedule description to a name for a topic e.g. "Prune Customer Orders" -> "prune-customer-orders"
Types ¶
type FaasHttpWorker ¶
type FaasHttpWorker struct {
// contains filtered or unexported fields
}
A Nitric HTTP worker
func NewFaasHttpWorker ¶
func NewFaasHttpWorker(address string) (*FaasHttpWorker, error)
Creates a new FaasHttpWorker Will wait to ensure that the provided address is dialable before proceeding
func (*FaasHttpWorker) HandleEvent ¶
func (h *FaasHttpWorker) HandleEvent(trigger *triggers.Event) error
HandleEvent - Handles an event from a subscription by converting it to an HTTP request.
func (*FaasHttpWorker) HandleHttpRequest ¶
func (h *FaasHttpWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
HandleHttpRequest - Handles an HTTP request by forwarding it as an HTTP request.
func (*FaasHttpWorker) HandlesEvent ¶ added in v0.13.0
func (s *FaasHttpWorker) HandlesEvent(trigger *triggers.Event) bool
func (*FaasHttpWorker) HandlesHttpRequest ¶ added in v0.13.0
func (s *FaasHttpWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
type FaasWorker ¶
type FaasWorker struct {
GrpcWorker
}
FaasWorker Worker representation for a Nitric FaaS function using gRPC
func NewFaasWorker ¶
func NewFaasWorker(stream pb.FaasService_TriggerStreamServer) *FaasWorker
NewFaasWorker - Create a new FaaS worker
type GetWorkerOptions ¶ added in v0.13.0
type GrpcWorker ¶ added in v0.13.0
type HttpWorker ¶
type HttpWorker struct {
// contains filtered or unexported fields
}
A Nitric HTTP worker
func NewHttpWorker ¶
func NewHttpWorker(address string) (*HttpWorker, error)
Creates a new HttpWorker Will wait to ensure that the provided address is dialable before proceeding
func (*HttpWorker) HandleEvent ¶
func (h *HttpWorker) HandleEvent(trigger *triggers.Event) error
HandleEvent - Handles an event from a subscription by converting it to an HTTP request.
func (*HttpWorker) HandleHttpRequest ¶
func (h *HttpWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
HandleHttpRequest - Handles an HTTP request by forwarding it as an HTTP request.
func (*HttpWorker) HandlesEvent ¶ added in v0.13.0
func (s *HttpWorker) HandlesEvent(trigger *triggers.Event) bool
func (*HttpWorker) HandlesHttpRequest ¶ added in v0.13.0
func (s *HttpWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
type ProcessPool ¶
type ProcessPool struct {
// contains filtered or unexported fields
}
ProcessPool - A worker pool that represent co-located processes
func (*ProcessPool) AddWorker ¶
func (p *ProcessPool) AddWorker(wrkr Worker) error
AddWorker - Adds the given worker to this pool
func (*ProcessPool) GetMaxWorkers ¶
func (p *ProcessPool) GetMaxWorkers() int
GetMaxWorkers - return the maximum number of workers for this pool
func (*ProcessPool) GetMinWorkers ¶
func (p *ProcessPool) GetMinWorkers() int
GetMinWorkers - return the minimum number of workers for this pool
func (*ProcessPool) GetWorker ¶
func (p *ProcessPool) GetWorker(opts *GetWorkerOptions) (Worker, error)
GetWorker - Retrieves a worker from this pool
func (*ProcessPool) GetWorkerCount ¶
func (p *ProcessPool) GetWorkerCount() int
func (*ProcessPool) GetWorkers ¶ added in v0.13.0
func (p *ProcessPool) GetWorkers(opts *GetWorkerOptions) []Worker
GetWorkers - return a slice of all workers matching the input options. useful for retrieving a list of all topic subscribers (for example)
func (*ProcessPool) Monitor ¶
func (p *ProcessPool) Monitor() error
Monitor - Blocks the current thread to supervise this worker pool
func (*ProcessPool) RemoveWorker ¶
func (p *ProcessPool) RemoveWorker(wrkr Worker) error
RemoveWorker - Removes the given worker from this pool
func (*ProcessPool) WaitForMinimumWorkers ¶
func (p *ProcessPool) WaitForMinimumWorkers(timeout int) error
WaitForMinimumWorkers - Waits for the configured minimum number of workers to be available in this pool
type ProcessPoolOptions ¶
type RouteWorker ¶ added in v0.13.0
type RouteWorker struct { GrpcWorker // contains filtered or unexported fields }
RouteWorker - Worker representation for an http api route handler
func NewRouteWorker ¶ added in v0.13.0
func NewRouteWorker(stream pb.FaasService_TriggerStreamServer, opts *RouteWorkerOptions) *RouteWorker
Package private method Only a pool may create a new faas worker
func (*RouteWorker) Api ¶ added in v0.13.0
func (s *RouteWorker) Api() string
Api - Retrieve the name of the API this route worker was registered for
func (*RouteWorker) HandleEvent ¶ added in v0.13.0
func (s *RouteWorker) HandleEvent(trigger *triggers.Event) error
func (*RouteWorker) HandleHttpRequest ¶ added in v0.13.0
func (s *RouteWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
func (*RouteWorker) HandlesEvent ¶ added in v0.13.0
func (s *RouteWorker) HandlesEvent(trigger *triggers.Event) bool
func (*RouteWorker) HandlesHttpRequest ¶ added in v0.13.0
func (s *RouteWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
type RouteWorkerOptions ¶ added in v0.13.0
type ScheduleWorker ¶ added in v0.13.0
type ScheduleWorker struct { GrpcWorker // contains filtered or unexported fields }
RouteWorker - Worker representation for an http api route handler
func NewScheduleWorker ¶ added in v0.13.0
func NewScheduleWorker(stream pb.FaasService_TriggerStreamServer, opts *ScheduleWorkerOptions) *ScheduleWorker
Package private method Only a pool may create a new faas worker
func (*ScheduleWorker) HandleHttpRequest ¶ added in v0.13.0
func (s *ScheduleWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
func (*ScheduleWorker) HandlesEvent ¶ added in v0.13.0
func (s *ScheduleWorker) HandlesEvent(trigger *triggers.Event) bool
func (*ScheduleWorker) HandlesHttpRequest ¶ added in v0.13.0
func (s *ScheduleWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
func (*ScheduleWorker) Key ¶ added in v0.13.0
func (s *ScheduleWorker) Key() string
type ScheduleWorkerOptions ¶ added in v0.13.0
type ScheduleWorkerOptions struct {
Key string
}
type SubscriptionWorker ¶ added in v0.13.0
type SubscriptionWorker struct { GrpcWorker // contains filtered or unexported fields }
RouteWorker - Worker representation for an http api route handler
func NewSubscriptionWorker ¶ added in v0.13.0
func NewSubscriptionWorker(stream pb.FaasService_TriggerStreamServer, opts *SubscriptionWorkerOptions) *SubscriptionWorker
Package private method Only a pool may create a new faas worker
func (*SubscriptionWorker) HandleHttpRequest ¶ added in v0.13.0
func (s *SubscriptionWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
func (*SubscriptionWorker) HandlesEvent ¶ added in v0.13.0
func (s *SubscriptionWorker) HandlesEvent(trigger *triggers.Event) bool
func (*SubscriptionWorker) HandlesHttpRequest ¶ added in v0.13.0
func (s *SubscriptionWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
func (*SubscriptionWorker) Topic ¶ added in v0.13.0
func (s *SubscriptionWorker) Topic() string
type SubscriptionWorkerOptions ¶ added in v0.13.0
type SubscriptionWorkerOptions struct {
Topic string
}
type UnimplementedWorker ¶
type UnimplementedWorker struct{}
func (*UnimplementedWorker) HandleEvent ¶
func (*UnimplementedWorker) HandleEvent(trigger *triggers.Event) error
func (*UnimplementedWorker) HandleHttpRequest ¶
func (*UnimplementedWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
func (*UnimplementedWorker) HandlesEvent ¶ added in v0.13.0
func (*UnimplementedWorker) HandlesEvent(trigger *triggers.Event) bool
func (*UnimplementedWorker) HandlesHttpRequest ¶ added in v0.13.0
func (*UnimplementedWorker) HandlesHttpRequest(trigger *triggers.HttpRequest) bool
type Worker ¶
type Worker interface { HandleEvent(trigger *triggers.Event) error HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error) HandlesHttpRequest(trigger *triggers.HttpRequest) bool HandlesEvent(trigger *triggers.Event) bool }
type WorkerPool ¶
type WorkerPool interface { // WaitForMinimumWorkers - A blocking method WaitForMinimumWorkers(timeout int) error GetWorkerCount() int GetWorker(*GetWorkerOptions) (Worker, error) GetWorkers(*GetWorkerOptions) []Worker AddWorker(Worker) error RemoveWorker(Worker) error Monitor() error }
func NewProcessPool ¶
func NewProcessPool(opts *ProcessPoolOptions) WorkerPool
NewProcessPool - Creates a new process pool