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

[FabricRuntime] Support Package change notification callbacks #96

Merged
merged 18 commits into from
Dec 28, 2024

Conversation

cgettys-microsoft
Copy link
Contributor

@cgettys-microsoft cgettys-microsoft commented Nov 15, 2024

End user applications probably want to handle package change notifications.

This PR currently tackles only ConfigurationPackage.

If you're happy with the approach, I'll do the same exact implementation (edit: in additional PRs) for CodePackage and DataPackage and that will close out #97.

@cgettys-microsoft cgettys-microsoft changed the title [FabricClient] Package change notification [FabricClient] Package change notification callbacks Nov 15, 2024
@cgettys-microsoft cgettys-microsoft changed the title [FabricClient] Package change notification callbacks [FabricClient] Support Package change notification callbacks Nov 15, 2024
handle: ConfigurationPackageChangeHandlerId
}

impl ConfigurationPackageChangeEventHandlerManager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Provided a simpler struct for caller to drop. Would rather not risk leaks if we can help it. I see why you did what you did, and lifetime bound would also work, but I think this is cleaner from a usage perspective - drop handle, everything is cleaned up.

Copy link
Collaborator

@youyuanwu youyuanwu Dec 20, 2024

Choose a reason for hiding this comment

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

There is already another handle in fabric client with similar intention:

) -> crate::Result<FilterIdHandle> {

There should be 2 separate concerns in mssf. 1) Exposing the api in rust and make it clear to SF user what this api corresponds to in COM. 2) make the rust api safe.
The code currently achieves 2), but not 1).

The most wrapper type in mssf can convert from rust type and ffi raw type. My recommendation is to provide COM corresponding rust functions at 1 layer, and another layer to make things safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did it your way

@cgettys-microsoft cgettys-microsoft marked this pull request as ready for review December 20, 2024 00:43
@cgettys-microsoft cgettys-microsoft changed the title [FabricClient] Support Package change notification callbacks Support Package change notification callbacks Dec 20, 2024
@cgettys-microsoft cgettys-microsoft changed the title Support Package change notification callbacks [FabricRuntime] Support Package change notification callbacks Dec 20, 2024

// One might wish to use such a callback to e.g. trigger custom handling of configuration changes
// This doesn't require the config feature to be enabled
let _handler = my_ctx.register_config_package_change_handler( |c|
Copy link
Collaborator

Choose a reason for hiding this comment

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

U should move this to one of the example apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh? this is one of the samples

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, you mean one of the full applications.
Yeah, that could make sense.
I do want to ensure this continues to build without those features though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the logical example to add it to would be echomain

As we could demonstrate how to hook it up to trigger a Config reload

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given I'd like to have this build here as well, can I defer that to a second PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

U can keep it here or add to the working app.
But note that this code here cannot run because it is not launched by SF, and we are not packaging it in an app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it to echomain as well (but haven't had a chance to test that app yet)
Right, point of this is to make sure we can package w/o tokio

@youyuanwu youyuanwu merged commit f8cf77f into Azure:main Dec 28, 2024
4 checks passed
@cgettys-microsoft cgettys-microsoft deleted the package-change-notification branch December 28, 2024 00:24
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