refactor push + source into active + passive 'sides' with push and source 'modes'

This commit is contained in:
Christian Schwarz
2018-09-23 23:04:31 +02:00
parent 9446b51a1f
commit e3be120d88
6 changed files with 174 additions and 114 deletions
+4 -2
View File
@@ -59,6 +59,8 @@ const (
TypeInternal Type = "internal"
TypePush Type = "push"
TypeSink Type = "sink"
TypePull Type = "pull"
TypeSource Type = "source"
)
type Status struct {
@@ -101,11 +103,11 @@ func (s *Status) UnmarshalJSON(in []byte) (err error) {
}
switch s.Type {
case TypePush:
var st PushStatus
var st ActiveSideStatus
err = json.Unmarshal(jobJSON, &st)
s.JobSpecific = &st
case TypeSink:
var st SinkStatus
var st PassiveStatus
err = json.Unmarshal(jobJSON, &st)
s.JobSpecific = &st
case TypeInternal: