-
Notifications
You must be signed in to change notification settings - Fork 0
/
state.go
33 lines (28 loc) · 896 Bytes
/
state.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package model
// describes state of the race according to event manifests
type DbState struct {
ID int `json:"id"`
EventID int `json:"eventId"`
Data StateData `json:"data"`
}
// contains the state message sent by the client via WAMP
type StateData struct {
Type int `json:"type"`
Payload StatePayload `json:"payload"`
Timestamp float64 `json:"timestamp"`
}
// these attributes contain generic data according to event manifests
type StatePayload struct {
Cars [][]interface{} `json:"cars"`
Session []interface{} `json:"session"`
Messages [][]interface{} `json:"messages"`
}
type StateDelta struct {
Type int `json:"type"`
Payload DeltaPayload `json:"payload"`
Timestamp float64 `json:"timestamp"`
}
type DeltaPayload struct {
Cars [][3]interface{} `json:"cars"`
Session [][2]interface{} `json:"session"`
}