Skip to content

Commit bc8a7e5

Browse files
committed
Update README
1 parent 5fbacba commit bc8a7e5

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

lib/images/README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Image Manager
22

3-
Converts OCI container images into bootable ext4 disk images for Cloud Hypervisor VMs.
3+
Converts OCI images to bootable ext4 disks for Cloud Hypervisor VMs.
44

55
## Architecture
66

@@ -46,23 +46,35 @@ OCI Registry → containers/image → OCI Layout → umoci → rootfs/ → mkfs.
4646
- `-O ^has_journal` - No journal (disks mounted read-only in VMs, saves ~32MB)
4747
- Minimum 10MB size covers ext4 metadata (~5MB for superblock, inodes, bitmaps)
4848

49-
**Alternative tried:** go-diskfs pure Go ext4 - has bugs
49+
**Alternative tried:** go-diskfs pure Go ext4, got too complicated. Could revisit this.
5050

51-
**Tradeoff:** Shell command vs pure Go, but mkfs.ext4 is universally available and robust
51+
**Tradeoff:** Shell command vs pure Go, but mkfs.ext4 is widely available and robust
52+
53+
## Filesystem Layout (storage.go)
5254

53-
## Filesystem Persistence (storage.go)
5455

55-
**Metadata:** JSON files with atomic writes (tmp + rename)
5656
```
57-
/var/lib/hypeman/images/{id}/
58-
rootfs.ext4
59-
metadata.json
57+
/var/lib/hypeman/
58+
images/
59+
docker.io/library/alpine/
60+
latest/
61+
metadata.json # Status, entrypoint, cmd, env
62+
rootfs.ext4 # Bootable disk
63+
3.18/ # Different version
64+
system/oci-cache/
65+
docker.io/library/alpine/latest/
66+
blobs/sha256/... # Shared layers, persistent
6067
```
6168

62-
**Why filesystem vs database?**
63-
- Disk images must be on filesystem anyway
64-
- No sync issues between DB and actual artifacts
65-
- Simple recovery (scan directory to rebuild state)
69+
**Benefits:**
70+
- Natural hierarchy (versions grouped)
71+
- Layer caching (alpine:latest and alpine:3.18 share base layers)
72+
73+
## Input Validation
74+
75+
Uses `github.com/distribution/reference` to validate and normalize names:
76+
- `alpine``docker.io/library/alpine:latest`
77+
- Rejects invalid formats (returns 400)
6678

6779
## Build Tags
6880

0 commit comments

Comments
 (0)