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

service: fix compilation failures on macos #1167

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ serde_json = "1.0.51"
thiserror = "1.0"
time = { version = "0.3.14", features = ["serde-human-readable"] }
tokio = { version = "1.24", features = ["macros"] }
tokio-uring = "0.4"

nydus-api = { version = "0.2.2", path = "../api"}
nydus-error = { version = "0.2.3", path = "../error" }
Expand All @@ -37,6 +36,9 @@ virtio-bindings = { version = "0.1", features = ["virtio-v5_0_0"], optional = tr
virtio-queue = { version = "0.6.0", optional = true }
vm-memory = { version = "0.9.0", features = ["backend-mmap"], optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
tokio-uring = "0.4"

[dev-dependencies]
vmm-sys-util = "0.10.0"

Expand Down
3 changes: 1 addition & 2 deletions service/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ use nydus_api::BuildTimeInfo;
use rust_fsm::*;
use serde::{self, Serialize};

use crate::blob_cache::BlobCacheMgr;
use crate::fs_service::{FsBackendCollection, FsService};
use crate::{Error, Result};
use crate::{BlobCacheMgr, Error, Result};

/// Nydus daemon working states.
#[allow(clippy::upper_case_acronyms)]
Expand Down
45 changes: 36 additions & 9 deletions service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,30 @@ use nydus_rafs::RafsError;
use serde::{Deserialize, Serialize};
use serde_json::Error as SerdeError;

pub mod blob_cache;
#[cfg(feature = "block-device")]
pub mod block_device;
#[cfg(feature = "block-nbd")]
pub mod block_nbd;
pub mod daemon;
#[cfg(target_os = "linux")]
mod fs_cache;
mod fs_service;
mod fusedev;
mod singleton;
pub mod upgrade;

#[cfg(target_os = "linux")]
pub use fs_cache::FsCacheHandler;
pub use fs_service::{FsBackendCollection, FsBackendMountCmd, FsBackendUmountCmd, FsService};
pub use fusedev::{create_fuse_daemon, FusedevDaemon};
pub use singleton::create_daemon;

#[cfg(target_os = "linux")]
pub mod blob_cache;
#[cfg(all(target_os = "linux", feature = "block-device"))]
pub mod block_device;
#[cfg(all(target_os = "linux", feature = "block-nbd"))]
pub mod block_nbd;
#[cfg(target_os = "linux")]
mod fs_cache;

#[cfg(target_os = "linux")]
pub use blob_cache::BlobCacheMgr;
#[cfg(target_os = "linux")]
pub use fs_cache::FsCacheHandler;

/// Error code related to Nydus library.
#[derive(thiserror::Error, Debug)]
pub enum Error {
Expand Down Expand Up @@ -222,6 +227,28 @@ pub trait ServiceArgs {
fn is_present(&self, key: &str) -> bool;
}

#[cfg(not(target_os = "linux"))]
pub struct BlobCacheMgr {}

#[cfg(not(target_os = "linux"))]
impl BlobCacheMgr {
pub fn new() -> Self {
BlobCacheMgr {}
}

pub fn add_blob_list(&self, _blobs: &nydus_api::BlobCacheList) -> std::io::Result<()> {
unimplemented!()
}

pub fn add_blob_entry(&self, _entry: &nydus_api::BlobCacheEntry) -> Result<()> {
unimplemented!()
}

pub fn remove_blob_entry(&self, _param: &nydus_api::BlobCacheObjectId) -> Result<()> {
unimplemented!()
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
3 changes: 1 addition & 2 deletions service/src/singleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ use mio::Waker;
use nydus_api::config::BlobCacheList;
use nydus_api::BuildTimeInfo;

use crate::blob_cache::BlobCacheMgr;
use crate::daemon::{
DaemonState, DaemonStateMachineContext, DaemonStateMachineInput, DaemonStateMachineSubscriber,
NydusDaemon,
};
use crate::fs_service::FsService;
use crate::{Error, Result};
use crate::{BlobCacheMgr, Error, Result};

#[allow(dead_code)]
struct ServiceController {
Expand Down