Skip to content

Latest commit

 

History

History
37 lines (32 loc) · 1.3 KB

README.md

File metadata and controls

37 lines (32 loc) · 1.3 KB

rustcracker

A crate for communicating with firecracker developed by Xue Haonan during development of PKU-cloud. Reference: firecracker-go-sdk

Thanks for supports from all members of LCPU (Linux Club of Peking University).

Break Changes

The API of rustcracker 2.0.0 has a break change, which is completely incompatible with 1.x, and is cleaner, more organized and easier to use.

Example

async fn _demo_use_async_machine() -> RtckResult<()> {
    use rustcracker::config::GlobalConfig;
    let config = GlobalConfig {
        ..Default::default()
    };

    use rustcracker::machine::machine_async;
    use rustcracker::models::snapshot_create_params;
    let machine = machine_async::Machine::create(&config).await?;
    machine.configure().await?;
    machine.start().await?;
    machine.pause().await?;
    machine
        .snapshot(
            "/snapshot/state/demo",
            "/snapshot/mem/demo",
            snapshot_create_params::SnapshotType::Diff,
        )
        .await?;
    machine.resume().await?;
    machine.stop().await?;
    machine.delete().await?;
    machine.delete_and_clean().await?;

    Ok(())
}