Documentation ¶
Index ¶
- Constants
- func GetCurrentUser() model.FFCUser
- func ProcessMessage(message string)
- func Remove()
- func SetCurrentUser(user model.FFCUser, inherit bool)
- type BasicConfig
- type Client
- func (c *Client) BoolVariation(featureFlagKey string, user model.FFCUser, defaultValue bool) bool
- func (c *Client) BoolVariationDetail(featureFlagKey string, user model.FFCUser, defaultValue bool) model.FlagState
- func (c *Client) FloatVariation(featureFlagKey string, user model.FFCUser, defaultValue float64) float64
- func (c *Client) FloatVariationDetail(featureFlagKey string, user model.FFCUser, defaultValue float64) model.FlagState
- func (c *Client) Flush()
- func (c *Client) GetAllLatestFlagsVariations(user model.FFCUser) model.AllFlagState
- func (c *Client) GetAllUserTags() []model.UserTag
- func (c *Client) InitializeFromExternalJson(jsonStr string) bool
- func (c *Client) Int64Variation(featureFlagKey string, user model.FFCUser, defaultValue int64) int64
- func (c *Client) Int64VariationDetail(featureFlagKey string, user model.FFCUser, defaultValue int64) model.FlagState
- func (c *Client) IntVariation(featureFlagKey string, user model.FFCUser, defaultValue int) int
- func (c *Client) IntVariationDetail(featureFlagKey string, user model.FFCUser, defaultValue int) model.FlagState
- func (c *Client) IsEnable(featureFlagKey string, user model.FFCUser) bool
- func (c *Client) IsFlagKnown(featureFlagKey string) bool
- func (c *Client) IsInitialized() bool
- func (c *Client) TrackMetric(user model.FFCUser, eventName string)
- func (c *Client) TrackMetricSeries(user model.FFCUser, metrics map[string]float64)
- func (c *Client) TrackMetricWithValue(user model.FFCUser, eventName string, metricValue float64)
- func (c *Client) TrackMetrics(user model.FFCUser, eventNames ...string)
- func (c *Client) Variation(featureFlagKey string, user model.FFCUser, defaultValue string) string
- func (c *Client) VariationDetail(featureFlagKey string, user model.FFCUser, defaultValue string) model.FlagState
- type Config
- type ConfigBuilder
- func (c *ConfigBuilder) Build() *Config
- func (c *ConfigBuilder) SetHttpConfigFactory(httpConfigFactory HttpConfigFactory) *ConfigBuilder
- func (c *ConfigBuilder) SetInsightProcessorFactory(insightProcessorFactory InsightProcessorFactory) *ConfigBuilder
- func (c *ConfigBuilder) SetOffline(offline bool) *ConfigBuilder
- func (c *ConfigBuilder) SetStartWaitTime(startWaitTime time.Duration) *ConfigBuilder
- func (c *ConfigBuilder) SetUpdateProcessorFactory(streamingBuilder *StreamingBuilder) *ConfigBuilder
- type Context
- type Evaluator
- type HttpConfig
- type HttpConfigBuilder
- func (h *HttpConfigBuilder) CreateHttpConfig(config BasicConfig) HttpConfig
- func (h *HttpConfigBuilder) SetConnectTime(connectTime time.Duration) *HttpConfigBuilder
- func (h *HttpConfigBuilder) SetHttpProxy(proxyHost string, proxyPort int) *HttpConfigBuilder
- func (h *HttpConfigBuilder) SetSSlConfig(config *tls.Config) *HttpConfigBuilder
- func (h *HttpConfigBuilder) SetSocketTime(socketTime time.Duration) *HttpConfigBuilder
- type HttpConfigFactory
- type Insight
- type InsightBuilder
- func (i *InsightBuilder) CreateInsightProcessor(context Context) InsightProcessor
- func (i *InsightBuilder) SetCapacity(capacity float64) *InsightBuilder
- func (i *InsightBuilder) SetEventUri(eventUri string) *InsightBuilder
- func (i *InsightBuilder) SetMaxRetryTimes(maxRetryTimes int) *InsightBuilder
- func (i *InsightBuilder) SetRetryInterval(retryInterval int) *InsightBuilder
- type InsightConfig
- type InsightEvent
- type InsightEventSender
- type InsightProcessor
- type InsightProcessorFactory
- type NullUpdateProcessor
- type NullUpdateProcessorFactory
- type Streaming
- type StreamingBuilder
- func (s *StreamingBuilder) CreateUpdateProcessor(context Context) UpdateProcessor
- func (s *StreamingBuilder) NewDefaultStreamingURI() *StreamingBuilder
- func (s *StreamingBuilder) NewStreamingURI(uri string) *StreamingBuilder
- func (s *StreamingBuilder) SetFirstRetryDelay(duration time.Duration) *StreamingBuilder
- func (s *StreamingBuilder) SetMaxRetryTimes(maxRetryTimes int64) *StreamingBuilder
- type UpdateProcessor
- type UpdateProcessorFactory
Constants ¶
const ( ConfigDefaultStartWaitTime = time.Duration(time.Second) HttpConfigDefaultConnTime = time.Duration(time.Second * 10) HttpConfigDefaultSocketTime = time.Duration(time.Second * 15) )
const ( FLAGS = iota FLUSH SHUTDOWN METRICS )
Variables ¶
This section is empty.
Functions ¶
func GetCurrentUser ¶
func ProcessMessage ¶
func ProcessMessage(message string)
ProcessMessage receive message from web socket and convert to all object. @Param message the data receive from socket
func SetCurrentUser ¶
Types ¶
type BasicConfig ¶
type Client ¶
type Client struct { Offline bool Evaluator Evaluator EnvSecret string // contains filtered or unexported fields }
func (*Client) BoolVariation ¶
BoolVariation Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) BoolVariationDetail ¶
func (c *Client) BoolVariationDetail(featureFlagKey string, user model.FFCUser, defaultValue bool) model.FlagState
BoolVariationDetail Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) FloatVariation ¶
func (c *Client) FloatVariation(featureFlagKey string, user model.FFCUser, defaultValue float64) float64
FloatVariation Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) FloatVariationDetail ¶
func (c *Client) FloatVariationDetail(featureFlagKey string, user model.FFCUser, defaultValue float64) model.FlagState
FloatVariationDetail Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) GetAllLatestFlagsVariations ¶
func (c *Client) GetAllLatestFlagsVariations(user model.FFCUser) model.AllFlagState
GetAllLatestFlagsVariations Returns a list of all feature flags value with details for a given user, including the reason that describes the way the value was determined, that can be used on the client side sdk or a front end . @Param user the end user requesting the flag @Return
func (*Client) GetAllUserTags ¶
GetAllUserTags return a list of user tags used to instantiate a {@link FFCUser} @Return a list of user tags
func (*Client) InitializeFromExternalJson ¶
InitializeFromExternalJson initialization in the offline mode @Param featureFlagKey the unique key for the feature flag
func (*Client) Int64Variation ¶
func (c *Client) Int64Variation(featureFlagKey string, user model.FFCUser, defaultValue int64) int64
Int64Variation Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) Int64VariationDetail ¶
func (c *Client) Int64VariationDetail(featureFlagKey string, user model.FFCUser, defaultValue int64) model.FlagState
Int64VariationDetail Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) IntVariation ¶
IntVariation Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) IntVariationDetail ¶
func (c *Client) IntVariationDetail(featureFlagKey string, user model.FFCUser, defaultValue int) model.FlagState
IntVariationDetail Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) IsEnable ¶
IsEnable alias of boolVariation for a given user @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Return if the flag should be enabled, or false if the flag is disabled, or an error occurs
func (*Client) IsFlagKnown ¶
IsFlagKnown Returns true if the specified feature flag currently exists. @Param featureFlagKey the unique key for the feature flag @Return true if the flag exists
func (*Client) IsInitialized ¶
IsInitialized Tests whether the client is ready to be used. @Return true if the client is ready, or false if it is still initializing
func (*Client) TrackMetric ¶
TrackMetric tracks that a user performed an event and provides a default numeric value for custom metrics @Param user the user that performed the event @Param eventName the name of the event
func (*Client) TrackMetricSeries ¶
TrackMetricSeries tracks that a user performed an event and provides a default numeric value for custom metrics @Param user the user that performed the event @Param metrics event name and numeric value in K/V
func (*Client) TrackMetricWithValue ¶
TrackMetricWithValue tracks that a user performed an event and provides a default numeric value for custom metrics @Param user the user that performed the event @Param eventName the name of the event @Param metricValue a numeric value used by the experimentation feature in numeric custom metrics.
func (*Client) TrackMetrics ¶
TrackMetrics tracks that a user performed an event and provides a default numeric value for custom metrics @Param user the user that performed the event @Param eventName the name of the events
func (*Client) Variation ¶
Variation Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
func (*Client) VariationDetail ¶
func (c *Client) VariationDetail(featureFlagKey string, user model.FFCUser, defaultValue string) model.FlagState
VariationDetail Calculates the value of a feature flag for a given user. @Param featureFlagKey the unique key for the feature flag @Param user the end user requesting the flag @Param defaultValue the default value of the flag @Return the variation for the given user, or defaultValue if the flag is disabled or an error occurs
type Config ¶
type Config struct { StartWaitTime time.Duration OffLine bool HttpConfig HttpConfig UpdateProcessorFactory UpdateProcessorFactory InsightProcessorFactory InsightProcessorFactory HttpConfigFactory HttpConfigFactory }
type ConfigBuilder ¶
type ConfigBuilder struct { StartWaitTime time.Duration UpdateProcessorFactory UpdateProcessorFactory InsightProcessorFactory InsightProcessorFactory HttpConfigFactory HttpConfigFactory Offline bool }
ConfigBuilder build data for config object
func NewConfigBuilder ¶
func NewConfigBuilder() *ConfigBuilder
func (*ConfigBuilder) Build ¶
func (c *ConfigBuilder) Build() *Config
func (*ConfigBuilder) SetHttpConfigFactory ¶
func (c *ConfigBuilder) SetHttpConfigFactory(httpConfigFactory HttpConfigFactory) *ConfigBuilder
func (*ConfigBuilder) SetInsightProcessorFactory ¶
func (c *ConfigBuilder) SetInsightProcessorFactory(insightProcessorFactory InsightProcessorFactory) *ConfigBuilder
func (*ConfigBuilder) SetOffline ¶
func (c *ConfigBuilder) SetOffline(offline bool) *ConfigBuilder
func (*ConfigBuilder) SetStartWaitTime ¶
func (c *ConfigBuilder) SetStartWaitTime(startWaitTime time.Duration) *ConfigBuilder
func (*ConfigBuilder) SetUpdateProcessorFactory ¶
func (c *ConfigBuilder) SetUpdateProcessorFactory(streamingBuilder *StreamingBuilder) *ConfigBuilder
type Context ¶
type Context struct { HttpConfig HttpConfig BasicConfig BasicConfig }
func NewContext ¶
NewContext create Context object @Param envSecret @Param config @Return a Context object
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
func NewEvaluator ¶
func NewEvaluator(dataStorage data.DataStorage) Evaluator
type HttpConfig ¶
type HttpConfigBuilder ¶
type HttpConfigBuilder struct { Proxy func(*http.Request) (*url.URL, error) ConnectTime time.Duration SocketTime time.Duration TLSClientConfig *tls.Config }
func HttpConfigBuilderFactory ¶
func HttpConfigBuilderFactory() *HttpConfigBuilder
func NewHttpConfigBuilder ¶
func NewHttpConfigBuilder() *HttpConfigBuilder
func (*HttpConfigBuilder) CreateHttpConfig ¶
func (h *HttpConfigBuilder) CreateHttpConfig(config BasicConfig) HttpConfig
func (*HttpConfigBuilder) SetConnectTime ¶
func (h *HttpConfigBuilder) SetConnectTime(connectTime time.Duration) *HttpConfigBuilder
func (*HttpConfigBuilder) SetHttpProxy ¶
func (h *HttpConfigBuilder) SetHttpProxy(proxyHost string, proxyPort int) *HttpConfigBuilder
func (*HttpConfigBuilder) SetSSlConfig ¶
func (h *HttpConfigBuilder) SetSSlConfig(config *tls.Config) *HttpConfigBuilder
func (*HttpConfigBuilder) SetSocketTime ¶
func (h *HttpConfigBuilder) SetSocketTime(socketTime time.Duration) *HttpConfigBuilder
type HttpConfigFactory ¶
type HttpConfigFactory interface { // CreateHttpConfig Creates the http configuration. // @Param config provides the basic SDK configuration properties // @Return an HttpConfig instance CreateHttpConfig(config BasicConfig) HttpConfig }
type Insight ¶
type Insight struct { InsightConfig InsightConfig // contains filtered or unexported fields }
func NewInsight ¶
func NewInsight(config InsightConfig) Insight
type InsightBuilder ¶
type InsightBuilder struct { MaxRetryTimes int RetryInterval int // Millisecond HttpConfig HttpConfig EventUri string Capacity float64 }
func InsightBuilderFactory ¶
func InsightBuilderFactory() *InsightBuilder
func NewInsightBuilder ¶
func NewInsightBuilder() *InsightBuilder
func (*InsightBuilder) CreateInsightProcessor ¶
func (i *InsightBuilder) CreateInsightProcessor(context Context) InsightProcessor
func (*InsightBuilder) SetCapacity ¶
func (i *InsightBuilder) SetCapacity(capacity float64) *InsightBuilder
func (*InsightBuilder) SetEventUri ¶
func (i *InsightBuilder) SetEventUri(eventUri string) *InsightBuilder
func (*InsightBuilder) SetMaxRetryTimes ¶
func (i *InsightBuilder) SetMaxRetryTimes(maxRetryTimes int) *InsightBuilder
func (*InsightBuilder) SetRetryInterval ¶
func (i *InsightBuilder) SetRetryInterval(retryInterval int) *InsightBuilder
type InsightConfig ¶
type InsightConfig struct { EventUrl string FlushInterval int64 Capacity int // contains filtered or unexported fields }
func NewInsightConfig ¶
func NewInsightConfig(sender InsightEventSender, baseUri string, flushInterval int64, capacity int) InsightConfig
type InsightEvent ¶
type InsightEvent struct { MaxRetryTimes int RetryInterval int HttpConfig HttpConfig }
func NewInsightEvent ¶
func NewInsightEvent(config HttpConfig, maxRetryTimes int, retryInterval int) *InsightEvent
func (*InsightEvent) PostJsonWithHeaders ¶
func (*InsightEvent) SendEvent ¶
func (i *InsightEvent) SendEvent(eventUrl string, json string)
type InsightEventSender ¶
type InsightProcessor ¶
type InsightProcessor interface { // Send Records an event asynchronously. Send(event data.Event) // Flush Specifies that any buffered events should be sent as soon as possible, rather than waiting // for the next flush interval. This method is asynchronous, so events still may not be sent // until a later time. Flush() }
type InsightProcessorFactory ¶
type InsightProcessorFactory interface { // CreateInsightProcessor creates an implementation of {@link InsightProcessor} CreateInsightProcessor(context Context) InsightProcessor }
type NullUpdateProcessor ¶
type NullUpdateProcessor struct { }
func (*NullUpdateProcessor) IsInitialized ¶
func (n *NullUpdateProcessor) IsInitialized() bool
func (*NullUpdateProcessor) Start ¶
func (n *NullUpdateProcessor) Start() bool
type NullUpdateProcessorFactory ¶
type NullUpdateProcessorFactory struct { }
func (*NullUpdateProcessorFactory) CreateUpdateProcessor ¶
func (n *NullUpdateProcessorFactory) CreateUpdateProcessor(context Context) UpdateProcessor
type Streaming ¶
type Streaming struct { BasicConfig BasicConfig HttpConfig HttpConfig StreamingURL string }
func NewStreaming ¶
func (*Streaming) IsInitialized ¶
func (*Streaming) PingOrDataSync ¶
PingOrDataSync websocket ping
type StreamingBuilder ¶
type StreamingBuilder struct { StreamingURI string FirstRetryDelay time.Duration MaxRetryTimes int64 }
func NewStreamingBuilder ¶
func NewStreamingBuilder() *StreamingBuilder
func StreamingBuilderFactory ¶
func StreamingBuilderFactory() *StreamingBuilder
func (*StreamingBuilder) CreateUpdateProcessor ¶
func (s *StreamingBuilder) CreateUpdateProcessor(context Context) UpdateProcessor
func (*StreamingBuilder) NewDefaultStreamingURI ¶
func (s *StreamingBuilder) NewDefaultStreamingURI() *StreamingBuilder
func (*StreamingBuilder) NewStreamingURI ¶
func (s *StreamingBuilder) NewStreamingURI(uri string) *StreamingBuilder
func (*StreamingBuilder) SetFirstRetryDelay ¶
func (s *StreamingBuilder) SetFirstRetryDelay(duration time.Duration) *StreamingBuilder
func (*StreamingBuilder) SetMaxRetryTimes ¶
func (s *StreamingBuilder) SetMaxRetryTimes(maxRetryTimes int64) *StreamingBuilder
type UpdateProcessor ¶
type UpdateProcessor interface { // Start Starts the client update processing. // @return completion status indicates the client has been initialized. Start() bool // IsInitialized Returns true once the client has been initialized and will never return false again. // @return true if the client has been initialized IsInitialized() bool }
type UpdateProcessorFactory ¶
type UpdateProcessorFactory interface { // CreateUpdateProcessor Creates an implementation instance. // @param context allows access to the client configuration // @return an {@link UpdateProcessor} CreateUpdateProcessor(context Context) UpdateProcessor }