mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 11:56:29 +00:00
Migrate away from queue type in faas project
The queue type now resides in the provider, so that there is no risk of a circular reference. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
06a51373e2
commit
58394bb1de
23
gateway/vendor/github.com/openfaas/faas-provider/types/model.go
generated
vendored
23
gateway/vendor/github.com/openfaas/faas-provider/types/model.go
generated
vendored
@ -2,6 +2,22 @@ package types
|
||||
|
||||
import "time"
|
||||
|
||||
// Secret for underlying orchestrator
|
||||
type Secret struct {
|
||||
// Name of the secret
|
||||
Name string `json:"name"`
|
||||
|
||||
// Namespace if applicable for the secret
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
|
||||
// Value is a string representing the string's value
|
||||
Value string `json:"value,omitempty"`
|
||||
|
||||
// RawValue can be used to provide binary data when
|
||||
// Value is not set
|
||||
RawValue []byte `json:"rawValue,omitempty"`
|
||||
}
|
||||
|
||||
// FunctionDeployment represents a request to create or update a Function.
|
||||
type FunctionDeployment struct {
|
||||
|
||||
@ -46,13 +62,6 @@ type FunctionDeployment struct {
|
||||
ReadOnlyRootFilesystem bool `json:"readOnlyRootFilesystem,omitempty"`
|
||||
}
|
||||
|
||||
// Secret for underlying orchestrator
|
||||
type Secret struct {
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// FunctionResources Memory and CPU
|
||||
type FunctionResources struct {
|
||||
Memory string `json:"memory,omitempty"`
|
||||
|
42
gateway/vendor/github.com/openfaas/faas-provider/types/queue.go
generated
vendored
Normal file
42
gateway/vendor/github.com/openfaas/faas-provider/types/queue.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// Request for asynchronous processing
|
||||
type QueueRequest struct {
|
||||
// Header from HTTP request
|
||||
Header http.Header
|
||||
|
||||
// Host from HTTP request
|
||||
Host string
|
||||
|
||||
// Body from HTTP request to use for invocation
|
||||
Body []byte
|
||||
|
||||
// Method from HTTP request
|
||||
Method string
|
||||
|
||||
// Path from HTTP request
|
||||
Path string
|
||||
|
||||
// QueryString from HTTP request
|
||||
QueryString string
|
||||
|
||||
// Function name to invoke
|
||||
Function string
|
||||
|
||||
// QueueName to publish the request to, leave blank
|
||||
// for default.
|
||||
QueueName string
|
||||
|
||||
// Used by queue worker to submit a result
|
||||
CallbackURL *url.URL `json:"CallbackUrl"`
|
||||
}
|
||||
|
||||
// RequestQueuer can public a request to be executed asynchronously
|
||||
type RequestQueuer interface {
|
||||
Queue(req *QueueRequest) error
|
||||
}
|
4
gateway/vendor/github.com/openfaas/nats-queue-worker/handler/nats_queue.go
generated
vendored
4
gateway/vendor/github.com/openfaas/nats-queue-worker/handler/nats_queue.go
generated
vendored
@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
stan "github.com/nats-io/stan.go"
|
||||
"github.com/openfaas/faas/gateway/queue"
|
||||
ftypes "github.com/openfaas/faas-provider/types"
|
||||
)
|
||||
|
||||
// NATSQueue queue for work
|
||||
@ -32,7 +32,7 @@ type NATSQueue struct {
|
||||
}
|
||||
|
||||
// Queue request for processing
|
||||
func (q *NATSQueue) Queue(req *queue.Request) error {
|
||||
func (q *NATSQueue) Queue(req *ftypes.QueueRequest) error {
|
||||
fmt.Printf("NatsQueue - submitting request: %s.\n", req.Function)
|
||||
|
||||
out, err := json.Marshal(req)
|
||||
|
Reference in New Issue
Block a user