forked from statsig-io/go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluation_details.go
46 lines (41 loc) · 1.21 KB
/
evaluation_details.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
34
35
36
37
38
39
40
41
42
43
44
45
46
package statsig
type evaluationReason string
const (
reasonNetwork evaluationReason = "Network"
reasonBootstrap evaluationReason = "Bootstrap"
reasonLocalOverride evaluationReason = "LocalOverride"
reasonUnrecognized evaluationReason = "Unrecognized"
reasonUninitialized evaluationReason = "Uninitialized"
reasonDataAdapter evaluationReason = "DataAdapter"
reasonNetworkNotModified evaluationReason = "NetworkNotModified"
reasonPersisted evaluationReason = "Persisted"
)
type EvaluationDetails struct {
Reason evaluationReason
ConfigSyncTime int64
InitTime int64
ServerTime int64
}
func newEvaluationDetails(
reason evaluationReason,
configSyncTime int64,
initTime int64,
) *EvaluationDetails {
return &EvaluationDetails{
Reason: reason,
ConfigSyncTime: configSyncTime,
InitTime: initTime,
ServerTime: getUnixMilli(),
}
}
func reconstructEvaluationDetailsFromPersisted(
reason evaluationReason,
configSyncTime int64,
) *EvaluationDetails {
return &EvaluationDetails{
Reason: reason,
ConfigSyncTime: configSyncTime,
InitTime: 0, // unsupported for persisted
ServerTime: getUnixMilli(),
}
}