-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: add "persist" feature #149
Conversation
0d1d50f
to
e667771
Compare
e667771
to
0c74eac
Compare
0c74eac
to
be36646
Compare
Here's a an example dragonflyoss/nydus#1434 which shows how to use this feature. |
Cargo.toml
Outdated
@@ -20,10 +20,11 @@ build = "build.rs" | |||
arc-swap = "1.5" | |||
async-trait = { version = "0.1.42", optional = true } | |||
bitflags = "1.1" | |||
snapshot = { git = "https://github.com/firecracker-microvm/firecracker", tag = "v1.4.1", optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a published crate here, otherwise we can't publish fuse-backend-rs anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a published version of snapshot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bergwolf no, I cannnot find the crate on crates.io .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I've created firecracker-microvm/firecracker#4162. Let's see what the firecracker maintainers think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have https://crates.io/crates/dbs-snapshot, could you use the published one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'll update it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'll update it later.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally lgtm, thanks!
This patch add a new sub module `persist` for the `fuse_backend_rs::api::vfs` module. The `persist` module export two functions to help to save and restore the `Vfs` state: - `save_to_bytes`, which save the mete data of the `Vfs` struct into a byte array; - `restore_from_bytes`, which restore the meta data of the `Vfs` struct from a byte array. As the two above functions only save and restore the vfs meta data, but don't save and restore the backend file systems, this patch also provides a method named `restore_mount` to re-mount the backend file system into the `Vfs` using the same index as before. For more information and usage, please refer to the doc of the `save_to_bytes` and `restore_from_bytes` functions. Signed-off-by: Nan Li <[email protected]>
This patch add a new sub module
persist
for thefuse_backend_rs::api::vfs
module.The
persist
module export two functions to help to save and restore theVfs
state:save_to_bytes
, which save the mete data of theVfs
struct into a byte array;restore_from_bytes
, which restore the meta data of theVfs
struct from a byte array.As the two above functions only save and restore the vfs meta data, but don't save and restore the backend file systems,
this patch also provides a method named
restore_mount
to re-mount the backend file system into theVfs
using the same index as before.For more information and usage, please refer to the doc of the
save_to_bytes
andrestore_from_bytes
functions.