Inter-Node File Distribution
Introduction
In a multi-Node Unit, service images are downloaded from the cloud by the Communication Manager (CM) on the Main Node. Secondary Nodes do not have direct cloud connectivity — they receive images and files through the Message Proxy (MP), which bridges the Main Node and Secondary Nodes over the inter-node transport.
This page describes the file distribution pipeline: how CM makes images available via its file server, how MP downloads and unpacks them, and how the filechunker module splits large files into chunks for reliable transport to the Main Node's CM.
Distribution Architecture
File distribution in AosCore follows a pull-based model. When a Secondary Node's Service Manager (SM) needs a service image, the request flows through MP back to CM, which provides the image via HTTP. MP then downloads, unpacks, and chunks the content for delivery.
The key components involved are:
| Component | Location | Role |
|---|---|---|
| CM File Server | Main Node | Serves image files over HTTP to other Nodes |
| CM Image Manager | Main Node | Manages image storage and translates file paths to HTTP URLs |
| MP Downloader | Secondary Node | Downloads files from CM's file server via HTTP |
| MP Image Unpacker | Secondary Node | Extracts and validates OCI service image archives |
| MP File Chunker | Secondary Node | Splits unpacked image files into chunks for transport |
CM File Server
The Communication Manager runs an embedded HTTP file server that provides access to downloaded service images. This server is implemented using the Poco HTTP library and listens on a configurable port (default: 8080).
How It Works
- CM's Image Manager downloads service images from the cloud and stores them locally
- The file server maps local file paths to HTTP URLs using
TranslateFilePathURL - When SM on a Secondary Node requests an image, CM provides the HTTP URL pointing to its file server
- MP on the Secondary Node uses this URL to download the image
URL Translation
The file server translates absolute file paths into HTTP URLs relative to its root directory. For example:
Local path: /var/aos/download/blobs/sha256/abc123...
Server URL: http://192.168.1.10:8080/blobs/sha256/abc123...
This allows Secondary Nodes to fetch any file that CM has stored, using standard HTTP GET requests.
Image Content Request Flow
The distribution process is triggered when CM sends an ImageContentRequest message to a Secondary Node's SM (via MP).
The flow proceeds as follows:
-
CM sends request — CM's SM Controller sends an
ImageContentRequestto the Secondary Node, containing:url— the HTTP URL where the image can be downloaded (from CM's file server)request_id— a unique identifier for tracking the requestcontent_type— the type of content (e.g.,"service"for service images)
-
MP receives request — The Message Proxy's CM connection intercepts the
ImageContentRequeston the secure channel -
MP downloads the file — MP uses its downloader to fetch the image archive from the provided URL
-
MP unpacks the image — The image unpacker extracts and validates the OCI image archive
-
MP chunks the content — The filechunker splits the unpacked files into fixed-size chunks
-
MP sends content info — MP sends an
ImageContentInfomessage back to CM with file metadata (paths, SHA-256 checksums, sizes) -
MP sends chunks — MP sends individual
ImageContentmessages containing the file data in sequential parts
File Chunker
The filechunker module (aos::mp::filechunker) splits files into fixed-size chunks for reliable transport over the
inter-node communication channel. This is necessary because the inter-node transport (vchan or socket) has message size
constraints.
Chunking Process
Given a directory of unpacked image files, the filechunker:
- Recursively iterates all files in the directory
- For each file, computes a SHA-256 hash for integrity verification
- Splits the file content into 1 KB chunks
- Produces a
ContentInfostructure containing:- Image files — metadata for each file (relative path, SHA-256 hash, size)
- Image contents — the actual data chunks with sequencing information
Chunk Structure
Each chunk (ImageContent) contains:
| Field | Description |
|---|---|
mRequestID | Correlates chunks to the original request |
mRelativePath | File path relative to the image root directory |
mPartsCount | Total number of chunks for this file |
mPart | Sequential chunk number (1-based) |
mData | Raw file data for this chunk (up to 1024 bytes) |
The receiving side reassembles the file by collecting all parts in order and concatenating the data.
Design Rationale
The 1 KB chunk size is chosen to fit within the inter-node transport's message size limits while maintaining reasonable throughput. The SHA-256 hash per file enables end-to-end integrity verification after reassembly.
Image Unpacker
The image unpacker module (aos::mp::imageunpacker) receives OCI service image archives and prepares them for local use
by the Service Manager.
Unpacking Process
- Extract archive — The tar archive is extracted into a temporary directory within the configured image store
- Parse manifest — The
manifest.jsonfile is parsed to identify the image config, service config (optionalaosServicedescriptor), and filesystem layers - Validate digests — All content-addressable blobs are verified against their declared SHA-256 digests
- Prepare filesystem — The service rootfs layer is extracted from its tar archive and the directory hash is recomputed
- Update manifest — The manifest is updated with the new rootfs digest after extraction
OCI Image Structure
The unpacker expects images in the following OCI-compatible layout:
image/
├── manifest.json # Image manifest with config and layer references
└── blobs/
└── sha256/
├── <config-hash> # Image configuration JSON
├── <service-hash> # Aos service configuration (optional)
└── <layer-hash> # Service rootfs (tar archive or directory)
Content Types
The unpacker currently supports the "service" content type, which processes standard AosEdge service images. The
content type is specified in the original ImageContentRequest from CM.
End-to-End Distribution Sequence
The complete file distribution sequence for deploying a service to a Secondary Node:
Main Node (CM) Secondary Node (MP → SM)
───────────────── ────────────────────────
1. Download image from cloud
2. Store in local image store
3. File server makes image
available via HTTP URL
4. Send ImageContentRequest ──────► 5. Receive request on secure channel
(url, request_id, type) 6. Download archive from CM file server
7. Unpack OCI image archive
8. Validate image digests
9. Chunk unpacked files (1 KB chunks)
10. Receive ImageContentInfo ◄────── 10. Send file metadata
(paths, hashes, sizes) (ImageContentInfo)
11. Receive ImageContent ◄────── 11. Send data chunks sequentially
chunks (ImageContent messages)
12. Forward to SM for
service deployment
Security Considerations
- TLS-encrypted transport — All inter-node communication channels are secured with mutual TLS using IAM-issued certificates
- Integrity verification — SHA-256 hashes are computed for every file and verified after transfer
- Digest validation — OCI image manifests use content-addressable storage; any tampering is detected during the unpack phase
- Authenticated download — The HTTP connection from MP to CM's file server operates over the secure inter-node channel
Related Pages
- Architecture Overview — system architecture including MP's role
- Node Lifecycle — how Nodes register and participate in the Unit
- Image Deployment Pipeline — end-to-end image deployment flow
- OCI Image Format — AosCore's OCI image format usage
- Downloader — the download subsystem used by MP