diff options
author | Markus Grüneis <gimpf@gimpf.org> | 2014-10-11 20:54:05 +0200 |
---|---|---|
committer | Markus Grüneis <gimpf@gimpf.org> | 2014-10-13 18:12:23 +0200 |
commit | 3bf7274a0414a987136f3bbacf817d9d046aa201 (patch) | |
tree | 0d23a5337f44622948847f6d313a7f3b51cb6742 /src/hub/src/spreadspace.org/sfive/s5types.go | |
parent | ignore vim swap files (diff) |
fix data conversion and tests
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5types.go')
-rw-r--r-- | src/hub/src/spreadspace.org/sfive/s5types.go | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5types.go b/src/hub/src/spreadspace.org/sfive/s5types.go index 56b1552..3b7dc31 100644 --- a/src/hub/src/spreadspace.org/sfive/s5types.go +++ b/src/hub/src/spreadspace.org/sfive/s5types.go @@ -9,34 +9,34 @@ const ( ) type StreamId struct { - ContentId string `json:"content-id"` - Format string `json:"format"` - Quality string `json:"quality"` + ContentId string `json:"content-id"` + Format string `json:"format"` + Quality string `json:"quality"` } type SourceId struct { - Hostname string `json:"hostname"` - StreamId StreamId `json:"stream-id"` - Tags []string `json:"tags"` + Hostname string `json:"hostname"` + StreamId StreamId `json:"streamer-id"` + Tags []string `json:"tags"` } type ClientData struct { - Ip string - BytesTransferred uint - UserAgent string + Ip string `json:"ip"` + BytesTransferred uint `json:"bytes-transferred"` + UserAgent string `json:"user-agent"` } type SourceData struct { - ClientCount uint - BytesReceived uint - BytesSent uint - Clients []ClientData + ClientCount uint `json:"client-count"` + BytesReceived uint `json:"bytes-received"` + BytesSent uint `json:"bytes-sent"` + Clients []ClientData `json:"clients"` } type DataUpdate struct { - StartTime time.Time - Duration time.Duration - Data SourceData + StartTime time.Time `json:"start-time"` + Duration time.Duration `json:"duration-ms"` + Data SourceData `json:"data"` } type StatisticsData struct { @@ -49,3 +49,9 @@ func (self *StatisticsData) CopyFrom(id *SourceId) { self.StreamId = id.StreamId self.Tags = id.Tags } + +func (self *StatisticsData) CopyFromUpdate(id *DataUpdate) { + self.StartTime = id.StartTime + self.Duration = id.Duration + self.Data = id.Data +} |