Skip to content

feat(dfm): Datafile management implementation #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jun 7, 2019

Conversation

msohailhussain
Copy link
Contributor

Summary

All details are in the doc.

Test plan

Issues


namespace OptimizelySDK.DatafileManagement
{
public class AtomicProjectConfigManager : ProjectConfigManager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't anything about this class that makes it atomic. If that is the case, can we change the name to something else or actually make it atomic?

//t.Start();
//return t;
}
static ProjectConfig ParseProjectConfig(string datafile)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right place to put it. If you look at the Java SDK, the notion of a ProjectConfig backed by a Datafile is split from this and is defined at a higher level: https://github.com/optimizely/java-sdk/blob/master/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java

The idea is that we can have other types of Datafile-backed project config that don't necessarily have to be polled, such as push-based with websockets or server-sent events.


namespace OptimizelySDK
{
public interface ProjectConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProjectConfig can be more abstract than this. We can have project configs later on that are not based on datafile, but can be based on a different structure. Here is the abstraction approach we took in the Java SDK:

https://github.com/optimizely/java-sdk/blob/master/core-api/src/main/java/com/optimizely/ab/config/ProjectConfig.java

For this reason, also, we should change the name of the package to ProjectConfig instead of DatafileManagement so we don't tie it to just the Datafile transport type.

/// set by the user by calling setForcedVariation (it is not the same as the
/// whitelisting forcedVariations data structure in the Experiments class).
/// </summary>
private Dictionary<string, Dictionary<string, string>> _ForcedVariationMap;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest moving the forced variation state to the decision service, as we've done in other SDKs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been moved in sohail/optimizelydfm (Will add PR today)

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly good. There are a few nits and we also need to move the forced variation logic into the decision service. A good way to do that would be to open up another PR against sohail/dfmcomplete with that change. We can review and merge and then rebase this PR for merging.

@@ -0,0 +1,643 @@
/*
* Copyright 2017-2019, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should just be 2019

/// set by the user by calling setForcedVariation (it is not the same as the
/// whitelisting forcedVariations data structure in the Experiments class).
/// </summary>
private Dictionary<string, Dictionary<string, string>> _ForcedVariationMap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

private Dictionary<string, List<string>> ExperimentFeatureMap = new Dictionary<string, List<string>>();


//========================= Callbacks ===========================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: These aren't really callbacks are they?


namespace OptimizelySDK.Config
{
public class FallbackProjectConfigManager : ProjectConfigManager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there gonna be more logic for the "fallback"? I think you mentioned you'd have that in a separate PR. In that case just add a //TODO here for it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, no more logic, in other PR, I will remov SetConfig, and ProjectConfig will only be set by constructor.

public Task OnReady()
{
return CompletableConfigManager.Task;
//Task t = new Task(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. We just need to remove the ForcedVariationMap from the DatafileProjectConfig

@msohailhussain
Copy link
Contributor Author

lgtm. We just need to remove the ForcedVariationMap from the DatafileProjectConfig

I removed in this PR.
https://github.com/optimizely/csharp-sdk/pull/161/files#diff-6c7503ba59bde21387a0424b504ad19dL137

@msohailhussain msohailhussain changed the title ci(feat): Datafile management implementation feat(dfm): Datafile management implementation Jun 4, 2019
@mikeproeng37 mikeproeng37 merged commit ccc6bd2 into sohail/dfmcomplete Jun 7, 2019
@msohailhussain msohailhussain deleted the sohail/dfm branch September 24, 2019 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants