Skip to content

Commit cd8fc9a

Browse files
adjusting comments on PR
1 parent 29bb8ae commit cd8fc9a

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

examples/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ func main() {
6565
notificationCenter := notification.NewNotificationCenter()
6666

6767
app = optimizelyFactory.GetClient(
68-
client.ConfigManager("4SLpaJA1r1pgE6T2CoMs9q", time.Second, nil),
69-
client.DecisionService(notificationCenter),
70-
client.EventProcessor(event.DefaultBatchSize, event.DefaultEventQueueSize, event.DefaultEventFlushInterval),
68+
client.PollingConfigManager("4SLpaJA1r1pgE6T2CoMs9q", time.Second, nil),
69+
client.CompositeDecisionService(notificationCenter),
70+
client.BatchEventProcessor(event.DefaultBatchSize, event.DefaultEventQueueSize, event.DefaultEventFlushInterval),
7171
)
7272
app.Close()
7373
}

optimizely/client/factory.go

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ func (f OptimizelyFactory) GetClient(clientOptions ...OptionFunc) *OptimizelyCli
5858
return appClient
5959
}
6060

61-
// ConfigManager sets config manager on a client
62-
func ConfigManager(sdkKey string, pollingInterval time.Duration, dataFile []byte) OptionFunc {
61+
// PollingConfigManager sets polling config manager on a client
62+
func PollingConfigManager(sdkKey string, pollingInterval time.Duration, dataFile []byte) OptionFunc {
6363
return func(f *OptimizelyClient, executionCtx utils.ExecutionCtx) {
6464
options := config.PollingProjectConfigManagerOptions{
6565
Datafile: dataFile,
@@ -69,20 +69,41 @@ func ConfigManager(sdkKey string, pollingInterval time.Duration, dataFile []byte
6969
}
7070
}
7171

72-
// DecisionService sets decision service on a client
73-
func DecisionService(notificationCenter notification.Center) OptionFunc {
72+
// ConfigManager sets polling config manager on a client
73+
func ConfigManager(configManager optimizely.ProjectConfigManager) OptionFunc {
74+
return func(f *OptimizelyClient, executionCtx utils.ExecutionCtx) {
75+
f.configManager = configManager
76+
}
77+
}
78+
79+
// CompositeDecisionService sets decision service on a client
80+
func CompositeDecisionService(notificationCenter notification.Center) OptionFunc {
7481
return func(f *OptimizelyClient, executionCtx utils.ExecutionCtx) {
7582
f.decisionService = decision.NewCompositeService(notificationCenter)
7683
}
7784
}
7885

79-
// EventProcessor sets event processor on a client
80-
func EventProcessor(batchSize, queueSize int, flushInterval time.Duration) OptionFunc {
86+
// DecisionService sets decision service on a client
87+
func DecisionService(decisionService decision.Service) OptionFunc {
88+
return func(f *OptimizelyClient, executionCtx utils.ExecutionCtx) {
89+
f.decisionService = decisionService
90+
}
91+
}
92+
93+
// BatchEventProcessor sets event processor on a client
94+
func BatchEventProcessor(batchSize, queueSize int, flushInterval time.Duration) OptionFunc {
8195
return func(f *OptimizelyClient, executionCtx utils.ExecutionCtx) {
8296
f.eventProcessor = event.NewEventProcessor(executionCtx, batchSize, queueSize, flushInterval)
8397
}
8498
}
8599

100+
// EventProcessor sets event processor on a client
101+
func EventProcessor(eventProcessor event.Processor) OptionFunc {
102+
return func(f *OptimizelyClient, executionCtx utils.ExecutionCtx) {
103+
f.eventProcessor = eventProcessor
104+
}
105+
}
106+
86107
// StaticClient returns a client initialized with a static project config
87108
func (f OptimizelyFactory) StaticClient() (*OptimizelyClient, error) {
88109
var configManager optimizely.ProjectConfigManager

0 commit comments

Comments
 (0)