pyarrow.plasma.PlasmaBuffer#

class pyarrow.plasma.PlasmaBuffer#

Bases: pyarrow.lib.Buffer

This is the type returned by calls to get with a PlasmaClient.

We define our own class instead of directly returning a buffer object so that we can add a custom destructor which notifies Plasma that the object is no longer being used, so the memory in the Plasma store backing the object can potentially be freed.

Attributes
object_idObjectID

The ID of the object in the buffer.

clientPlasmaClient

The PlasmaClient that we use to communicate with the store and manager.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

equals(self, Buffer other)

Determine if two buffers contain exactly the same data.

hex(self)

Compute hexadecimal representation of the buffer.

slice(self[, offset, length])

Slice this buffer.

to_pybytes(self)

Return this buffer as a Python bytes object.

Attributes

address

The buffer's address, as an integer.

is_cpu

Whether the buffer is CPU-accessible.

is_mutable

Whether the buffer is mutable.

parent

size

The buffer size in bytes.

address#

The buffer’s address, as an integer.

The returned address may point to CPU or device memory. Use is_cpu() to disambiguate.

equals(self, Buffer other)#

Determine if two buffers contain exactly the same data.

Parameters
otherBuffer
Returns
are_equalbool

True if buffer contents and size are equal

hex(self)#

Compute hexadecimal representation of the buffer.

Returns
: bytes
is_cpu#

Whether the buffer is CPU-accessible.

is_mutable#

Whether the buffer is mutable.

parent#
size#

The buffer size in bytes.

slice(self, offset=0, length=None)#

Slice this buffer. Memory is not copied.

You can also use the Python slice notation buffer[start:stop].

Parameters
offsetint, default 0

Offset from start of buffer to slice.

lengthint, default None

Length of slice (default is until end of Buffer starting from offset).

Returns
slicedBuffer

A logical view over this buffer.

to_pybytes(self)#

Return this buffer as a Python bytes object. Memory is copied.