# lorenzo-gardini/async-node architecture

> Architecture diagram of the GitHub repository lorenzo-gardini/async-node, 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/lorenzo-gardini/async-node
- Repository: https://github.com/lorenzo-gardini/async-node

## Overview

AsyncNode is a small runtime library for building lazy asynchronous computations: callers create a node, compose transformations or side effects, then await its cached result. It also provides executor factories and decorators for dispatching synchronous functions. The excerpts omit parts of AsyncNode’s implementation, so the graph shows only documented capabilities and wiring directly supported by the sampled code.

Main entry points: [`async_node/async_node.py`](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py) (Get and cache), [`async_node/schedulers.py`](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/schedulers.py) (Scheduler factory), [`async_node/decorators.py`](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/decorators.py) (Executor decorators), [`async_node/__init__.py`](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/__init__.py) (Package exports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_computation["Async Computation"]
  node_factories["Node factories<br/>[async_node.py]"]
  node_node["AsyncNode<br/>[async_node.py]"]
  node_operators["Map and side effects<br/>[async_node.py]"]
  node_combine["Node combination<br/>[async_node.py]"]
  node_errors["Errors and retry<br/>[async_node.py]"]
  node_delay["Delay and timeout<br/>[async_node.py]"]
  node_results["Get and cache<br/>[async_node.py]"]
  node_types["Function types"]
end

subgraph group_execution["Executor Management"]
  node_schedulers["Scheduler factory<br/>[schedulers.py]"]
  node_io_scheduler["Dynamic IO scheduler"]
  node_executor_pool["Reusable executor"]
  node_decorators["Executor decorators<br/>[decorators.py]"]
end

subgraph group_integration["Public API"]
  node_exports["Package exports<br/>[__init__.py]"]
end

node_caller(("Application caller"))

node_caller -->|"imports"| node_exports
node_exports -->|"exports"| node_node
node_exports -->|"exports"| node_schedulers
node_caller -->|"creates"| node_factories
node_factories -->|"returns"| node_node
node_caller -->|"composes"| node_operators
node_operators -->|"awaits source"| node_results
node_operators -->|"returns node"| node_node
node_caller -->|"combines"| node_combine
node_combine -->|"gathers nodes"| node_results
node_combine -->|"returns node"| node_node
node_caller -->|"handles failures"| node_errors
node_errors -->|"retries result"| node_results
node_errors -->|"returns node"| node_node
node_caller -->|"configures wait"| node_delay
node_delay -->|"awaits source"| node_results
node_delay -->|"returns node"| node_node
node_caller -->|"awaits result"| node_results
node_results -->|"returns value"| node_caller
node_caller -->|"requests executor"| node_schedulers
node_schedulers -->|"creates IO executor"| node_io_scheduler
node_schedulers -->|"requests reusable pool"| node_executor_pool
node_caller -->|"uses decorator"| node_decorators
node_decorators -->|"gets executor"| node_schedulers
node_decorators -->|"dispatches task"| node_executor_pool

click node_factories "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py"
click node_node "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py"
click node_operators "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py"
click node_combine "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py"
click node_errors "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py"
click node_delay "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py"
click node_results "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py"
click node_types "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/_functional_types.py"
click node_schedulers "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/schedulers.py"
click node_io_scheduler "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/_dynamic_io_executor.py"
click node_decorators "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/decorators.py"
click node_exports "https://github.com/lorenzo-gardini/async-node/blob/main/async_node/__init__.py"

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_factories,node_node,node_operators,node_combine,node_errors,node_delay,node_results,node_types toneBlue
class node_schedulers,node_io_scheduler,node_executor_pool,node_decorators toneAmber
class node_exports toneMint
class node_caller toneIndigo
```

## Components

### Async Computation

- [Node factories](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py): `async_node/async_node.py`
- [AsyncNode](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py): `async_node/async_node.py`
- [Map and side effects](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py): `async_node/async_node.py`
- [Node combination](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py): `async_node/async_node.py`
- [Errors and retry](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py): `async_node/async_node.py`
- [Delay and timeout](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py): `async_node/async_node.py`
- [Get and cache](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/async_node.py): `async_node/async_node.py`
- [Function types](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/_functional_types.py): `async_node/_functional_types.py`

### Executor Management

- [Scheduler factory](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/schedulers.py): `async_node/schedulers.py`
- [Dynamic IO scheduler](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/_dynamic_io_executor.py): `async_node/_dynamic_io_executor.py`
- **Reusable executor**
- [Executor decorators](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/decorators.py): `async_node/decorators.py`

### Public API

- [Package exports](https://github.com/lorenzo-gardini/async-node/blob/main/async_node/__init__.py): `async_node/__init__.py`

### Other components

- **Application caller**

## Connections

- Application caller → Package exports: imports
- Package exports → AsyncNode: exports
- Package exports → Scheduler factory: exports
- Application caller → Node factories: creates
- Node factories → AsyncNode: returns
- Application caller → Map and side effects: composes
- Map and side effects → Get and cache: awaits source
- Map and side effects → AsyncNode: returns node
- Application caller → Node combination: combines
- Node combination → Get and cache: gathers nodes
- Node combination → AsyncNode: returns node
- Application caller → Errors and retry: handles failures
- Errors and retry → Get and cache: retries result
- Errors and retry → AsyncNode: returns node
- Application caller → Delay and timeout: configures wait
- Delay and timeout → Get and cache: awaits source
- Delay and timeout → AsyncNode: returns node
- Application caller → Get and cache: awaits result
- Get and cache → Application caller: returns value
- Application caller → Scheduler factory: requests executor
- Scheduler factory → Dynamic IO scheduler: creates IO executor
- Scheduler factory → Reusable executor: requests reusable pool
- Application caller → Executor decorators: uses decorator
- Executor decorators → Scheduler factory: gets executor
- Executor decorators → Reusable executor: dispatches task
