AGENTS.md
src/core/client_channel/AGENTS.mdAGENTS.md
Quality
48/100
Scores the file, not the repository.Length
813 words
8 headings · 0 code blocksRepository
45k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# gRPC Client Channel23This directory contains the core implementation of the client-side channel in gRPC. It's responsible for managing the entire lifecycle of a connection from a client to a server, including name resolution, load balancing, and connectivity.45## Overarching Purpose67The code in this directory provides the building blocks for creating and managing client-side channels. It orchestrates the process of turning a target URI into a set of connections to backend servers, and then distributing RPCs across those connections.89## Core Concepts1011The client channel is built around a few key abstractions:1213* **`ClientChannel`**: The top-level object that represents a connection to a service. It owns the other components and is responsible for orchestrating the overall process of name resolution, load balancing, and connection management.14* **`Subchannel`**: A `Subchannel` represents a connection to a single backend address. A `ClientChannel` typically manages multiple `Subchannel`s, one for each address returned by the resolver.15* **`Resolver`**: The `Resolver` is responsible for taking a target URI (e.g., "dns:///my-service.example.com") and resolving it to a list of backend addresses. See the [resolver documentation](../resolver/AGENTS.md) for more details.16* **`LoadBalancingPolicy`**: The `LoadBalancingPolicy` is responsible for taking the list of subchannels from the `ClientChannel` and deciding which one to use for each RPC. See the [load balancing documentation](../load_balancing/AGENTS.md) for more details.1718## Legacy Architecture1920The original architecture of the client channel relied heavily on callback-based filters. This approach is still present in some parts of the code, but is being actively migrated to a more modern, promise-based model.2122* **`retry_filter.h`, `retry_filter.cc`**: Implements a channel filter that provides automatic retries for failed RPCs, based on the service config. This is an example of a "dynamic filter", which can be configured on a per-service or per-method basis.23* **`dynamic_filters.h`, `dynamic_filters.cc`**: These files provide the framework for creating and managing dynamic filters.2425## Modern Architecture2627The newer architecture of the client channel is based on promise-based interceptors. This approach is more flexible and easier to reason about, and is the preferred way to implement new features.2829* **`retry_interceptor.h`, `retry_interceptor.cc`**: Implements an interceptor that provides automatic retries for failed RPCs, based on the service config. This is the modern, promise-based replacement for `retry_filter`.3031## Files3233* **`client_channel.h`, `client_channel.cc`**: These files contain the main `ClientChannel` class, which is the primary implementation of the `grpc::Channel` interface for clients. It manages the entire lifecycle of a client-side channel.34* **`subchannel.h`, `subchannel.cc`**: These files define the `Subchannel` class, which represents a connection to a single backend address.35* **`client_channel_factory.h`, `client_channel_factory.cc`**: These files define the `ClientChannelFactory`, which is responsible for creating `ClientChannel` and `Subchannel` instances.36* **`connector.h`**: Defines the `Connector` interface, which is responsible for establishing a transport-level connection to a given address.37* **`load_balanced_call_destination.h`, `load_balanced_call_destination.cc`**: Defines the `LoadBalancedCallDestination`, which is a call destination that uses a `LoadBalancingPolicy` to select a subchannel for each call.38* **`retry_filter.h`, `retry_filter.cc`**: Implements a channel filter that provides automatic retries for failed RPCs, based on the service config. This is an example of a "dynamic filter", which can be configured on a per-service or per-method basis.39* **`retry_interceptor.h`, `retry_interceptor.cc`**: Implements an interceptor that provides automatic retries for failed RPCs, based on the service config.40* **`config_selector.h`**: Defines the `ConfigSelector` class, which is used to select the appropriate service config for a given RPC.41* **`subchannel_pool_interface.h`, `subchannel_pool_interface.cc`**: Defines the interface for a subchannel pool, which is used to cache and reuse subchannels.42* **`global_subchannel_pool.h`, `global_subchannel_pool.cc`**: Implements a global subchannel pool that can be shared across multiple channels.4344## Major Classes4546* **`grpc_core::ClientChannel`**: The main client-side channel implementation. It integrates the [resolver](../resolver/AGENTS.md), [load balancing policy](../load_balancing/AGENTS.md), and subchannels to provide a unified view of a connection to a service.47* **`grpc_core::Subchannel`**: Represents a single connection to a backend. It manages the connectivity state of that connection and provides a mechanism for creating transports.48* **`grpc_core::ClientChannelFactory`**: A factory class for creating client channels and subchannels.49* **`grpc_core::Connector`**: An interface for creating a transport-level connection.5051## Notes5253* The client channel is a complex piece of machinery that coordinates several different components. Understanding the roles of the [resolver](../resolver/AGENTS.md), [load balancing policy](../load_balancing/AGENTS.md), and subchannels is key to understanding how it works.54* Much of the client channel is being migrated to a new, promise-based architecture. As a result, you will see a mix of legacy callback-based code and newer promise-based code. The `retry_filter.h` and `retry_interceptor.h` files are a good example of this transition, where the former is the legacy implementation and the latter is the new promise-based one.55* The `dynamic_filters` are a legacy mechanism for adding filters to the channel. They are being replaced by the more flexible interceptor model.56* The `ClientChannel` uses a `WorkSerializer` to ensure that all of its internal state is accessed in a thread-safe manner.57* The `ConfigSelector` allows for different service configs to be used for different RPCs on the same channel. This is used to support features like per-method retry policies.58
Also in grpc/grpc
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| grpc/grpcsrc/core/ext/filters/census/AGENTS.md · 45k | AGENTS.md | no sections | 25/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/gcp_authentication/AGENTS.md · 45k | AGENTS.md | security | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/http/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/stateful_session/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/transport/chaotic_good/AGENTS.md · 45k | AGENTS.md | no sections | 48/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/transport/inproc/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/filter/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/handshaker/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/server/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/service_config/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/telemetry/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/transport/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/credentials/transport/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/backend_metrics/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/credentials/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/tsi/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/tsi/alts/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/credentials/call/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/transport/chttp2/AGENTS.md · 45k | AGENTS.md | testarchdependencies | 48/100 | 3 days ago | |
| grpc/grpcAGENTS.md · 45k | AGENTS.md | styledependenciesdo-not | 54/100 | 3 days ago |
Diff against src/core/ext/filters/census/AGENTS.md Diff against src/core/ext/filters/gcp_authentication/AGENTS.md Diff against src/core/ext/filters/http/AGENTS.md Diff against src/core/ext/filters/stateful_session/AGENTS.md Diff against src/core/ext/transport/chaotic_good/AGENTS.md Diff against src/core/ext/transport/inproc/AGENTS.md Diff against src/core/filter/AGENTS.md Diff against src/core/handshaker/AGENTS.md Diff against src/core/server/AGENTS.md Diff against src/core/service_config/AGENTS.md Diff against src/core/telemetry/AGENTS.md Diff against src/core/transport/AGENTS.md Diff against src/core/credentials/transport/AGENTS.md Diff against src/core/ext/filters/backend_metrics/AGENTS.md Diff against src/core/credentials/AGENTS.md Diff against src/core/tsi/AGENTS.md Diff against src/core/tsi/alts/AGENTS.md Diff against src/core/credentials/call/AGENTS.md Diff against src/core/ext/transport/chttp2/AGENTS.md Diff against AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| vllm-project/vllmAGENTS.md · 88k | AGENTS.md | setuptestlint-formatstyle+5 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| react/react-nativepackages/react-native-compatibility-check/AGENTS.md · 126k | AGENTS.md | testlint-formatstylearch+4 | 99/100 | 3 days ago | |
| netdata/netdatasrc/go/plugin/ibm.d/AGENTS.md · 80k | AGENTS.md | buildtestlint-formatarch+3 | 99/100 | 3 days ago | |
| dragonflydb/dragonflyAGENTS.md · 31k | AGENTS.md | setupbuildtestlint-format+10 | 96/100 | 2 days ago | |
| dotnet/aspnetcoresrc/Components/AGENTS.md · 38k | AGENTS.md | buildteststylearch+3 | 96/100 | 3 days ago | |
| duckdb/duckdbAGENTS.md · 40k | AGENTS.md | buildtestlint-formatstyle+8 | 96/100 | today | |
| steipete/CodexBarAGENTS.md · 20k | AGENTS.md | buildteststylearch+4 | 93/100 | 3 days ago |
