GRPC C++  1.39.1
Data Structures | Macros | Typedefs | Functions
metadata_batch.h File Reference
#include <grpc/support/port_platform.h>
#include <stdbool.h>
#include "absl/types/optional.h"
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/time.h>
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/static_metadata.h"

Go to the source code of this file.

Data Structures

struct  grpc_linked_mdelem
 
struct  grpc_mdelem_list
 
struct  grpc_metadata_batch
 
struct  grpc_filtered_mdelem
 

Macros

#define GRPC_FILTERED_ERROR(error)    { (error), GRPC_MDNULL }
 
#define GRPC_FILTERED_MDELEM(md)    { GRPC_ERROR_NONE, (md) }
 
#define GRPC_FILTERED_REMOVE()    { GRPC_ERROR_NONE, GRPC_MDNULL }
 

Typedefs

typedef struct grpc_linked_mdelem grpc_linked_mdelem
 
typedef struct grpc_mdelem_list grpc_mdelem_list
 
typedef struct grpc_metadata_batch grpc_metadata_batch
 
typedef grpc_filtered_mdelem(* grpc_metadata_batch_filter_func) (void *user_data, grpc_mdelem elem)
 

Functions

void grpc_metadata_batch_init (grpc_metadata_batch *batch)
 
void grpc_metadata_batch_destroy (grpc_metadata_batch *batch)
 
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)
 
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)
 
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_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_link_head (grpc_metadata_batch *batch, grpc_linked_mdelem *storage) GRPC_MUST_USE_RESULT
 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_MUST_USE_RESULT
 
grpc_error_handle grpc_metadata_batch_link_tail (grpc_metadata_batch *batch, grpc_linked_mdelem *storage) GRPC_MUST_USE_RESULT
 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) GRPC_MUST_USE_RESULT
 
grpc_error_handle grpc_metadata_batch_add_head (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT
 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_MUST_USE_RESULT grpc_metadata_batch_add_head (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_metadata_batch_callouts_index idx)
 
grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_mdelem elem_to_add, 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) GRPC_MUST_USE_RESULT
 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_MUST_USE_RESULT grpc_metadata_batch_add_tail (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_metadata_batch_callouts_index idx)
 
grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail (grpc_metadata_batch *batch, grpc_linked_mdelem *storage, grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx)
 
grpc_error_handle grpc_attach_md_to_error (grpc_error_handle src, grpc_mdelem md)
 
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_MUST_USE_RESULT
 
void grpc_metadata_batch_assert_ok (grpc_metadata_batch *batch)
 
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)
 

Macro Definition Documentation

◆ GRPC_FILTERED_ERROR

#define GRPC_FILTERED_ERROR (   error)     { (error), GRPC_MDNULL }

◆ GRPC_FILTERED_MDELEM

#define GRPC_FILTERED_MDELEM (   md)     { GRPC_ERROR_NONE, (md) }

◆ GRPC_FILTERED_REMOVE

#define GRPC_FILTERED_REMOVE ( )     { GRPC_ERROR_NONE, GRPC_MDNULL }

Typedef Documentation

◆ grpc_linked_mdelem

◆ grpc_mdelem_list

◆ grpc_metadata_batch

◆ grpc_metadata_batch_filter_func

typedef grpc_filtered_mdelem(* grpc_metadata_batch_filter_func) (void *user_data, grpc_mdelem elem)

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() [1/3]

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_head() [2/3]

grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_mdelem  elem_to_add,
grpc_metadata_batch_callouts_index  idx 
)
inline

◆ grpc_metadata_batch_add_head() [3/3]

grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_metadata_batch_callouts_index  idx 
)
inline

◆ grpc_metadata_batch_add_tail() [1/3]

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_add_tail() [2/3]

grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_mdelem  elem_to_add,
grpc_metadata_batch_callouts_index  idx 
)
inline

◆ grpc_metadata_batch_add_tail() [3/3]

grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail ( grpc_metadata_batch batch,
grpc_linked_mdelem storage,
grpc_metadata_batch_callouts_index  idx 
)
inline

◆ 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.