GRPC Core  9.0.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
grpc_core::ServiceConfig Class Reference

#include <service_config.h>

Data Structures

class  CallData
 When a service config is applied to a call in the client_channel_filter, we create an instance of this object and store it in the call_data for client_channel. More...
 
class  ParsedConfig
 This is the base class that all service config parsers MUST use to store parsed service config data. More...
 
class  Parser
 This is the base class that all service config parsers should derive from. More...
 

Public Types

typedef InlinedVector< std::unique_ptr< ParsedConfig >, kNumPreallocatedParsersParsedConfigVector
 

Public Member Functions

 ServiceConfig (grpc_core::UniquePtr< char > service_config_json, grpc_core::UniquePtr< char > json_string, grpc_json *json_tree, grpc_error **error)
 
 ~ServiceConfig ()
 
const char * service_config_json () const
 
ParsedConfigGetGlobalParsedConfig (size_t index)
 Retrieves the global parsed config at index index. More...
 
const ParsedConfigVectorGetMethodParsedConfigVector (const grpc_slice &path)
 Retrieves the vector of parsed configs for the method identified by path. More...
 
- Public Member Functions inherited from grpc_core::RefCounted< ServiceConfig >
 ~RefCounted ()=default
 
RefCountedPtr< ServiceConfigRef () GRPC_MUST_USE_RESULT
 
RefCountedPtr< ServiceConfigRef (const DebugLocation &location, const char *reason) GRPC_MUST_USE_RESULT
 
void Unref ()
 
void Unref (const DebugLocation &location, const char *reason)
 
bool RefIfNonZero ()
 
bool RefIfNonZero (const DebugLocation &location, const char *reason)
 
 RefCounted (const RefCounted &)=delete
 
RefCountedoperator= (const RefCounted &)=delete
 
- Public Member Functions inherited from grpc_core::PolymorphicRefCount
virtual ~PolymorphicRefCount ()=default
 

Static Public Member Functions

static RefCountedPtr< ServiceConfigCreate (const char *json, grpc_error **error)
 Creates a new service config from parsing json_string. More...
 
static size_t RegisterParser (std::unique_ptr< Parser > parser)
 Globally register a service config parser. More...
 
static void Init ()
 
static void Shutdown ()
 

Static Public Attributes

static constexpr int kNumPreallocatedParsers = 4
 

Additional Inherited Members

- Protected Member Functions inherited from grpc_core::RefCounted< ServiceConfig >
 RefCounted (TraceFlagT *trace_flag=nullptr, intptr_t initial_refcount=1)
 

Member Typedef Documentation

◆ ParsedConfigVector

Constructor & Destructor Documentation

◆ ServiceConfig()

grpc_core::ServiceConfig::ServiceConfig ( grpc_core::UniquePtr< char >  service_config_json,
grpc_core::UniquePtr< char >  json_string,
grpc_json json_tree,
grpc_error **  error 
)

◆ ~ServiceConfig()

grpc_core::ServiceConfig::~ServiceConfig ( )

Member Function Documentation

◆ Create()

RefCountedPtr< ServiceConfig > grpc_core::ServiceConfig::Create ( const char *  json,
grpc_error **  error 
)
static

Creates a new service config from parsing json_string.

Returns null on parse error.

◆ GetGlobalParsedConfig()

ParsedConfig* grpc_core::ServiceConfig::GetGlobalParsedConfig ( size_t  index)
inline

Retrieves the global parsed config at index index.

The lifetime of the returned object is tied to the lifetime of the ServiceConfig object.

◆ GetMethodParsedConfigVector()

const ServiceConfig::ParsedConfigVector * grpc_core::ServiceConfig::GetMethodParsedConfigVector ( const grpc_slice path)

Retrieves the vector of parsed configs for the method identified by path.

The lifetime of the returned vector and contained objects is tied to the lifetime of the ServiceConfig object.

◆ Init()

void grpc_core::ServiceConfig::Init ( )
static

◆ RegisterParser()

size_t grpc_core::ServiceConfig::RegisterParser ( std::unique_ptr< Parser parser)
static

Globally register a service config parser.

On successful registration, it returns the index at which the parser was registered. On failure, -1 is returned. Each new service config update will go through all the registered parser. Each parser is responsible for reading the service config json and returning a parsed config. This parsed config can later be retrieved using the same index that was returned at registration time.

◆ service_config_json()

const char* grpc_core::ServiceConfig::service_config_json ( ) const
inline

◆ Shutdown()

void grpc_core::ServiceConfig::Shutdown ( )
static

Field Documentation

◆ kNumPreallocatedParsers

constexpr int grpc_core::ServiceConfig::kNumPreallocatedParsers = 4
staticconstexpr

The documentation for this class was generated from the following files: