Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc/improve comments #16

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions agent/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! The agent runs inside the MicroVM and is responsible for running the
//! user's code and sending the result back to the server.
//! It is packaged with other dependencies in an initramfs image using the initramfs tool.
//!
//! The communication between the agent and the server is done using gRPC.

use agent_lib::{
api::{
grpc_definitions::lambdo_agent_service_server::LambdoAgentServiceServer,
Expand Down
1 change: 1 addition & 0 deletions initramfs/src/httpclient.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::{anyhow, Result};
use reqwest::{Client, Response};

/// Wrapper around reqwest to run a GET request with bearer auth
pub async fn run_get_request(url: &str, token: Option<&str>) -> Result<Response> {
let res = match token {
Some(token) => Client::new().get(url).bearer_auth(token),
Expand Down
1 change: 1 addition & 0 deletions initramfs/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub struct Layer {
pub content: Cursor<Bytes>,
}

/// Represents a container image
pub struct Image {
name: String,
tag: String,
Expand Down
11 changes: 11 additions & 0 deletions initramfs/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
//! This is a tool to transform a container image into an initramfs image.
//! It will download the image from a container registry, extract it and
//! write it to disk.
//! The initramfs image will contain the init binary/script and the agent
//! binary as well as the agent configuration file.
//! The init binary will be the entrypoint of the initramfs image and will
//! start the agent binary.
//!
//! This image can then be used as an initramfs image for a linux kernel
//! in the lambdo runtime.

use std::fs::File;

use anyhow::anyhow;
Expand Down
1 change: 1 addition & 0 deletions initramfs/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct ManifestResponse {
fsLayers: Vec<LayerMetadata>,
}

/// A container registry (e.g. docker hub)
pub struct Registry {
url: String,
auth_url: String,
Expand Down
Loading