proxystore.endpoint.p2p.bindings¶
Patches to the iroh bindings.
The iroh bindings are generated by uniffi. Bindings generated by any uniffi version older than 0.32.0 (including 0.31.x patch releases) copy the data of each bytes argument passed to Rust one byte at a time in a Python loop, which limits the throughput of peer connections. uniffi 0.32.0 fixes this (mozilla/uniffi-rs#2824).
The version of uniffi which generated the bindings is not available at
runtime, so
patch_buffer_write()
only replaces the copy if the bindings still contain the per-byte loop. This
module can be removed once iroh requires bindings generated by uniffi 0.32.0
or newer.
patch_buffer_write
¶
Replace the per-byte copy of bytes arguments in the iroh bindings.
Parameters:
-
builder(type | None, default:None) –Buffer builder class to patch. Defaults to the
_UniffiRustBufferBuilderof the iroh bindings.
Returns:
-
bool–If the
write()method of the builder was patched. The method is only patched if it copies data one byte at a time.