Skip to content

Conversation

@urlyy
Copy link
Contributor

@urlyy urlyy commented Jun 2, 2025

What does this PR do?

Prepare to implement xlang metashare encode&decode in pyfory.
Now finish field_info and type_info(TypeDef) in python not cython.
I will continue to finish type_resolver for registry.

other small change:

  • Add Buffer::write_uint8 for writing 1 byte header.
  • Add metastring encoding options for field_name and namespace metastring encode.

Some Question

  • Still confused about naming. For me, I want to change all class_ prefix to type_, like class_info -> type_info, class_resolver -> type_resolver. So it will be unified.
  • There is not writeVarUint32Small7 in pyfury cython. Now I use write_varuint32. Should I add this function?
  • Now I just finish the xlang TypeDefMeta specification. As the java version is too complex to imitate, I use my way to implement this: not use outer Encoder/Decoder/Resolver class, just implement the xread/xwrite logic in type_info/field_info class. If this is not good, I will rewrite this part.
  • Is Java now support testing with python using Xlang&Compatible mode?

Related issues

#2160

Does this PR introduce any user-facing change?

WIP

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

TODO

@urlyy urlyy requested a review from chaokunyang as a code owner June 2, 2025 07:52
@urlyy urlyy changed the title feat(python): support xlang metashare feat(python): support xlang metashare (WIP) Jun 2, 2025
SCHEMA_CONSISTENT = 1
COMPATIBLE = 2

class MetaContext:
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'd better to put this class in _serialization.pyx for better performance

@chaokunyang
Copy link
Collaborator

It would be great if we could change all class_ prefix to type_, like class_info -> type_info, class_resolver -> type_resolver. This will make the code more clean. How about opening another PR for this? After that PR is merged, we could merge from main branch again to resovle the conflicts

@urlyy
Copy link
Contributor Author

urlyy commented Jun 3, 2025

It would be great if we could change all class_ prefix to type_, like class_info -> type_info, class_resolver -> type_resolver. This will make the code more clean. How about opening another PR for this? After that PR is merged, we could merge from main branch again to resovle the conflicts

ok

@pandalee99
Copy link
Contributor

@urlyy Hi, are you considering continuing to implement this PR?

@urlyy
Copy link
Contributor Author

urlyy commented Aug 11, 2025

@urlyy Hi, are you considering continuing to implement this PR?

Sorry😢, I've been a bit busy these days, and the PR is a bit troublesome for me. I don't think I'll continue working on this PR.

chaokunyang added a commit that referenced this pull request Aug 25, 2025
## Why?

type forward/backward compatible serialization is critical for online
service which different service update their data schema and deploy at
different time. The schema is in an inconsistent state.

meta shared encoding can address this :
https://fory.apache.org/docs/specification/fory_xlang_serialization_spec#type-def

## What does this PR do?

Add type meta encoding for python to support type forward/backward
compatible serialization.

Things not finished in this PR:
- not null field support
- generate serializer from type meta
- meta share mode

Those feature will be implemented in follow-up PRs.

## Related issues

#1938
#2160
#2278

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/fory/issues/new/choose) describing the
need to do so and update the document if necessary.

Delete section if not applicable.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.

Delete section if not applicable.
-->
chaokunyang added a commit that referenced this pull request Sep 9, 2025
)

## Why?

implement meta share mode for pyfory, so the struct can add/delete
fields and have inconsistent schema bettween serialization and
deserialization

## What does this PR do?

<!-- Describe the details of this PR. -->

## Related issues

#2509
#1938
#2160
#2278 

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/fory/issues/new/choose) describing the
need to do so and update the document if necessary.

Delete section if not applicable.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.

Delete section if not applicable.
-->
chaokunyang added a commit that referenced this pull request Sep 10, 2025
#2602)

## Why?

align java and python compatible mode serialization

## What does this PR do?

<!-- Describe the details of this PR. -->

## Related issues

#2509
#1938
#2160
#2278
#2593

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/fory/issues/new/choose) describing the
need to do so and update the document if necessary.

Delete section if not applicable.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.

Delete section if not applicable.
-->
@urlyy urlyy deleted the feat-2160 branch October 11, 2025 05:21
@urlyy urlyy restored the feat-2160 branch October 11, 2025 05:21
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.

3 participants