#include <proto_buffer_reader.h>
Public Member Functions | |
void | BackUp (int count) override |
int64_t | ByteCount () const override |
Returns the total number of bytes read since this object was created. More... | |
bool | Next (const void **data, int *size) override |
ProtoBufferReader (ByteBuffer *buffer) | |
bool | Skip (int count) override |
Status | status () const |
Returns the status of the buffer reader. More... | |
~ProtoBufferReader () override | |
Protected Member Functions | |
int64_t | backup_count () |
grpc_slice ** | mutable_slice_ptr () |
grpc_byte_buffer_reader * | reader () |
void | set_backup_count (int64_t backup_count) |
void | set_byte_count (int64_t byte_count) |
grpc_slice * | slice () |
Private Attributes | |
int64_t | backup_count_ |
how far backed up in the stream we are More... | |
int64_t | byte_count_ |
total bytes read since object creation More... | |
grpc_byte_buffer_reader | reader_ |
grpc_slice * | slice_ |
current slice passed back to the caller More... | |
Status | status_ |
status of the entire object More... | |
This is a specialization of the protobuf class ZeroCopyInputStream The principle is to get one chunk of data at a time from the proto layer, with options to backup (re-see some bytes) or skip (forward past some bytes)
Read more about ZeroCopyInputStream interface here: https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyInputStream
Definition at line 48 of file impl/codegen/proto_buffer_reader.h.
|
inlineexplicit |
Constructs buffer reader from buffer. Will set status() to non ok if buffer is invalid (the internal buffer has not been initialized).
Implemented through a grpc_byte_buffer_reader which iterates over the slices that make up a byte buffer
Definition at line 52 of file impl/codegen/proto_buffer_reader.h.
|
inlineoverride |
Definition at line 64 of file impl/codegen/proto_buffer_reader.h.
|
inlineoverride |
The proto library calls this to indicate that we should back up count bytes that have already been returned by the last call of Next. So do the backup and have that ready for a later Next.
Definition at line 103 of file impl/codegen/proto_buffer_reader.h.
|
inlineprotected |
Definition at line 134 of file impl/codegen/proto_buffer_reader.h.
|
inlineoverride |
Returns the total number of bytes read since this object was created.
Definition at line 126 of file impl/codegen/proto_buffer_reader.h.
|
inlineprotected |
Definition at line 138 of file impl/codegen/proto_buffer_reader.h.
Give the proto library a chunk of data from the stream. The caller may safely read from data[0, size - 1].
If we have backed up previously, we need to return the backed-up slice
Otherwise get the next slice from the byte buffer reader
Definition at line 72 of file impl/codegen/proto_buffer_reader.h.
|
inlineprotected |
Definition at line 136 of file impl/codegen/proto_buffer_reader.h.
|
inlineprotected |
Definition at line 135 of file impl/codegen/proto_buffer_reader.h.
|
inlineprotected |
Definition at line 133 of file impl/codegen/proto_buffer_reader.h.
The proto library calls this to skip over count bytes. Implement this using Next and BackUp combined.
Definition at line 110 of file impl/codegen/proto_buffer_reader.h.
|
inlineprotected |
Definition at line 137 of file impl/codegen/proto_buffer_reader.h.
|
inline |
Returns the status of the buffer reader.
Definition at line 98 of file impl/codegen/proto_buffer_reader.h.
|
private |
how far backed up in the stream we are
Definition at line 142 of file impl/codegen/proto_buffer_reader.h.
|
private |
total bytes read since object creation
Definition at line 141 of file impl/codegen/proto_buffer_reader.h.
|
private |
internal object to read grpc_slice from the grpc_byte_buffer
Definition at line 143 of file impl/codegen/proto_buffer_reader.h.
|
private |
current slice passed back to the caller
Definition at line 145 of file impl/codegen/proto_buffer_reader.h.
|
private |
status of the entire object
Definition at line 146 of file impl/codegen/proto_buffer_reader.h.