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

Redesign create.rs #118

Closed
utam0k opened this issue Jul 1, 2021 · 2 comments
Closed

Redesign create.rs #118

utam0k opened this issue Jul 1, 2021 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@utam0k
Copy link
Member

utam0k commented Jul 1, 2021

The create.rs should be split up more, but I don't have a good idea how to split it up, so if you have any suggestions, please let me know.

Ideas

@utam0k utam0k added the help wanted Extra attention is needed label Jul 1, 2021
@utam0k utam0k changed the title Refactoring create.rs Redesign create.rs Jul 1, 2021
@nimrodshn
Copy link
Contributor

nimrodshn commented Jul 1, 2021

builder pattern

Sounds good 👍

@Furisto
Copy link
Collaborator

Furisto commented Jul 1, 2021

This is what the preliminary api looks like:

 // required values (must be specified in new...)
        // - create
        //   - id
        //   - bundle
        // - exec
        //   - id
        //
        // use with_... methods to specify
        // optional values
        // - console-socket
        // - pid-file
        //
        // overwritable values
        // - systemd (default true)
        // - root_path (default /run/youki)
        //
        // overwritable values (for exec only?)
        // - env
        // - cwd
        // - container command
        //
        // calculated in build()
        // computed values
        // - rootless
        // - container_dir
        // - spec
        // - notify_socket
        // - container 

        // create
        let container = ContainerBuilder::new_init(id, bundle)?
        .with_pid_file(pid_file) // optional
        .with_console_socket(console_socket) //optional
        .with_systemd(false) // overwrite default
        .with_root_path(root_path) // overwrite default
        .build()?;

        // exec
        let container = ContainerBuilder::new_tenant(id)
        .with_pid_file(pid_file)
        .with_console_socket(console_socket)
        .with_cwd(cwd)
        .with_env(env)
        .with_container_command(vec!["sleep".to_owned(), "9001".to_owned()])
        .build()?;    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants