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
| 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.
We need a published crate here, otherwise we can't publish fuse-backend-rs anymore.
There was a problem hiding this comment.
Is there a published version of snapshot?
There was a problem hiding this comment.
@bergwolf no, I cannnot find the crate on crates.io .
There was a problem hiding this comment.
hmm, I've created firecracker-microvm/firecracker#4162. Let's see what the firecracker maintainers think.
There was a problem hiding this comment.
Now that we have https://crates.io/crates/dbs-snapshot, could you use the published one?
There was a problem hiding this comment.
Yes. I'll update it later.
There was a problem hiding this comment.
Yes. I'll update it later.
done.
bergwolf
left a comment
There was a problem hiding this comment.
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 <loheagn@icloud.com>
This patch add a new sub module
persistfor thefuse_backend_rs::api::vfsmodule.The
persistmodule export two functions to help to save and restore theVfsstate:save_to_bytes, which save the mete data of theVfsstruct into a byte array;restore_from_bytes, which restore the meta data of theVfsstruct 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_mountto re-mount the backend file system into theVfsusing the same index as before.For more information and usage, please refer to the doc of the
save_to_bytesandrestore_from_bytesfunctions.