GRPC C++  1.39.1
Public Types | Public Member Functions
grpc_event_engine::experimental::SliceAllocator Class Reference

#include <slice_allocator.h>

Public Types

using AllocateCallback = std::function< void(absl::Status, SliceBuffer *buffer)>
 

Public Member Functions

 SliceAllocator (grpc_resource_user *user)
 
 SliceAllocator (SliceAllocator &other)=delete
 
SliceAllocatoroperator= (const SliceAllocator &other)=delete
 
 SliceAllocator (SliceAllocator &&other) noexcept
 
SliceAllocatoroperator= (SliceAllocator &&other) noexcept
 
 ~SliceAllocator ()
 
absl::Status Allocate (size_t size, SliceBuffer *dest, SliceAllocator::AllocateCallback cb)
 Requests size bytes from gRPC, and populates dest with the allocated slices. More...
 

Member Typedef Documentation

◆ AllocateCallback

using grpc_event_engine::experimental::SliceAllocator::AllocateCallback = std::function<void(absl::Status, SliceBuffer* buffer)>

Constructor & Destructor Documentation

◆ SliceAllocator() [1/3]

grpc_event_engine::experimental::SliceAllocator::SliceAllocator ( grpc_resource_user *  user)
explicit

◆ SliceAllocator() [2/3]

grpc_event_engine::experimental::SliceAllocator::SliceAllocator ( SliceAllocator other)
delete

◆ SliceAllocator() [3/3]

grpc_event_engine::experimental::SliceAllocator::SliceAllocator ( SliceAllocator &&  other)
noexcept

◆ ~SliceAllocator()

grpc_event_engine::experimental::SliceAllocator::~SliceAllocator ( )

Member Function Documentation

◆ Allocate()

absl::Status grpc_event_engine::experimental::SliceAllocator::Allocate ( size_t  size,
SliceBuffer dest,
SliceAllocator::AllocateCallback  cb 
)

Requests size bytes from gRPC, and populates dest with the allocated slices.

Ownership of the SliceBuffer is not transferred.

gRPC provides a ResourceQuota system to cap the amount of memory used by the library. When a memory limit has been reached, slice allocation is interrupted to attempt to reclaim memory from participating gRPC internals. When there is sufficient memory available, slice allocation proceeds as normal.

◆ operator=() [1/2]

SliceAllocator& grpc_event_engine::experimental::SliceAllocator::operator= ( const SliceAllocator other)
delete

◆ operator=() [2/2]

SliceAllocator& grpc_event_engine::experimental::SliceAllocator::operator= ( SliceAllocator &&  other)
noexcept

The documentation for this class was generated from the following file: