Skip to content

feat: move client-side config headers to client-sdk #211

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 3 commits into from
Aug 25, 2023

Conversation

cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Aug 25, 2023

This is the first in a series of PRs to re-organize the config related C bindings.

Why now?

We need the client and server SDKs to have different configs, because different options apply. At the same time, some config is sharable - such as loggers. The original 1.0 release of the client-side SDK mixed these concerns unintentionally.

This PR focuses on moving the client-side LDClientConfig and LDClientConfigBuilder out of common and into client-sdk.

This should be backwards compatible enough for a minor release, with some callouts in the release notes. Although the header locations are moving, no symbol name or function/struct definition is changing.

For config.h:

  • Because this is included by sdk.h, we can change the path. Upgrade pain should be zero, unless a user has included it elsewhere in their application (without sdk.h.)

For builder.h:

  • Because sdk.h doesn't include the config_builder.h, people would have had to manually include it. Those builds will now break because the header has moved.

To ease this transition, I've kept stub headers in the original locations which log messages using #pragma message. They can't automatically include the new location headers because that'd introduce a circular dependency.


Future work includes potentially renaming the sub-builders (such as LDDataSourceStreamBuilder) to include the Client prefix (e.g. LDClientDataSourceStreamBuilder).

We could achieve this with some typedefs + forwarding functions in a backwards compatible manner.

BEGIN_COMMIT_OVERRIDE
refactor: move client-side config headers to client_side/config
END_COMMIT_OVERRIDE

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #214574: Move client-side config bindings to dedicated folder.

#include <launchdarkly/bindings/c/context_builder.h>
#include <launchdarkly/client_side/bindings/c/config/builder.h>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This demonstrates the customer change necessary: append client_side to the left of /bindings.

@@ -0,0 +1,487 @@
/** @file */
Copy link
Contributor Author

@cwaldren-ld cwaldren-ld Aug 25, 2023

Choose a reason for hiding this comment

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

This is mostly moving the old builder.h to this new location. Log related config was removed and remains in common (<launchdarkly/bindings/c/config/logging_builder.h>)

@@ -0,0 +1,27 @@
/** @file */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just moving the file from the old location.

@@ -43,21 +45,21 @@ add_library(${LIBNAME}
flag_manager/flag_persistence.cpp
bindings/c/sdk.cpp)

if(MSVC OR (NOT BUILD_SHARED_LIBS))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like this got auto formatted.


// NOLINTEND modernize-use-using
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here are the messages.

}
#endif

// NOLINTEND modernize-use-using
Copy link
Contributor Author

Choose a reason for hiding this comment

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

More messages.

@@ -0,0 +1,134 @@
/** @file */
// NOLINTBEGIN modernize-use-using
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was extracted out of sdk.h. It can remain in common because it'll be shared by the client and server.

@cwaldren-ld cwaldren-ld marked this pull request as ready for review August 25, 2023 21:19
@cwaldren-ld cwaldren-ld requested a review from a team August 25, 2023 21:19
@cwaldren-ld cwaldren-ld force-pushed the cw/sc-214574/client-config-refactor branch from f75aabd to e545cec Compare August 25, 2023 21:21
@cwaldren-ld cwaldren-ld requested a review from kinyoklion August 25, 2023 21:23
@cwaldren-ld cwaldren-ld changed the title chore: move logging builders C bindings into common folder chore: move client-side config headers to client-sdk Aug 25, 2023
@cwaldren-ld cwaldren-ld changed the title chore: move client-side config headers to client-sdk feat: move client-side config headers to client-sdk Aug 25, 2023
@cwaldren-ld cwaldren-ld merged commit ef2a597 into main Aug 25, 2023
@cwaldren-ld cwaldren-ld deleted the cw/sc-214574/client-config-refactor branch August 25, 2023 21:59
@github-actions github-actions bot mentioned this pull request Aug 25, 2023
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.

2 participants