# fgm/container architecture

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

- Interactive diagram: https://gitdiagram.com/fgm/container
- Repository: https://github.com/fgm/container

## Overview

This is a small Go generics library, not a service: callers construct and use type-safe ordered maps, queues, sets, and stacks. The README documents slice, linked-list, and pooling alternatives, plus WaitableQueue’s concurrent, flow-controlled behavior. Sampled code confirms linked-list storage and pooled-node behavior; edges for unsampled implementations rely only on README documentation, so the graph avoids implying internal call chains.

Main entry points: [`internal/types.go`](https://github.com/fgm/container/blob/main/internal/types.go) (List element), [`queue/list.go`](https://github.com/fgm/container/blob/main/queue/list.go) (Linked queue), [`queue/syncpool.go`](https://github.com/fgm/container/blob/main/queue/syncpool.go) (Sync-pool queue), [`queue/internalpool.go`](https://github.com/fgm/container/blob/main/queue/internalpool.go) (Internal-pool queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Container APIs"]
  node_interfaces["Container interfaces<br/>[types.go]"]
end

subgraph group_queue["Queue Implementations"]
  node_queue_slice["Slice queue<br/>[slice.go]"]
  node_queue_list["Linked queue<br/>[list.go]"]
  node_queue_sync["Sync-pool queue<br/>[syncpool.go]"]
  node_queue_internal["Internal-pool queue<br/>[internalpool.go]"]
  node_waitable["Waitable queue<br/>[waitable_queue.go]"]
end

subgraph group_stack["Stack Implementations"]
  node_stack_slice["Slice stack<br/>[slice.go]"]
  node_stack_list["Linked stack<br/>[list.go]"]
  node_stack_sync["Sync-pool stack<br/>[syncpool.go]"]
  node_stack_internal["Internal-pool stack<br/>[internalpool.go]"]
end

subgraph group_other["Other Containers"]
  node_orderedmap["Ordered map<br/>[slice.go]"]
  node_set_map["Map-backed set<br/>[basic_map.go]"]
end

subgraph group_shared["Shared Internals"]
  node_list_element["List element<br/>[types.go]"]
end

node_caller(("Go caller"))

node_caller -->|"uses API"| node_interfaces
node_caller -->|"constructs and uses"| node_orderedmap
node_caller -->|"constructs and uses"| node_queue_slice
node_caller -->|"constructs and uses"| node_queue_list
node_caller -->|"constructs and uses"| node_queue_sync
node_caller -->|"constructs and uses"| node_queue_internal
node_caller -->|"constructs and uses"| node_waitable
node_caller -->|"constructs and uses"| node_stack_slice
node_caller -->|"constructs and uses"| node_stack_list
node_caller -->|"constructs and uses"| node_stack_sync
node_caller -->|"constructs and uses"| node_stack_internal
node_caller -->|"constructs and uses"| node_set_map
node_queue_list -->|"stores nodes"| node_list_element
node_queue_internal -->|"pools nodes"| node_list_element
node_queue_sync -->|"pools nodes"| node_list_element
node_stack_list -->|"stores nodes"| node_list_element
node_stack_internal -->|"pools nodes"| node_list_element
node_stack_sync -->|"pools nodes"| node_list_element

click node_interfaces "https://github.com/fgm/container/blob/main/types.go"
click node_orderedmap "https://github.com/fgm/container/blob/main/orderedmap/slice.go"
click node_queue_slice "https://github.com/fgm/container/blob/main/queue/slice.go"
click node_queue_list "https://github.com/fgm/container/blob/main/queue/list.go"
click node_queue_sync "https://github.com/fgm/container/blob/main/queue/syncpool.go"
click node_queue_internal "https://github.com/fgm/container/blob/main/queue/internalpool.go"
click node_waitable "https://github.com/fgm/container/blob/main/queue/waitable_queue.go"
click node_stack_slice "https://github.com/fgm/container/blob/main/stack/slice.go"
click node_stack_list "https://github.com/fgm/container/blob/main/stack/list.go"
click node_stack_sync "https://github.com/fgm/container/blob/main/stack/syncpool.go"
click node_stack_internal "https://github.com/fgm/container/blob/main/stack/internalpool.go"
click node_set_map "https://github.com/fgm/container/blob/main/set/basic_map.go"
click node_list_element "https://github.com/fgm/container/blob/main/internal/types.go"

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_interfaces toneBlue
class node_queue_slice,node_queue_list,node_queue_sync,node_queue_internal,node_waitable toneAmber
class node_stack_slice,node_stack_list,node_stack_sync,node_stack_internal toneMint
class node_orderedmap,node_set_map toneRose
class node_list_element,node_caller toneIndigo
```

## Components

### Container APIs

- [Container interfaces](https://github.com/fgm/container/blob/main/types.go): `types.go`

### Queue Implementations

- [Slice queue](https://github.com/fgm/container/blob/main/queue/slice.go): `queue/slice.go`
- [Linked queue](https://github.com/fgm/container/blob/main/queue/list.go): `queue/list.go`
- [Sync-pool queue](https://github.com/fgm/container/blob/main/queue/syncpool.go): `queue/syncpool.go`
- [Internal-pool queue](https://github.com/fgm/container/blob/main/queue/internalpool.go): `queue/internalpool.go`
- [Waitable queue](https://github.com/fgm/container/blob/main/queue/waitable_queue.go): `queue/waitable_queue.go`

### Stack Implementations

- [Slice stack](https://github.com/fgm/container/blob/main/stack/slice.go): `stack/slice.go`
- [Linked stack](https://github.com/fgm/container/blob/main/stack/list.go): `stack/list.go`
- [Sync-pool stack](https://github.com/fgm/container/blob/main/stack/syncpool.go): `stack/syncpool.go`
- [Internal-pool stack](https://github.com/fgm/container/blob/main/stack/internalpool.go): `stack/internalpool.go`

### Other Containers

- [Ordered map](https://github.com/fgm/container/blob/main/orderedmap/slice.go): `orderedmap/slice.go`
- [Map-backed set](https://github.com/fgm/container/blob/main/set/basic_map.go): `set/basic_map.go`

### Shared Internals

- [List element](https://github.com/fgm/container/blob/main/internal/types.go): `internal/types.go`

### Other components

- **Go caller**

## Connections

- Go caller → Container interfaces: uses API (evidence: `README.md`)
- Go caller → Ordered map: constructs and uses (evidence: `README.md`)
- Go caller → Slice queue: constructs and uses (evidence: `README.md`)
- Go caller → Linked queue: constructs and uses (evidence: `README.md`)
- Go caller → Sync-pool queue: constructs and uses (evidence: `README.md`)
- Go caller → Internal-pool queue: constructs and uses (evidence: `README.md`)
- Go caller → Waitable queue: constructs and uses (evidence: `README.md`)
- Go caller → Slice stack: constructs and uses (evidence: `README.md`)
- Go caller → Linked stack: constructs and uses (evidence: `README.md`)
- Go caller → Sync-pool stack: constructs and uses (evidence: `README.md`)
- Go caller → Internal-pool stack: constructs and uses (evidence: `README.md`)
- Go caller → Map-backed set: constructs and uses (evidence: `README.md`)
- Linked queue → List element: stores nodes (evidence: `queue/list.go`)
- Internal-pool queue → List element: pools nodes (evidence: `queue/internalpool.go`)
- Sync-pool queue → List element: pools nodes (evidence: `queue/syncpool.go`)
- Linked stack → List element: stores nodes (evidence: `stack/list.go`)
- Internal-pool stack → List element: pools nodes (evidence: `stack/internalpool.go`)
- Sync-pool stack → List element: pools nodes (evidence: `stack/syncpool.go`)
