Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openfaas-faas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Team Jaz CS 598 CCC Final Project
openfaas-faas
Commits
3d210f1f
Commit
3d210f1f
authored
7 years ago
by
Alex Ellis
Browse files
Options
Downloads
Patches
Plain Diff
Extract handler_set.go
Signed-off-by:
Alex Ellis
<
alexellis2@gmail.com
>
parent
23a71874
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gateway/server.go
+7
-21
7 additions, 21 deletions
gateway/server.go
gateway/types/handler_set.go
+20
-0
20 additions, 0 deletions
gateway/types/handler_set.go
with
27 additions
and
21 deletions
gateway/server.go
+
7
−
21
View file @
3d210f1f
...
...
@@ -5,40 +5,23 @@ package main
import
(
"context"
"fmt"
"log"
"net/http"
"net/http/httputil"
"time"
"fmt"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/client"
"github.com/gorilla/mux"
internalHandlers
"github.com/openfaas/faas/gateway/handlers"
"github.com/openfaas/faas/gateway/metrics"
"github.com/openfaas/faas/gateway/plugin"
"github.com/openfaas/faas/gateway/types"
natsHandler
"github.com/openfaas/nats-queue-worker/handler"
"github.com/gorilla/mux"
)
type
handlerSet
struct
{
Proxy
http
.
HandlerFunc
DeployFunction
http
.
HandlerFunc
DeleteFunction
http
.
HandlerFunc
ListFunctions
http
.
HandlerFunc
Alert
http
.
HandlerFunc
RoutelessProxy
http
.
HandlerFunc
UpdateFunction
http
.
HandlerFunc
// QueuedProxy - queue work and return synchronous response
QueuedProxy
http
.
HandlerFunc
// AsyncReport - report a deferred execution result
AsyncReport
http
.
HandlerFunc
}
func
main
()
{
logger
:=
logrus
.
Logger
{}
logrus
.
SetFormatter
(
&
logrus
.
TextFormatter
{})
...
...
@@ -70,7 +53,8 @@ func main() {
metricsOptions
:=
metrics
.
BuildMetricsOptions
()
metrics
.
RegisterMetrics
(
metricsOptions
)
var
faasHandlers
handlerSet
var
faasHandlers
types
.
HandlerSet
servicePollInterval
:=
time
.
Second
*
5
if
config
.
UseExternalProvider
()
{
...
...
@@ -93,6 +77,7 @@ func main() {
// How many times to reschedule a function.
maxRestarts
:=
uint64
(
5
)
// Delay between container restarts
restartDelay
:=
time
.
Second
*
5
...
...
@@ -131,6 +116,7 @@ func main() {
r
.
HandleFunc
(
"/function/{name:[-a-zA-Z_0-9]+}/"
,
faasHandlers
.
Proxy
)
r
.
HandleFunc
(
"/system/alert"
,
faasHandlers
.
Alert
)
r
.
HandleFunc
(
"/system/functions"
,
listFunctions
)
.
Methods
(
"GET"
)
r
.
HandleFunc
(
"/system/functions"
,
faasHandlers
.
DeployFunction
)
.
Methods
(
"POST"
)
r
.
HandleFunc
(
"/system/functions"
,
faasHandlers
.
DeleteFunction
)
.
Methods
(
"DELETE"
)
...
...
This diff is collapsed.
Click to expand it.
gateway/types/handler_set.go
0 → 100644
+
20
−
0
View file @
3d210f1f
package
types
import
"net/http"
// HandlerSet can be initialized with handlers for binding to mux
type
HandlerSet
struct
{
Proxy
http
.
HandlerFunc
DeployFunction
http
.
HandlerFunc
DeleteFunction
http
.
HandlerFunc
ListFunctions
http
.
HandlerFunc
Alert
http
.
HandlerFunc
RoutelessProxy
http
.
HandlerFunc
UpdateFunction
http
.
HandlerFunc
// QueuedProxy - queue work and return synchronous response
QueuedProxy
http
.
HandlerFunc
// AsyncReport - report a deferred execution result
AsyncReport
http
.
HandlerFunc
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment