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

defunctorised versions of unikernels #407

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

hannesm
Copy link
Member

@hannesm hannesm commented Jan 21, 2025

No description provided.

@@ -12,5 +12,5 @@ let packages =
package ~min:"0.2.0" "randomconv";
]

let main = main "Unikernel.Main" ~packages (random @-> job)
let () = register "crypto-test" [ main $ default_random ]
let main = main "Unikernel" ~packages ~deps:[ dep noop ] job
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the dep noop needed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to delay the execution of start (now having a unit argument).

what happens if you forget it is that mirage configure will complain (see mirage/mirage#1544) -- certainly we should adapt the error message :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any useful unikernel/app that could be written with main "Unikernel" ~packages job? If not, should we just insert it that noop by default in that case (with a warning message to make clear that some magic has happened)? I'm just a bit concerned that this makes the "hello world" unikernel unnecessary harder to write (as you have to explain what deps is, what noop is, etc).

Or maybe we should have a noop -> job signature that just adds a () argument to the main function without changing the functor structure. That seems a bit more convoluted though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, we can always add a () argument to the job of main. I'd make this unconditionally, and not "only if there's no other dep/functor). Now that's an orthogonal change requiring mirage/functoria insights and needs to be tested with mirage-www/dns-primary-git unikernels (esp. with --enable-monitoring variant).

Please feel free to provide a PR that does this in the mirage/mirage repository. I'm very low on functoria skills.

@@ -3,8 +3,7 @@ open Mirage

let main =
let packages = [ package "duration" ] in
main ~packages "Unikernel.Main" (time @-> pclock @-> mclock @-> job)
main ~packages ~deps:[ dep noop ] "Unikernel" job
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here :-) What happens if you forget to add it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants