Skip to content

Is custom segment allocator and in-place population of Data fields supported #379

@BrianXu0623

Description

@BrianXu0623

Background

I hope to transfer data between processes via shared memory in a zero-copy manner. In the C++ Cap’n’Proto library, this is achievable by inheriting MessageBuilder and overriding SegmentAllocator function, to allocates buffers within shared memory and populates them in place; data can then be transferred between processes by passing Segment offset in a zero-copy manner.

However, in pycapnp we have not found an approach for equivalent mechanism.

Moreover, when initializing a Data field in pycapnp, the library returns a Python bytes object. So it seems that it does not support allocating memory in advance and then populating content later, in this case one more copy is required for setting the field.

Question

Does pycapnp currently provide any APIs that would

  • allow us to supply a custom segment allocator
  • perform in-place population of Data type fields after being initialised just as in the C++?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions