refactor: Fold registerSerialization into registerType for OpaqueType#15844
Open
juwentus1234 wants to merge 1 commit intofacebookincubator:mainfrom
Open
refactor: Fold registerSerialization into registerType for OpaqueType#15844juwentus1234 wants to merge 1 commit intofacebookincubator:mainfrom
juwentus1234 wants to merge 1 commit intofacebookincubator:mainfrom
Conversation
Summary: This refactoring unifies the OpaqueType registration API by folding the `registerSerialization()` call into `registerType()`/`registerOpaqueType()`. Previously, registering an opaque type with serialization support required two separate calls: 1. `registerType()` or `registerOpaqueType<T>(name)` 2. `OpaqueType::registerSerialization<T>(name, serialize, deserialize)` Now, the unified API accepts optional serialize/deserialize parameters and internally handles serialization registration when type registration succeeds. This: - Reduces boilerplate at call sites by consolidating two calls into one - Ensures serialization is only registered when type registration succeeds (avoiding duplicate registration errors) - Maintains backward compatibility through default nullptr parameters Changes: - Extended `registerType()`/`registerOpaqueType()` to accept optional serialize/deserialize functions - Added `unregisterSerialization()` to properly clean up during `unregisterType()` - Updated all call sites that previously made two separate calls to use the unified API Differential Revision: D89686258
✅ Deploy Preview for meta-velox canceled.
|
|
@juwentus1234 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D89686258. |
|
This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the PR, make sure you've addressed reviewer comments, and rebase on the latest main. Thank you for your contributions! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This refactoring unifies the OpaqueType registration API by folding the
registerSerialization()call intoregisterType()/registerOpaqueType().Previously, registering an opaque type with serialization support required two separate calls:
registerType()orregisterOpaqueType<T>(name)OpaqueType::registerSerialization<T>(name, serialize, deserialize)Now, the unified API accepts optional serialize/deserialize parameters and internally handles serialization registration when type registration succeeds. This:
Changes:
registerType()/registerOpaqueType()to accept optional serialize/deserialize functionsunregisterSerialization()to properly clean up duringunregisterType()Differential Revision: D89686258