Skip to content

Conversation

@juwentus1234
Copy link
Contributor

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

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
@netlify
Copy link

netlify bot commented Dec 22, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 9c0a6ef
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/6949c8341037da00085bec52

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 22, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 22, 2025

@juwentus1234 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D89686258.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant