From 89e09629904d77a4b770315749e855d23af55bf6 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 27 Apr 2017 02:51:19 +0200 Subject: completely remove sqlite --- doc/protocol.md | 1 + 1 file changed, 1 insertion(+) (limited to 'doc') diff --git a/doc/protocol.md b/doc/protocol.md index 74bdbd2..fdd51ee 100644 --- a/doc/protocol.md +++ b/doc/protocol.md @@ -24,6 +24,7 @@ values from data updates override values from init. Stateless interfaces will no init messages and therefore all values must be defined here. If an interface (i.e. REST) has other means to detect protocol versions the version field may be omitted entirely. +The start-time will be processesd and stored with millisecond precision. { "version": 1, -- cgit v1.2.3 From b23a508d45ce6d7d6a720dc734f88f2ce1fac85f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 30 Apr 2017 02:54:38 +0200 Subject: improved protocol docs --- doc/protocol.md | 5 ++++- src/hub/src/spreadspace.org/sfive/s5typesApi.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/protocol.md b/doc/protocol.md index fdd51ee..ff0cc51 100644 --- a/doc/protocol.md +++ b/doc/protocol.md @@ -4,7 +4,7 @@ Messages init ---- -All fields except version are optional. The values in this message are treated as +All fields except "version" are optional. The values in this message are treated as defaults which will be used if the corresponding value is missing in subsequent update messages. @@ -24,6 +24,9 @@ values from data updates override values from init. Stateless interfaces will no init messages and therefore all values must be defined here. If an interface (i.e. REST) has other means to detect protocol versions the version field may be omitted entirely. +"SourceHubUuid", "SourceHubDataUpdateId", "user-agent", "bytes-received", "tags" and +"clients" might be omitted and are treated as an empty string, 0 or empty array +respectively. The start-time will be processesd and stored with millisecond precision. { diff --git a/src/hub/src/spreadspace.org/sfive/s5typesApi.go b/src/hub/src/spreadspace.org/sfive/s5typesApi.go index 0cd5100..265380c 100644 --- a/src/hub/src/spreadspace.org/sfive/s5typesApi.go +++ b/src/hub/src/spreadspace.org/sfive/s5typesApi.go @@ -43,7 +43,7 @@ type StreamId struct { type SourceId struct { Hostname string `json:"hostname"` StreamId StreamId `json:"streamer-id"` - Tags []string `json:"tags"` + Tags []string `json:"tags,omitempty"` } type ClientData struct { -- cgit v1.2.3 From 4f0d1b60b09422dc3fbf94d6f853bf72fb6c7f9b Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 6 May 2017 00:35:56 +0200 Subject: added additional protocol fields for forwarder hubs --- doc/protocol.md | 16 +++++++++++----- src/hub/src/spreadspace.org/sfive/s5store_test.go | 20 ++++++++++++++------ src/hub/src/spreadspace.org/sfive/s5typesApi.go | 8 +++++--- 3 files changed, 30 insertions(+), 14 deletions(-) (limited to 'doc') diff --git a/doc/protocol.md b/doc/protocol.md index ff0cc51..29391c6 100644 --- a/doc/protocol.md +++ b/doc/protocol.md @@ -10,6 +10,10 @@ update messages. { "version": 1, + "SourceHubUuid": "f7df89b4-171e-4b2f-a8a4-e58ac99e5dc5", + "SourceHubDataUpdateId": 23, + "ForwardHubUuid": "b041315e-5039-4c75-81e8-9fd42250b011", + "ForwardHubDataUpdateId": 42, "hostname": "myhostname", "streamer-id": { "content-id": "av-orig", "format": "flash", "quality": "medium" }, "tags": [ "elevate", "2014", "discourse" ] @@ -22,15 +26,17 @@ data-update All values which have been defined by the init message are optional. In any case the values from data updates override values from init. Stateless interfaces will not use init messages and therefore all values must be defined here. -If an interface (i.e. REST) has other means to detect protocol versions the version -field may be omitted entirely. -"SourceHubUuid", "SourceHubDataUpdateId", "user-agent", "bytes-received", "tags" and -"clients" might be omitted and are treated as an empty string, 0 or empty array -respectively. +"SourceHubUuid", "SourceHubDataUpdateId", "ForwardHubUuid", "ForwardHubDataUpdateId", +"user-agent", "bytes-received", "tags" and "clients" might be omitted and are treated +as an empty string, 0 or empty array respectively. The start-time will be processesd and stored with millisecond precision. { "version": 1, + "SourceHubUuid": "f7df89b4-171e-4b2f-a8a4-e58ac99e5dc5", + "SourceHubDataUpdateId": 23, + "ForwardHubUuid": "b041315e-5039-4c75-81e8-9fd42250b011", + "ForwardHubDataUpdateId": 42, "hostname": "myhostname", "streamer-id": { "content-id": "av-orig", "format": "flash", "quality": "medium" }, "tags": [ "elevate", "2014", "discourse" ] diff --git a/src/hub/src/spreadspace.org/sfive/s5store_test.go b/src/hub/src/spreadspace.org/sfive/s5store_test.go index 3284c87..91d51ee 100644 --- a/src/hub/src/spreadspace.org/sfive/s5store_test.go +++ b/src/hub/src/spreadspace.org/sfive/s5store_test.go @@ -303,7 +303,7 @@ func TestAppendAndFetch(t *testing.T) { upd := updateData upd.StartTime = time.Date(2014, time.August, 24, 14, 35, 33, 847000000, time.UTC) upd.Data.Clients = clientsData - in := DataUpdateFull{0, "", -1, sourceData, upd} + in := DataUpdateFull{0, "", -1, "", -1, sourceData, upd} if err = store.Append(in); err != nil { t.Fatalf("failed to append update: %v", err) @@ -318,6 +318,8 @@ func TestAppendAndFetch(t *testing.T) { expected := in expected.SourceHubUuid = store.GetStoreId() expected.SourceHubDataUpdateId = 1 + expected.ForwardHubUuid = "" + expected.ForwardHubDataUpdateId = 0 if !reflect.DeepEqual(expected, out) { t.Fatalf("failed to fetch update\nactual: %v\nexpected: %v\n", out, expected) @@ -326,10 +328,10 @@ func TestAppendAndFetch(t *testing.T) { // append many var ins []DataUpdateFull upd.StartTime = upd.StartTime.Add(time.Duration(upd.Duration) * time.Millisecond) - ins = append(ins, DataUpdateFull{0, "", -1, sourceData, upd}) + ins = append(ins, DataUpdateFull{0, "", -1, "", -1, sourceData, upd}) upd.StartTime = upd.StartTime.Add(time.Duration(upd.Duration) * time.Millisecond) upd.Data.Clients = nil - ins = append(ins, DataUpdateFull{0, "", -1, sourceData, upd}) + ins = append(ins, DataUpdateFull{0, "", -1, "", -1, sourceData, upd}) if err = store.AppendMany(ins); err != nil { t.Fatalf("failed to append update: %v", err) } @@ -344,6 +346,8 @@ func TestAppendAndFetch(t *testing.T) { expected = ins[i] expected.SourceHubUuid = store.GetStoreId() expected.SourceHubDataUpdateId = i + 2 + expected.ForwardHubUuid = "" + expected.ForwardHubDataUpdateId = 0 if !reflect.DeepEqual(expected, out) { t.Fatalf("failed to fetch update\nactual: %v\nexpected: %v\n", out, expected) @@ -367,7 +371,7 @@ func TestReadOnly(t *testing.T) { upd := updateData upd.StartTime = time.Date(2014, time.August, 24, 14, 35, 33, 847000000, time.UTC) upd.Data.Clients = clientsData - in := DataUpdateFull{0, "", -1, sourceData, upd} + in := DataUpdateFull{0, "", -1, "", -1, sourceData, upd} if err = store.Append(in); err != nil { t.Fatalf("unexpected error: %v", err) } @@ -406,13 +410,15 @@ func TestGetUpdatesAfter(t *testing.T) { expected := []DataUpdateFull{} for i := 0; i < 3; i = i + 1 { - in := DataUpdateFull{0, "", -1, sourceData, upd} + in := DataUpdateFull{0, "", -1, "", -1, sourceData, upd} if err = store.Append(in); err != nil { t.Fatalf("unexpected error: %v", err) } e := in e.SourceHubUuid = store.hubUuid e.SourceHubDataUpdateId = i + 1 + e.ForwardHubUuid = "" + e.ForwardHubDataUpdateId = 0 expected = append(expected, e) upd.StartTime = upd.StartTime.Add(time.Duration(upd.Duration) * time.Millisecond) } @@ -522,9 +528,11 @@ func TestForwardedDataUpdates(t *testing.T) { expected := []DataUpdateFull{} for i := 0; i < 3; i = i + 1 { - in := DataUpdateFull{0, "", -1, sourceData, upd} + in := DataUpdateFull{0, "", -1, "", -1, sourceData, upd} in.SourceHubUuid = forwardedHub in.SourceHubDataUpdateId = 3 - i // out of order + in.ForwardHubUuid = "" + in.ForwardHubDataUpdateId = 0 if err = store.Append(in); err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/src/hub/src/spreadspace.org/sfive/s5typesApi.go b/src/hub/src/spreadspace.org/sfive/s5typesApi.go index 265380c..12e92c8 100644 --- a/src/hub/src/spreadspace.org/sfive/s5typesApi.go +++ b/src/hub/src/spreadspace.org/sfive/s5typesApi.go @@ -66,9 +66,11 @@ type DataUpdate struct { } type DataUpdateFull struct { - Version uint `json:"version"` - SourceHubUuid string `json:"SourceHubUuid,omitempty"` - SourceHubDataUpdateId int `json:"SourceHubDataUpdateId,omitempty"` + Version uint `json:"version"` + SourceHubUuid string `json:"SourceHubUuid,omitempty"` + SourceHubDataUpdateId int `json:"SourceHubDataUpdateId,omitempty"` + ForwardHubUuid string `json:"ForwardHubUuid,omitempty"` + ForwardHubDataUpdateId int `json:"ForwardHubDataUpdateId,omitempty"` SourceId DataUpdate } -- cgit v1.2.3