# This file was generated by stubgen-pyx v0.2.6 from cuda_core/cuda/core/_memory/_ipc.pyx

from __future__ import annotations

import uuid


class IPCDataForBuffer:
    """Data members related to sharing memory buffers via IPC."""

    def __cinit__(self, ipc_descriptor: IPCBufferDescriptor, is_mapped: bool) -> None:
        ...

    @property
    def ipc_descriptor(self) -> IPCBufferDescriptor:
        ...

    @property
    def is_mapped(self) -> bool:
        ...

class IPCDataForMR:
    """Data members related to sharing memory resources via IPC."""

    def __cinit__(self, alloc_handle: IPCAllocationHandle, is_mapped: bool) -> None:
        ...

    @property
    def alloc_handle(self) -> IPCAllocationHandle:
        ...

    @property
    def is_mapped(self) -> bool:
        ...

    @property
    def uuid(self) -> uuid.UUID | None:
        ...

class IPCBufferDescriptor:
    """Serializable object describing a buffer that can be shared between processes.

    Note
    ----
    The payload and ``size`` fields are controlled by the exporting peer.
    Receivers must treat them as untrusted and import only through
    :meth:`Buffer.from_ipc_descriptor`.
    """

    def __init__(self, *arg, **kwargs) -> None:
        ...

    @staticmethod
    def _init(reserved: bytes, size: int) -> IPCBufferDescriptor:
        ...

    def __reduce__(self) -> tuple[object, ...]:
        ...

    @property
    def size(self) -> int:
        ...

class IPCAllocationHandle:
    """Shareable handle to an IPC-enabled device memory pool."""

    def close(self):
        """Close the handle."""

    def __init__(self, *arg, **kwargs) -> None:
        ...

    @classmethod
    def _init(cls, handle: int, uuid: uuid.UUID | None) -> IPCAllocationHandle:
        ...

    def __int__(self) -> int:
        ...

    @property
    def handle(self) -> int:
        ...

    @property
    def uuid(self) -> uuid.UUID:
        ...
__all__ = ['IPCBufferDescriptor', 'IPCAllocationHandle']

def _reduce_allocation_handle(alloc_handle: IPCAllocationHandle) -> tuple[object, ...]:
    ...

def _reconstruct_allocation_handle(cls: type, df: object, uuid: uuid.UUID | None) -> IPCAllocationHandle:
    ...