# rockorager/ourio architecture

> Architecture diagram of the GitHub repository rockorager/ourio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rockorager/ourio
- Repository: https://github.com/rockorager/ourio

## Overview

Ourio is an asynchronous I/O runtime centered on Rings and message-tagged Tasks: callers schedule operations, receive completions through callbacks, and can cancel tasks or set deadlines. Its documented capabilities include io_uring and kqueue backends, mock I/O, cross-thread message passing, and polling between Rings. The tree also contains standard-library networking, DNS, and TLS modules; their internal relationships are not established by the available excerpts. No source excerpts were provided, so edges below rely on README statements only.

Main entry points: [`src/ourio.zig`](https://github.com/rockorager/ourio/blob/main/src/ourio.zig) (Ring runtime), [`src/ourio/Task.zig`](https://github.com/rockorager/ourio/blob/main/src/ourio/Task.zig) (Task context), [`src/ourio/Uring.zig`](https://github.com/rockorager/ourio/blob/main/src/ourio/Uring.zig) (io_uring backend), [`src/ourio/Kqueue.zig`](https://github.com/rockorager/ourio/blob/main/src/ourio/Kqueue.zig) (kqueue backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime Core"]
  node_ring["Ring runtime<br/>[ourio.zig]"]
  node_task["Task context<br/>[Task.zig]"]
  node_queue["Task queue<br/>[queue.zig]"]
  node_completion["Completion callbacks<br/>[Task.zig]"]
  node_deadlines["Deadlines and cancellation<br/>[Task.zig]"]
  node_threadmsg["Cross-thread messaging<br/>[ourio.zig]"]
  node_ringpoll["Ring polling<br/>[ourio.zig]"]
end

subgraph group_backends["I/O Backends"]
  node_uring["io_uring backend<br/>[Uring.zig]"]
  node_kqueue["kqueue backend<br/>[Kqueue.zig]"]
  node_mock["Mock I/O<br/>[Mock.zig]"]
end

subgraph group_network["Networking"]
  node_stda["Standard utilities<br/>[stda.zig]"]
  node_net["Networking<br/>[net.zig]"]
  node_dns["DNS<br/>[dns.zig]"]
  node_tls["TLS<br/>[tls.zig]"]
end

node_user(("Library user"))

node_user -->|"schedules I/O"| node_ring
node_ring -->|"schedules"| node_task
node_ring -->|"dispatches completions"| node_completion
node_user -->|"sets or cancels"| node_deadlines
node_ring -->|"sends via msg_ring"| node_threadmsg
node_ring -->|"polls another Ring"| node_ringpoll
node_ring -->|"uses backend"| node_uring
node_ring -->|"uses backend"| node_kqueue
node_user -->|"tests async code"| node_mock

click node_ring "https://github.com/rockorager/ourio/blob/main/src/ourio.zig"
click node_task "https://github.com/rockorager/ourio/blob/main/src/ourio/Task.zig"
click node_queue "https://github.com/rockorager/ourio/blob/main/src/ourio/queue.zig"
click node_completion "https://github.com/rockorager/ourio/blob/main/src/ourio/Task.zig"
click node_deadlines "https://github.com/rockorager/ourio/blob/main/src/ourio/Task.zig"
click node_threadmsg "https://github.com/rockorager/ourio/blob/main/src/ourio.zig"
click node_ringpoll "https://github.com/rockorager/ourio/blob/main/src/ourio.zig"
click node_uring "https://github.com/rockorager/ourio/blob/main/src/ourio/Uring.zig"
click node_kqueue "https://github.com/rockorager/ourio/blob/main/src/ourio/Kqueue.zig"
click node_mock "https://github.com/rockorager/ourio/blob/main/src/ourio/Mock.zig"
click node_stda "https://github.com/rockorager/ourio/blob/main/src/stda.zig"
click node_net "https://github.com/rockorager/ourio/blob/main/src/stda/net.zig"
click node_dns "https://github.com/rockorager/ourio/blob/main/src/stda/net/dns.zig"
click node_tls "https://github.com/rockorager/ourio/blob/main/src/stda/tls.zig"

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_ring,node_task,node_queue,node_completion,node_deadlines,node_threadmsg,node_ringpoll,node_user toneBlue
class node_uring,node_kqueue,node_mock toneAmber
class node_stda,node_net,node_dns,node_tls toneMint
```

## Components

### Runtime Core

- [Ring runtime](https://github.com/rockorager/ourio/blob/main/src/ourio.zig): `src/ourio.zig`
- [Task context](https://github.com/rockorager/ourio/blob/main/src/ourio/Task.zig): `src/ourio/Task.zig`
- [Task queue](https://github.com/rockorager/ourio/blob/main/src/ourio/queue.zig): `src/ourio/queue.zig`
- [Completion callbacks](https://github.com/rockorager/ourio/blob/main/src/ourio/Task.zig): `src/ourio/Task.zig`
- [Deadlines and cancellation](https://github.com/rockorager/ourio/blob/main/src/ourio/Task.zig): `src/ourio/Task.zig`
- [Cross-thread messaging](https://github.com/rockorager/ourio/blob/main/src/ourio.zig): `src/ourio.zig`
- [Ring polling](https://github.com/rockorager/ourio/blob/main/src/ourio.zig): `src/ourio.zig`

### I/O Backends

- [io_uring backend](https://github.com/rockorager/ourio/blob/main/src/ourio/Uring.zig): `src/ourio/Uring.zig`
- [kqueue backend](https://github.com/rockorager/ourio/blob/main/src/ourio/Kqueue.zig): `src/ourio/Kqueue.zig`
- [Mock I/O](https://github.com/rockorager/ourio/blob/main/src/ourio/Mock.zig): `src/ourio/Mock.zig`

### Networking

- [Standard utilities](https://github.com/rockorager/ourio/blob/main/src/stda.zig): `src/stda.zig`
- [Networking](https://github.com/rockorager/ourio/blob/main/src/stda/net.zig): `src/stda/net.zig`
- [DNS](https://github.com/rockorager/ourio/blob/main/src/stda/net/dns.zig): `src/stda/net/dns.zig`
- [TLS](https://github.com/rockorager/ourio/blob/main/src/stda/tls.zig): `src/stda/tls.zig`

### Other components

- **Library user**

## Connections

- Library user → Ring runtime: schedules I/O (evidence: `README.md`)
- Ring runtime → Task context: schedules (evidence: `README.md`)
- Ring runtime → Completion callbacks: dispatches completions (evidence: `README.md`)
- Library user → Deadlines and cancellation: sets or cancels (evidence: `README.md`)
- Ring runtime → Cross-thread messaging: sends via msg_ring (evidence: `README.md`)
- Ring runtime → Ring polling: polls another Ring (evidence: `README.md`)
- Ring runtime → io_uring backend: uses backend (evidence: `README.md`)
- Ring runtime → kqueue backend: uses backend (evidence: `README.md`)
- Library user → Mock I/O: tests async code (evidence: `README.md`)
