Documentation
¶
Overview ¶
Package client contains implementations of the Split SDK client and the factory used to instantiate it.
Index ¶
- Constants
- type Key
- type SplitClient
- func (c *SplitClient) BlockUntilReady(timer int) error
- func (c *SplitClient) Destroy()
- func (c *SplitClient) Track(key string, trafficType string, eventType string, value interface{}, ...) (ret error)
- func (c *SplitClient) Treatment(key interface{}, feature string, attributes map[string]interface{}) string
- func (c *SplitClient) TreatmentWithConfig(key interface{}, feature string, attributes map[string]interface{}) TreatmentResult
- func (c *SplitClient) Treatments(key interface{}, features []string, attributes map[string]interface{}) map[string]string
- func (c *SplitClient) TreatmentsWithConfig(key interface{}, features []string, attributes map[string]interface{}) map[string]TreatmentResult
- type SplitFactory
- type SplitManager
- type SplitView
- type TreatmentResult
Constants ¶
const MaxEventLength = 32768
MaxEventLength constant to limit the event size
const MaxLength = 250
MaxLength constant to check the length of the splits
const RegExpEventType = "^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$"
RegExpEventType constant that EventType must match
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
Key struct to be used when supplying two keys. One for matching purposes and another one for hashing.
type SplitClient ¶
type SplitClient struct {
// contains filtered or unexported fields
}
SplitClient is the entry-point of the split SDK.
func (*SplitClient) BlockUntilReady ¶
func (c *SplitClient) BlockUntilReady(timer int) error
BlockUntilReady Calls BlockUntilReady on factory to block client on readiness
func (*SplitClient) Destroy ¶
func (c *SplitClient) Destroy()
Destroy the client and the underlying factory.
func (*SplitClient) Track ¶
func (c *SplitClient) Track( key string, trafficType string, eventType string, value interface{}, properties map[string]interface{}, ) (ret error)
Track an event and its custom value
func (*SplitClient) Treatment ¶
func (c *SplitClient) Treatment(key interface{}, feature string, attributes map[string]interface{}) string
Treatment implements the main functionality of split. Retrieve treatments of a specific feature for a certain key and set of attributes
func (*SplitClient) TreatmentWithConfig ¶
func (c *SplitClient) TreatmentWithConfig(key interface{}, feature string, attributes map[string]interface{}) TreatmentResult
TreatmentWithConfig implements the main functionality of split. Retrieves the treatment of a specific feature with the corresponding configuration if it is present
func (*SplitClient) Treatments ¶
func (c *SplitClient) Treatments(key interface{}, features []string, attributes map[string]interface{}) map[string]string
Treatments evaluates multiple featers for a single user and set of attributes at once
func (*SplitClient) TreatmentsWithConfig ¶
func (c *SplitClient) TreatmentsWithConfig(key interface{}, features []string, attributes map[string]interface{}) map[string]TreatmentResult
TreatmentsWithConfig evaluates multiple featers for a single user and set of attributes at once and returns configurations
type SplitFactory ¶
type SplitFactory struct {
// contains filtered or unexported fields
}
SplitFactory struct is responsible for instantiating and storing instances of client and manager.
func NewSplitFactory ¶
func NewSplitFactory(apikey string, cfg *conf.SplitSdkConfig) (*SplitFactory, error)
NewSplitFactory instantiates a new SplitFactory object. Accepts a SplitSdkConfig struct as an argument, which will be used to instantiate both the client and the manager
func (*SplitFactory) BlockUntilReady ¶
func (f *SplitFactory) BlockUntilReady(timer int) error
BlockUntilReady blocks client or manager until the SDK is ready, error occurs or times out
func (*SplitFactory) Client ¶
func (f *SplitFactory) Client() *SplitClient
Client returns the split client instantiated by the factory
func (*SplitFactory) Destroy ¶
func (f *SplitFactory) Destroy()
Destroy stops all async tasks and clears all storages
func (*SplitFactory) IsDestroyed ¶
func (f *SplitFactory) IsDestroyed() bool
IsDestroyed returns true if tbe client has been destroyed
func (*SplitFactory) IsReady ¶
func (f *SplitFactory) IsReady() bool
IsReady returns true if the factory is ready
func (*SplitFactory) Manager ¶
func (f *SplitFactory) Manager() *SplitManager
Manager returns the split manager instantiated by the factory
type SplitManager ¶
type SplitManager struct {
// contains filtered or unexported fields
}
SplitManager provides information of the currently stored splits
func (*SplitManager) BlockUntilReady ¶
func (m *SplitManager) BlockUntilReady(timer int) error
BlockUntilReady Calls BlockUntilReady on factory to block manager on readiness
func (*SplitManager) Split ¶
func (m *SplitManager) Split(feature string) *SplitView
Split returns a partial view of a particular split
func (*SplitManager) SplitNames ¶
func (m *SplitManager) SplitNames() []string
SplitNames returns a list with the name of all the currently stored splits
func (*SplitManager) Splits ¶
func (m *SplitManager) Splits() []SplitView
Splits returns a list of a partial view of every currently stored split
type SplitView ¶
type SplitView struct { Name string `json:"name"` TrafficType string `json:"trafficType"` Killed bool `json:"killed"` Treatments []string `json:"treatments"` ChangeNumber int64 `json:"changeNumber"` Configs map[string]string `json:"configs"` }
SplitView is a partial representation of a currently stored split
type TreatmentResult ¶
TreatmentResult struct that includes the Treatment evaluation with the corresponding Config