# azure/azure-sdk-for-rust architecture

> Architecture diagram of the GitHub repository azure/azure-sdk-for-rust, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azure/azure-sdk-for-rust
- Repository: https://github.com/azure/azure-sdk-for-rust

## Overview

The repository is the Azure SDK for Rust: service crates expose client APIs, with shared HTTP/runtime foundations beneath them. The tree and excerpts support a detailed Cosmos DB workflow—client operations, query/feed handling, driver execution, routing and transport—plus the shared HTTP layer and emulator. Some service-crate internals are not sampled, so the map focuses on supported paths and documented workspace structure; unsampled subsystem wiring is left out.

Main entry points: [`sdk/cosmos/azure_data_cosmos_driver/src/driver/pipeline/operation_pipeline.rs`](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/pipeline/operation_pipeline.rs) (Operation pipeline), [`sdk/cosmos/azure_data_cosmos/src/clients`](https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/clients) (Cosmos clients), [`sdk/cosmos/azure_data_cosmos_driver/src/driver/transport/transport_pipeline.rs`](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/transport/transport_pipeline.rs) (Transport pipeline), [`sdk/core/azure_core/src/http/pipeline.rs`](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/core/azure_core/src/http/pipeline.rs) (Core HTTP pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cosmos_api["Cosmos SDK API"]
  node_cosmos_clients["Cosmos clients"]
  node_query_feed["Queries and feeds"]
  node_cosmos_models["Cosmos models"]
  node_driver_bridge["Driver bridge<br/>[driver_bridge.rs]"]
end

subgraph group_cosmos_driver["Cosmos Driver"]
  node_operation_loop["Operation pipeline"]
  node_query_planner["Query planning<br/>[query_planning.rs]"]
  node_dataflow["Query dataflow<br/>[pipeline.rs]"]
  node_routing_sessions["Routing and sessions"]
  node_session_manager["Session management<br/>[session_manager.rs]"]
  node_transport_pipeline["Transport pipeline"]
  node_cosmos_diagnostics["Cosmos diagnostics"]
end

subgraph group_shared_core["Shared Core"]
  node_azure_core["Azure Core"]
  node_core_http["Core HTTP pipeline<br/>[pipeline.rs]"]
  node_typespec_http["TypeSpec HTTP<br/>[pipeline.rs]"]
end

subgraph group_cosmos_runtime["Cosmos Runtime"]
  node_cosmos_emulator["Cosmos emulator<br/>[main.rs]"]
end

node_application(("SDK application"))
node_cosmos_service{{"Azure Cosmos DB"}}

node_application -->|"uses clients"| node_cosmos_clients
node_cosmos_clients -->|"bridges operations"| node_driver_bridge
node_cosmos_clients -->|"exposes feeds"| node_query_feed
node_cosmos_clients -->|"uses models"| node_cosmos_models
node_driver_bridge -->|"dispatches operations"| node_operation_loop
node_query_feed -->|"defines queries"| node_query_planner
node_query_planner -->|"plans query"| node_dataflow
node_operation_loop -->|"resolves routing"| node_routing_sessions
node_operation_loop -->|"resolves sessions"| node_session_manager
node_operation_loop -->|"executes attempts"| node_transport_pipeline
node_transport_pipeline -->|"sends requests"| node_cosmos_service
node_operation_loop -->|"records diagnostics"| node_cosmos_diagnostics
node_azure_core -->|"provides pipeline"| node_core_http
node_transport_pipeline -->|"uses HTTP types"| node_core_http
node_core_http -->|"uses client core"| node_typespec_http
node_cosmos_emulator -.->|"emulates service"| node_cosmos_service

click node_cosmos_clients "https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/clients"
click node_query_feed "https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/feed"
click node_cosmos_models "https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/models"
click node_driver_bridge "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos/src/driver_bridge.rs"
click node_operation_loop "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/pipeline/operation_pipeline.rs"
click node_query_planner "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/cosmos_driver/query_planning.rs"
click node_dataflow "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/dataflow/pipeline.rs"
click node_routing_sessions "https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/routing"
click node_session_manager "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/routing/session_manager.rs"
click node_transport_pipeline "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/transport/transport_pipeline.rs"
click node_azure_core "https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/core/azure_core/src"
click node_core_http "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/core/azure_core/src/http/pipeline.rs"
click node_typespec_http "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/core/typespec_client_core/src/http/pipeline.rs"
click node_cosmos_diagnostics "https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/diagnostics"
click node_cosmos_emulator "https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_emulator/src/main.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cosmos_clients,node_query_feed,node_cosmos_models,node_driver_bridge toneBlue
class node_operation_loop,node_query_planner,node_dataflow,node_routing_sessions,node_session_manager,node_transport_pipeline,node_cosmos_diagnostics toneAmber
class node_azure_core,node_core_http,node_typespec_http toneMint
class node_cosmos_emulator toneRose
class node_application,node_cosmos_service toneIndigo
```

## Components

### Cosmos SDK API

- [Cosmos clients](https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/clients): `sdk/cosmos/azure_data_cosmos/src/clients`
- [Queries and feeds](https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/feed): `sdk/cosmos/azure_data_cosmos/src/feed`
- [Cosmos models](https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/models): `sdk/cosmos/azure_data_cosmos/src/models`
- [Driver bridge](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos/src/driver_bridge.rs): `sdk/cosmos/azure_data_cosmos/src/driver_bridge.rs`

### Cosmos Driver

- [Operation pipeline](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/pipeline/operation_pipeline.rs): `sdk/cosmos/azure_data_cosmos_driver/src/driver/pipeline/operation_pipeline.rs`
- [Query planning](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/cosmos_driver/query_planning.rs): `sdk/cosmos/azure_data_cosmos_driver/src/driver/cosmos_driver/query_planning.rs`
- [Query dataflow](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/dataflow/pipeline.rs): `sdk/cosmos/azure_data_cosmos_driver/src/driver/dataflow/pipeline.rs`
- [Routing and sessions](https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/routing): `sdk/cosmos/azure_data_cosmos_driver/src/driver/routing`
- [Session management](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/routing/session_manager.rs): `sdk/cosmos/azure_data_cosmos_driver/src/driver/routing/session_manager.rs`
- [Transport pipeline](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_driver/src/driver/transport/transport_pipeline.rs): `sdk/cosmos/azure_data_cosmos_driver/src/driver/transport/transport_pipeline.rs`
- [Cosmos diagnostics](https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/cosmos/azure_data_cosmos/src/diagnostics): `sdk/cosmos/azure_data_cosmos/src/diagnostics`

### Shared Core

- [Azure Core](https://github.com/azure/azure-sdk-for-rust/tree/main/sdk/core/azure_core/src): `sdk/core/azure_core/src`
- [Core HTTP pipeline](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/core/azure_core/src/http/pipeline.rs): `sdk/core/azure_core/src/http/pipeline.rs`
- [TypeSpec HTTP](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/core/typespec_client_core/src/http/pipeline.rs): `sdk/core/typespec_client_core/src/http/pipeline.rs`

### Cosmos Runtime

- [Cosmos emulator](https://github.com/azure/azure-sdk-for-rust/blob/main/sdk/cosmos/azure_data_cosmos_emulator/src/main.rs): `sdk/cosmos/azure_data_cosmos_emulator/src/main.rs`

### Other components

- **SDK application**
- **Azure Cosmos DB**

## Connections

- SDK application → Cosmos clients: uses clients
- Cosmos clients → Driver bridge: bridges operations
- Cosmos clients → Queries and feeds: exposes feeds
- Cosmos clients → Cosmos models: uses models
- Driver bridge → Operation pipeline: dispatches operations
- Queries and feeds → Query planning: defines queries
- Query planning → Query dataflow: plans query
- Operation pipeline → Routing and sessions: resolves routing
- Operation pipeline → Session management: resolves sessions
- Operation pipeline → Transport pipeline: executes attempts
- Transport pipeline → Azure Cosmos DB: sends requests
- Operation pipeline → Cosmos diagnostics: records diagnostics
- Azure Core → Core HTTP pipeline: provides pipeline
- Transport pipeline → Core HTTP pipeline: uses HTTP types
- Core HTTP pipeline → TypeSpec HTTP: uses client core
- Cosmos emulator → Azure Cosmos DB: emulates service
