serialization utilities for apply messages
Authors:
Serialize an object into a list of sendable buffers.
Parameters: | obj : object
buffer_threshold : int
item_threshold : int
|
---|---|
Returns: | [bufs] : list of buffers representing the serialized object. |
reconstruct an object serialized by serialize_object from data buffers.
Parameters: | bufs : list of buffers/bytes g : globals to be used when uncanning |
---|---|
Returns: | (newobj, bufs) : unpacked object, and the list of remaining unused buffers. |
pack up a function, args, and kwargs to be sent over the wire
Each element of args/kwargs will be canned for special treatment, but inspection will not go any deeper than that.
Any object whose data is larger than threshold will not have their data copied (only numpy arrays and bytes/buffers support zero-copy)
Message will be a list of bytes/buffers of the format:
[ cf, pinfo, <arg_bufs>, <kwarg_bufs> ]
With length at least two + len(args) + len(kwargs)
unpack f,args,kwargs from buffers packed by pack_apply_message() Returns: original f,args,kwargs