GRPC Core  18.0.0
Functions
metadata_batch.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/lib/transport/metadata_batch.h"
#include <stdbool.h>
#include <string.h>
#include "absl/container/inlined_vector.h"
#include "absl/strings/str_join.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"

Functions

void grpc_metadata_batch_assert_ok (grpc_metadata_batch *batch)
 
void grpc_metadata_batch_init (grpc_metadata_batch *batch)
 
void grpc_metadata_batch_destroy (grpc_metadata_batch *batch)
 
grpc_error_handle grpc_attach_md_to_error (grpc_error_handle src, grpc_mdelem md)
 
grpc_error_handle grpc_metadata_batch_add_head (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_mdelem elem_to_add)
 Add elem_to_add as the first element in batch, using storage as backing storage for the linked list element. More...
 
grpc_error_handle grpc_metadata_batch_link_head (grpc_metadata_batch *batch, grpc_linked_mdelem *storage)
 Add storage to the beginning of batch. More...
 
grpc_error_handle grpc_metadata_batch_link_head (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_metadata_batch_callouts_index idx)
 
grpc_error_handle grpc_metadata_batch_add_tail (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_mdelem elem_to_add)
 Add elem_to_add as the last element in batch, using storage as backing storage for the linked list element. More...
 
grpc_error_handle grpc_metadata_batch_link_tail (grpc_metadata_batch *batch, grpc_linked_mdelem *storage)
 Add storage to the end of batch. More...
 
grpc_error_handle grpc_metadata_batch_link_tail (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_metadata_batch_callouts_index idx)
 
void grpc_metadata_batch_remove (grpc_metadata_batch *batch, grpc_linked_mdelem *storage)
 Remove storage from the batch, unreffing the mdelem contained. More...
 
void grpc_metadata_batch_remove (grpc_metadata_batch *batch, grpc_metadata_batch_callouts_index idx)
 
void grpc_metadata_batch_set_value (grpc_linked_mdelem *storage, const grpc_slice &value)
 
absl::optional< absl::string_view > grpc_metadata_batch_get_value (grpc_metadata_batch *batch, absl::string_view target_key, std::string *concatenated_value)
 Returns metadata value(s) for the specified key. More...
 
grpc_error_handle grpc_metadata_batch_substitute (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_mdelem new_mdelem)
 Substitute a new mdelem for an old value. More...
 
void grpc_metadata_batch_clear (grpc_metadata_batch *batch)
 
bool grpc_metadata_batch_is_empty (grpc_metadata_batch *batch)
 
size_t grpc_metadata_batch_size (grpc_metadata_batch *batch)
 
grpc_error_handle grpc_metadata_batch_filter (grpc_metadata_batch *batch, grpc_metadata_batch_filter_func func, void *user_data, const char *composite_error_string)
 
void grpc_metadata_batch_copy (grpc_metadata_batch *src, grpc_metadata_batch *dst, grpc_linked_mdelem *storage)
 Copies src to dst. More...
 
void grpc_metadata_batch_move (grpc_metadata_batch *src, grpc_metadata_batch *dst)
 

Function Documentation

◆ grpc_attach_md_to_error()

grpc_error_handle grpc_attach_md_to_error ( grpc_error_handle  src,
grpc_mdelem  md 
)

◆ grpc_metadata_batch_add_head()

grpc_error_handle grpc_metadata_batch_add_head ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_mdelem  elem_to_add 
)

Add elem_to_add as the first element in batch, using storage as backing storage for the linked list element.

storage is owned by the caller and must survive for the lifetime of batch. This usually means it should be around for the lifetime of the call. Takes ownership of elem_to_add

◆ grpc_metadata_batch_add_tail()

grpc_error_handle grpc_metadata_batch_add_tail ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_mdelem  elem_to_add 
)

Add elem_to_add as the last element in batch, using storage as backing storage for the linked list element.

storage is owned by the caller and must survive for the lifetime of batch. This usually means it should be around for the lifetime of the call. Takes ownership of elem_to_add

◆ grpc_metadata_batch_assert_ok()

void grpc_metadata_batch_assert_ok ( grpc_metadata_batch batch)

◆ grpc_metadata_batch_clear()

void grpc_metadata_batch_clear ( grpc_metadata_batch batch)

◆ grpc_metadata_batch_copy()

void grpc_metadata_batch_copy ( grpc_metadata_batch src,
grpc_metadata_batch dst,
grpc_linked_mdelem storage 
)

Copies src to dst.

storage must point to an array of grpc_linked_mdelem structs of at least the same size as src.

◆ grpc_metadata_batch_destroy()

void grpc_metadata_batch_destroy ( grpc_metadata_batch batch)

◆ grpc_metadata_batch_filter()

grpc_error_handle grpc_metadata_batch_filter ( grpc_metadata_batch batch,
grpc_metadata_batch_filter_func  func,
void *  user_data,
const char *  composite_error_string 
)

◆ grpc_metadata_batch_get_value()

absl::optional<absl::string_view> grpc_metadata_batch_get_value ( grpc_metadata_batch batch,
absl::string_view  target_key,
std::string *  concatenated_value 
)

Returns metadata value(s) for the specified key.

If the key is not present in the batch, returns absl::nullopt. If the key is present exactly once in the batch, returns a string_view of that value. If the key is present more than once in the batch, constructs a comma-concatenated string of all values in concatenated_value and returns a string_view of that string.

◆ grpc_metadata_batch_init()

void grpc_metadata_batch_init ( grpc_metadata_batch batch)

◆ grpc_metadata_batch_is_empty()

bool grpc_metadata_batch_is_empty ( grpc_metadata_batch batch)

◆ grpc_metadata_batch_link_head() [1/2]

grpc_error_handle grpc_metadata_batch_link_head ( grpc_metadata_batch batch,
grpc_linked_mdelem storage 
)

Add storage to the beginning of batch.

storage->md is assumed to be valid. storage is owned by the caller and must survive for the lifetime of batch. This usually means it should be around for the lifetime of the call.

◆ grpc_metadata_batch_link_head() [2/2]

grpc_error_handle grpc_metadata_batch_link_head ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_metadata_batch_callouts_index  idx 
)

◆ grpc_metadata_batch_link_tail() [1/2]

grpc_error_handle grpc_metadata_batch_link_tail ( grpc_metadata_batch batch,
grpc_linked_mdelem storage 
)

Add storage to the end of batch.

storage->md is assumed to be valid. storage is owned by the caller and must survive for the lifetime of batch. This usually means it should be around for the lifetime of the call.

◆ grpc_metadata_batch_link_tail() [2/2]

grpc_error_handle grpc_metadata_batch_link_tail ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_metadata_batch_callouts_index  idx 
)

◆ grpc_metadata_batch_move()

void grpc_metadata_batch_move ( grpc_metadata_batch src,
grpc_metadata_batch dst 
)

◆ grpc_metadata_batch_remove() [1/2]

void grpc_metadata_batch_remove ( grpc_metadata_batch batch,
grpc_linked_mdelem storage 
)

Remove storage from the batch, unreffing the mdelem contained.

◆ grpc_metadata_batch_remove() [2/2]

void grpc_metadata_batch_remove ( grpc_metadata_batch batch,
grpc_metadata_batch_callouts_index  idx 
)

◆ grpc_metadata_batch_set_value()

void grpc_metadata_batch_set_value ( grpc_linked_mdelem storage,
const grpc_slice value 
)

◆ grpc_metadata_batch_size()

size_t grpc_metadata_batch_size ( grpc_metadata_batch batch)

◆ grpc_metadata_batch_substitute()

grpc_error_handle grpc_metadata_batch_substitute ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_mdelem  new_mdelem 
)

Substitute a new mdelem for an old value.