#include <slice_buffer.h>
Public Member Functions | |
void | Append (Slice slice) |
size_t | AppendIndexed (Slice slice) |
grpc_slice_buffer * | c_slice_buffer () |
Return a pointer to the back raw grpc_slice_buffer. More... | |
void | Clear () |
Removes and unrefs all slices in the SliceBuffer. More... | |
size_t | Count () |
Returns the number of slices held by the SliceBuffer. More... | |
size_t | Length () |
The total number of bytes held by the SliceBuffer. More... | |
void | MoveFirstNBytesIntoBuffer (size_t n, void *dst) |
Move the first n bytes of the SliceBuffer into a memory pointed to by dst. More... | |
SliceBuffer & | operator= (const SliceBuffer &)=delete |
SliceBuffer & | operator= (SliceBuffer &&other) noexcept |
void | Prepend (Slice slice) |
Prepends the slice to the the front of the SliceBuffer. More... | |
Slice | RefSlice (size_t index) |
void | RemoveLastNBytes (size_t n) |
Removes/deletes the last n bytes in the SliceBuffer. More... | |
SliceBuffer () | |
SliceBuffer (const SliceBuffer &other)=delete | |
SliceBuffer (SliceBuffer &&other) noexcept | |
Slice | TakeFirst () |
Removes the first slice in the SliceBuffer and returns it. More... | |
~SliceBuffer () | |
Private Attributes | |
grpc_slice_buffer | slice_buffer_ |
The backing raw slice buffer. More... | |
A Wrapper around grpc_slice_buffer pointer.
A slice buffer holds the memory for a collection of slices. The SliceBuffer object itself is meant to only hide the C-style API, and won't hold the data itself. In terms of lifespan, the grpc_slice_buffer ought to be kept somewhere inside the caller's objects, like a transport or an endpoint.
This lifespan rule is likely to change in the future, as we may collapse the grpc_slice_buffer structure straight into this class.
The SliceBuffer API is basically a replica of the grpc_slice_buffer's, and its documentation will move here once we remove the C structure, which should happen before the Event Engine's API is no longer an experimental API.
Definition at line 51 of file include/grpc/event_engine/slice_buffer.h.
|
inlineexplicit |
Definition at line 53 of file include/grpc/event_engine/slice_buffer.h.
|
delete |
|
inlinenoexcept |
Definition at line 55 of file include/grpc/event_engine/slice_buffer.h.
|
inline |
Upon destruction, the underlying raw slice buffer is cleaned out and all slices are unreffed.
Definition at line 62 of file include/grpc/event_engine/slice_buffer.h.
void grpc_event_engine::experimental::SliceBuffer::Append | ( | Slice | slice | ) |
Appends a new slice into the SliceBuffer and makes an attempt to merge this slice with the last slice in the SliceBuffer.
Definition at line 29 of file event_engine/slice_buffer.cc.
size_t grpc_event_engine::experimental::SliceBuffer::AppendIndexed | ( | Slice | slice | ) |
Adds a new slice into the SliceBuffer at the next available index. Returns the index at which the new slice is added.
Definition at line 33 of file event_engine/slice_buffer.cc.
|
inline |
Return a pointer to the back raw grpc_slice_buffer.
Definition at line 108 of file include/grpc/event_engine/slice_buffer.h.
|
inline |
Removes and unrefs all slices in the SliceBuffer.
Definition at line 92 of file include/grpc/event_engine/slice_buffer.h.
|
inline |
Returns the number of slices held by the SliceBuffer.
Definition at line 79 of file include/grpc/event_engine/slice_buffer.h.
|
inline |
The total number of bytes held by the SliceBuffer.
Definition at line 105 of file include/grpc/event_engine/slice_buffer.h.
|
inline |
Move the first n bytes of the SliceBuffer into a memory pointed to by dst.
Definition at line 87 of file include/grpc/event_engine/slice_buffer.h.
|
delete |
|
inlinenoexcept |
Definition at line 65 of file include/grpc/event_engine/slice_buffer.h.
void grpc_event_engine::experimental::SliceBuffer::Prepend | ( | Slice | slice | ) |
Prepends the slice to the the front of the SliceBuffer.
Definition at line 41 of file event_engine/slice_buffer.cc.
Slice grpc_event_engine::experimental::SliceBuffer::RefSlice | ( | size_t | index | ) |
Increased the ref-count of slice at the specified index and returns the associated slice.
Definition at line 45 of file event_engine/slice_buffer.cc.
|
inline |
Removes/deletes the last n bytes in the SliceBuffer.
Definition at line 82 of file include/grpc/event_engine/slice_buffer.h.
Slice grpc_event_engine::experimental::SliceBuffer::TakeFirst | ( | ) |
Removes the first slice in the SliceBuffer and returns it.
Definition at line 37 of file event_engine/slice_buffer.cc.
|
private |
The backing raw slice buffer.
Definition at line 112 of file include/grpc/event_engine/slice_buffer.h.