From b53f49f8cbd3b7666c9267f0e2d88fce28ae6c1a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 10 May 2017 23:13:11 +0200 Subject: new protocol version with streamlined names for variables --- src/hub/src/spreadspace.org/sfive/s5cvt.go | 2 +- src/hub/src/spreadspace.org/sfive/s5cvt_test.go | 2 +- src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go | 2 +- src/hub/src/spreadspace.org/sfive/s5typesApi.go | 8 ++++---- src/hub/test-import | 12 ------------ 5 files changed, 7 insertions(+), 19 deletions(-) delete mode 100755 src/hub/test-import (limited to 'src/hub') diff --git a/src/hub/src/spreadspace.org/sfive/s5cvt.go b/src/hub/src/spreadspace.org/sfive/s5cvt.go index 2741a5a..0abbdef 100644 --- a/src/hub/src/spreadspace.org/sfive/s5cvt.go +++ b/src/hub/src/spreadspace.org/sfive/s5cvt.go @@ -39,7 +39,7 @@ import ( ) const ( - ProtocolVersion = 1 + ProtocolVersion = 2 ) // diff --git a/src/hub/src/spreadspace.org/sfive/s5cvt_test.go b/src/hub/src/spreadspace.org/sfive/s5cvt_test.go index 46b5705..55d8415 100644 --- a/src/hub/src/spreadspace.org/sfive/s5cvt_test.go +++ b/src/hub/src/spreadspace.org/sfive/s5cvt_test.go @@ -42,7 +42,7 @@ import ( ) var ( - initEncoded = `"hostname": "localhost", "streamer-id": {"quality": "low", "content-id": "av", "format": "webm"}, "tags": ["elevate", "2014"]` + initEncoded = `"hostname": "localhost", "stream": {"quality": "low", "content": "av", "format": "webm"}, "tags": ["elevate", "2014"]` initStruct = Source{Hostname: "localhost", Stream: Stream{Quality: "low", ContentId: "av", Format: "webm"}, Tags: []string{"elevate", "2014"}} updateEncoded = `"data": {"bytes-sent": 1, "client-count": 3, "bytes-received": 1}, "start-time": "2014-08-24T14:35:33.847282Z", "duration-ms": 5000` updateStruct = Update{Data: UpdateData{BytesSent: 1, ClientCount: 3, BytesReceived: 1}, StartTime: time.Date(2014, time.August, 24, 14, 35, 33, 847282000, time.UTC), Duration: 5000} diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go b/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go index 005e03d..2794a24 100644 --- a/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go +++ b/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go @@ -44,7 +44,7 @@ import ( const forwardEsLastUpdateIdJson = `{ "query": {"match": { "SourceHubUuid": "%s" } }, - "aggregations": { "last-id" : { "max" : { "field": "SourceHubDataUpdateId" } } } + "aggregations": { "last-id" : { "max" : { "field": "SourceHubUpdateId" } } } }` func fwdEsGetLastUpdateId(baseUrl string, client *http.Client, hubUuid string) (lastId int, err error) { diff --git a/src/hub/src/spreadspace.org/sfive/s5typesApi.go b/src/hub/src/spreadspace.org/sfive/s5typesApi.go index 5d36e0d..0a30162 100644 --- a/src/hub/src/spreadspace.org/sfive/s5typesApi.go +++ b/src/hub/src/spreadspace.org/sfive/s5typesApi.go @@ -35,14 +35,14 @@ package sfive import "time" type Stream struct { - ContentId string `json:"content-id"` + ContentId string `json:"content"` Format string `json:"format"` Quality string `json:"quality"` } type Source struct { Hostname string `json:"hostname"` - Stream Stream `json:"streamer-id"` + Stream Stream `json:"stream"` Tags []string `json:"tags,omitempty"` } @@ -68,9 +68,9 @@ type Update struct { type Header struct { Version uint `json:"version,omitempty"` // omitempty is needed for data only messages and for REST API SourceHubUuid string `json:"SourceHubUuid,omitempty"` - SourceHubUpdateId int `json:"SourceHubDataUpdateId,omitempty"` + SourceHubUpdateId int `json:"SourceHubUpdateId,omitempty"` ForwardHubUuid string `json:"ForwardHubUuid,omitempty"` - ForwardHubUpdateId int `json:"ForwardHubDataUpdateId,omitempty"` + ForwardHubUpdateId int `json:"ForwardHubUpdateId,omitempty"` } type UpdateFull struct { diff --git a/src/hub/test-import b/src/hub/test-import deleted file mode 100755 index a6c2942..0000000 --- a/src/hub/test-import +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -TEST_D="./test" - -echo pipe: import sample.json -echo ------------------------ - -[ -f ../../dat/sample-access.json ] || zcat ../../dat/sample-accesslog.json.gz > ../../dat/sample-accesslog.json - -socat file:../../dat/sample-accesslog.json,rdonly "unix-client:$TEST_D/pipe" - -echo '\n\ndone' -- cgit v1.2.3