Skip to content

Commit b2d7b66

Browse files
LoCoBench Botclaude
andcommitted
feat: US-005 - Create docgen-api-002: Cilium eBPF map API reference
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent b94246b commit b2d7b66

9 files changed

Lines changed: 789 additions & 6 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt-get update && apt-get install -y \
4+
git \
5+
python3 \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
WORKDIR /workspace
9+
10+
# Clone Cilium at specific commit (main 2026-02-16)
11+
RUN git clone --filter=blob:none --no-checkout https://github.com/cilium/cilium.git repo && \
12+
cd repo && \
13+
git checkout ad6b298dbdcb9b828a247c54a477a9cfa43eff00 && \
14+
git sparse-checkout init --cone && \
15+
git sparse-checkout set pkg/bpf pkg/maps pkg/datapath/maps && \
16+
git checkout
17+
18+
# Agent writes documentation.md to /workspace/
19+
# Verifier: /tests/test.sh scores against /tests/ground_truth.json
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Task: Document Cilium eBPF Map API
2+
3+
## Objective
4+
5+
Generate comprehensive API reference documentation for Cilium's eBPF map API in the `pkg/bpf` package. The documentation should serve as a complete reference for developers working with eBPF maps in Cilium.
6+
7+
## Scope
8+
9+
Focus on the Go wrappers in `pkg/bpf` that provide user-space interaction with kernel eBPF maps. Document:
10+
11+
1. **Core Map Type and Creation**
12+
- `Map` struct and its primary methods
13+
- Map creation functions (`NewMap`, `OpenMap`, `OpenOrCreate`)
14+
- Map lifecycle operations (Open, Create, Close, Recreate)
15+
16+
2. **CRUD Operations**
17+
- Lookup, Update, Delete operations
18+
- Batch operations (BatchLookup, DeleteAll)
19+
- Per-CPU map operations
20+
- Locked operations (DeleteLocked)
21+
22+
3. **Iteration and Dumping**
23+
- Dump methods and callbacks
24+
- BatchIterator type and usage
25+
- DumpStats for tracking iteration
26+
27+
4. **Pinning and Persistence**
28+
- Pin/Unpin operations
29+
- BPF filesystem paths (BPFFSRoot, CiliumPath, MapPath)
30+
- Map persistence behavior
31+
32+
5. **Key/Value Interfaces**
33+
- MapKey, MapValue, MapPerCPUValue interfaces
34+
- EndpointKey as concrete example
35+
36+
6. **Event System**
37+
- Event types (MapUpdate, MapDelete)
38+
- DumpAndSubscribe for event streaming
39+
- Event callbacks and handles
40+
41+
7. **Collection Loading**
42+
- LoadCollection and LoadAndAssign functions
43+
- CollectionOptions
44+
45+
## Requirements
46+
47+
Your documentation must include:
48+
49+
1. **API Method Signatures**: Complete signatures with parameter types and return values
50+
2. **Behavioral Semantics**:
51+
- When maps are pinned vs unpinned
52+
- Difference between Create() and CreateUnpinned()
53+
- OpenOrCreate() behavior on existing maps
54+
- How deletion works within DumpCallback (requires DeleteLocked)
55+
- Event subscription lifecycle
56+
- Batch iterator retry behavior on ENOSPC
57+
3. **Usage Examples**: Code snippets showing:
58+
- Basic map creation and CRUD
59+
- Iteration with BatchIterator
60+
- Event subscription and cleanup
61+
- Pinning and unpinning maps
62+
- Real-world patterns from Cilium internals
63+
4. **Documentation Structure**: Organize clearly with sections for each category above
64+
65+
## Output Format
66+
67+
Write your documentation to `/workspace/documentation.md` in Markdown format.
68+
69+
## Constraints
70+
71+
- Do NOT include file paths or specific implementation locations in the documentation
72+
- Focus on API contracts and behavior, not internal implementation details
73+
- Include enough behavioral detail that users can correctly use the API without reading source code
74+
- Provide accurate examples that would compile and work correctly
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[task]
2+
category = "api_reference"
3+
name = "docgen-api-002"
4+
description = "Generate API reference documentation for Cilium's eBPF map API covering map types, CRUD operations, pinning, and lifecycle management"
5+
language = "go"
6+
difficulty = "hard"
7+
time_limit_sec = 1200
8+
9+
[metadata]
10+
output_format = "/workspace/documentation.md"
11+
repo = "cilium/cilium"

0 commit comments

Comments
 (0)