Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var METHOD_TYPE = []byte("POST")
Functions ¶
This section is empty.
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.
type FaasWorker ¶
type FaasWorker struct {
// contains filtered or unexported fields
}
FaasWorker Worker representation for a Nitric FaaS function using gRPC
func NewFaasWorker ¶
func NewFaasWorker(stream pb.FaasService_TriggerStreamServer) *FaasWorker
Package private method Only a pool may create a new faas worker
func (*FaasWorker) HandleEvent ¶
func (s *FaasWorker) HandleEvent(trigger *triggers.Event) error
func (*FaasWorker) HandleHttpRequest ¶
func (s *FaasWorker) HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error)
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.
type ProcessPool ¶
type ProcessPool struct {
// contains filtered or unexported fields
}
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) GetWorker ¶
func (p *ProcessPool) GetWorker() (Worker, error)
GetWorker - Retrieves a worker from this pool
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) WaitForActiveWorkers ¶
func (p *ProcessPool) WaitForActiveWorkers(timeout int) error
WaitForActiveWorkers - Waits for workers to be available in this pool
type ProcessPoolOptions ¶
type ProcessPoolOptions struct {
MaxWorkers int
}
type UnimplementedWorker ¶
type UnimplementedWorker struct{}
func (*UnimplementedWorker) HandleEvent ¶
func (*UnimplementedWorker) HandleEvent(trigger *triggers.Event) error
func (*UnimplementedWorker) HandleHttpRequest ¶
func (*UnimplementedWorker) HandleHttpRequest(trigger *triggers.HttpRequest) *http.Response
type Worker ¶
type Worker interface { HandleEvent(trigger *triggers.Event) error HandleHttpRequest(trigger *triggers.HttpRequest) (*triggers.HttpResponse, error) }
type WorkerPool ¶
type WorkerPool interface { // WaitForActiveWorkers - A blocking method WaitForActiveWorkers(timeout int) error GetWorker() (Worker, error) AddWorker(Worker) error RemoveWorker(Worker) error Monitor() error }
func NewProcessPool ¶
func NewProcessPool(opts *ProcessPoolOptions) WorkerPool
NewProcessPool - Creates a new process pool