Skip to content
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

Start adding support for FabricClientSettings and FabricSecurityCredentials #139

Merged
merged 9 commits into from
Mar 10, 2025

Conversation

cgettys-microsoft
Copy link
Contributor

@cgettys-microsoft cgettys-microsoft commented Mar 7, 2025

I'd like to have support for ergonomic (i.e. safe) versions of FABRIC_CLIENT_SETTINGS and FABRIC_SECURITY_CREDENTIALS
This makes necessary error handling changes (that are breaking), as FabricClientBuilder::build() now can error if there are invalid settings. It's a small step towards #140

  • For now, the error type remains opaque (as it isn't actually instantiated anyway).
  • The FabricClientSettings struct remains empty (and adding new Optional defaults shouldn't breaking)
  • The FabricSecurityCredentials enum is also empty (and marked non_exhaustive, so adding more entries in future will not be a breaking change)
  • Also add some trivial wrapper types for the next PR, empty modules, and so on.

@cgettys-microsoft cgettys-microsoft marked this pull request as ready for review March 7, 2025 03:32
.expect("failed to cast fabric client to IFabricClientSettings2");
if let Some(desired_settings) = client_settings {
desired_settings
.apply(&setting_interface)
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO the combining of the setting value should be the responsibility of the user. U can provide api to load existing values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, but I'm not doing the combining of the setting value in this PR at all - it just is applying the settings, if provided.
The "what does that mean, do we combine settings" isn't in this PR at all.

I could make two methods - with_client_settings_overrides and with_client_settings, if we want to expose the capability to not get defaults from the client. But they can also always fall back to the COM API for that sort of advanced scenario?

Or are you saying you'd rather client settings and credentials not be part of the builder, but instead be &mut self methods on FabricClient and the individual clients as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

with_client_settings.
FabricClientSettings should have fn to load existing settings.

@@ -34,13 +38,22 @@ pub use notification::ServiceNotification;
#[cfg(test)]
mod tests;

#[non_exhaustive]
#[derive(Debug)]
pub enum FabricClientCreationError {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Impl std Error trait?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do in follow up PR

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#![deny(unsafe_op_in_unsafe_fn)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where are denies needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are just me tightening up warnings in new code. unsafe_op_in_unsafe_fn requires discrete unsafe blocks inside unsafe functions to better clarify where unsafeness is (believe this becomes on by default in edition 2024)
undocumented_unsafe_block makes me write // SAFETY comments

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see unsafe code in this mod in this PR. Assme it will be used in the next.

@youyuanwu youyuanwu merged commit dd4d857 into Azure:main Mar 10, 2025
4 checks passed
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