Functions
byte_buffer_reader.cc File Reference
#include <grpc/support/port_platform.h>
#include <stdint.h>
#include <string.h>
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_refcount.h"
Include dependency graph for byte_buffer_reader.cc:

Go to the source code of this file.

Functions

void grpc_byte_buffer_reader_destroy (grpc_byte_buffer_reader *reader)
 
int grpc_byte_buffer_reader_init (grpc_byte_buffer_reader *reader, grpc_byte_buffer *buffer)
 
int grpc_byte_buffer_reader_next (grpc_byte_buffer_reader *reader, grpc_slice *slice)
 
int grpc_byte_buffer_reader_peek (grpc_byte_buffer_reader *reader, grpc_slice **slice)
 
grpc_slice grpc_byte_buffer_reader_readall (grpc_byte_buffer_reader *reader)
 

Function Documentation

◆ grpc_byte_buffer_reader_destroy()

void grpc_byte_buffer_reader_destroy ( grpc_byte_buffer_reader reader)

Cleanup and destroy reader

Definition at line 45 of file byte_buffer_reader.cc.

◆ grpc_byte_buffer_reader_init()

int grpc_byte_buffer_reader_init ( grpc_byte_buffer_reader reader,
grpc_byte_buffer buffer 
)

Initialize reader to read over buffer. Returns 1 upon success, 0 otherwise.

Definition at line 33 of file byte_buffer_reader.cc.

◆ grpc_byte_buffer_reader_next()

int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader reader,
grpc_slice slice 
)

Updates slice with the next piece of data from from reader and returns

  1. Returns 0 at the end of the stream. Caller is responsible for calling grpc_slice_unref on the result.

Definition at line 66 of file byte_buffer_reader.cc.

◆ grpc_byte_buffer_reader_peek()

int grpc_byte_buffer_reader_peek ( grpc_byte_buffer_reader reader,
grpc_slice **  slice 
)

EXPERIMENTAL API - This function may be removed and changed, in the future.

Updates slice with the next piece of data from from reader and returns

  1. Returns 0 at the end of the stream. Caller is responsible for making sure the slice pointer remains valid when accessed.

NOTE: Do not use this function unless the caller can guarantee that the underlying grpc_byte_buffer outlasts the use of the slice. This is only safe when the underlying grpc_byte_buffer remains immutable while slice is being accessed.

Definition at line 49 of file byte_buffer_reader.cc.

◆ grpc_byte_buffer_reader_readall()

grpc_slice grpc_byte_buffer_reader_readall ( grpc_byte_buffer_reader reader)

Merge all data from reader into single slice

Definition at line 84 of file byte_buffer_reader.cc.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:05