Skip to content

Support python custom message builder and make Data field's type return MemoryView #380

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

BrianXu0623
Copy link

@BrianXu0623 BrianXu0623 commented May 14, 2025

This PR is for resolving the following issue:
issue

  1. Created _PyCustomMessageBuilder extends MessageBuilder, enabling the ability to customise the SegmentAllocate method in Python. This allows allocation and data population within shared memory, and supports zero-copy inter-process data transfer by passing segment offsets.

  2. Fields of type Data now support being set with a memoryview. When retrieving a Data field from a DynamicStructBuilder, it will return a writable memoryview, allowing users to modify the data directly. This enables memory to be pre-allocated and content to be modified in later, eliminating an extra copy. When retrieving a Data field from a DynamicStructReader, it will return a read-only memoryview, allowing user to read data without memory copy.

@BrianXu0623 BrianXu0623 marked this pull request as draft May 15, 2025 12:50
@BrianXu0623 BrianXu0623 marked this pull request as ready for review May 15, 2025 14:25
@BrianXu0623 BrianXu0623 changed the title Support python custom message builder and make DynamicStructBuilder's Data type as MemoryView Support python custom message builder and make Data field's type return MemoryView May 20, 2025
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.

1 participant