Skip to content

Commit

Permalink
Merge pull request #20 from Comcast/feature/support-scytale-2.0
Browse files Browse the repository at this point in the history
Feature/support scytale 2.0
  • Loading branch information
johnabass authored Sep 19, 2017
2 parents 2cd01e4 + afba47e commit ab7ccb3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
7 changes: 3 additions & 4 deletions src/glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package: .
homepage: https://github.com/Comcast/talaria
import:
- package: github.com/Comcast/webpa-common
version: 6549991c344ae8e293c4ce2a3ba240a3c8287105
version: 05094818a42ba3682b43c60c29a237d8e6995341

15 changes: 7 additions & 8 deletions src/talaria/primaryHandler.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"net/http"

"github.com/Comcast/webpa-common/device"
Expand All @@ -15,30 +16,28 @@ const (

// TODO: Should this change for talaria 2.0?
version = "v2"

// TODO: This should be configurable at some point
poolSize = 1000
)

func NewPrimaryHandler(logger log.Logger, manager device.Manager, v *viper.Viper) (http.Handler, error) {
poolFactory, err := wrp.NewPoolFactory(v.Sub(wrp.ViperKey))
if err != nil {
return nil, err
}

var (
handler = mux.NewRouter()
apiHandler = handler.PathPrefix(baseURI + "/" + version).Subrouter()
apiHandler = handler.PathPrefix(fmt.Sprintf("%s/%s", baseURI, version)).Subrouter()
)

apiHandler.Handle("/device/send", &device.MessageHandler{
Logger: logger,
Decoders: poolFactory.NewDecoderPool(wrp.JSON),
Decoders: wrp.NewDecoderPool(poolSize, wrp.JSON),
Router: manager,
}).
Methods("POST", "PATCH").
Headers("Content-Type", wrp.JSON.ContentType())

apiHandler.Handle("/device/send", &device.MessageHandler{
Logger: logger,
Decoders: poolFactory.NewDecoderPool(wrp.Msgpack),
Decoders: wrp.NewDecoderPool(poolSize, wrp.Msgpack),
Router: manager,
}).
Methods("POST", "PATCH").
Expand Down

0 comments on commit ab7ccb3

Please sign in to comment.