forked from statsig-io/go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_persistent_storage_interface.go
37 lines (32 loc) · 1.46 KB
/
user_persistent_storage_interface.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
package statsig
// The properties of this struct must fit a universal schema that
// when JSON-ified, can be parsed by every SDK supporting user persistent evaluation.
type StickyValues struct {
Value bool `json:"value"`
JsonValue map[string]interface{} `json:"json_value"`
RuleID string `json:"rule_id"`
GroupName string `json:"group_name"`
SecondaryExposures []SecondaryExposure `json:"secondary_exposures"`
Time int64 `json:"time"`
ConfigDelegate string `json:"config_delegate,omitempty"`
ExplicitParameters map[string]bool `json:"explicit_parameters,omitempty"`
UndelegatedSecondaryExposures []SecondaryExposure `json:"undelegated_secondary_exposures"`
}
type UserPersistedValues = map[string]StickyValues
/**
* A storage adapter for persisted values. Can be used for sticky bucketing users in experiments.
*/
type IUserPersistentStorage interface {
/**
* Returns the full map of persisted values for a specific user key
*/
Load(key string) (UserPersistedValues, bool)
/**
* Save the persisted values of a config given a specific user key
*/
Save(key string, configName string, data StickyValues)
/**
* Delete the persisted values of a config given a specific user key
*/
Delete(key string, configName string)
}