diff --git a/mountpoint-s3/examples/fs_benchmark.rs b/mountpoint-s3/examples/fs_benchmark.rs index a8cfc0f8d..1ebaeaa4b 100644 --- a/mountpoint-s3/examples/fs_benchmark.rs +++ b/mountpoint-s3/examples/fs_benchmark.rs @@ -2,7 +2,7 @@ use clap::{Arg, ArgAction, Command}; use fuser::{BackgroundSession, MountOption, Session}; use mountpoint_s3::fuse::S3FuseFilesystem; use mountpoint_s3::prefetch::default_prefetch; -use mountpoint_s3::S3FilesystemConfig; +use mountpoint_s3::{S3Filesystem, S3FilesystemConfig}; use mountpoint_s3_client::config::{EndpointConfig, S3ClientConfig}; use mountpoint_s3_client::S3CrtClient; use mountpoint_s3_crt::common::rust_log_adapter::RustLogAdapter; @@ -169,12 +169,9 @@ fn mount_file_system( mountpoint.to_str().unwrap() ); let prefetcher = default_prefetch(runtime, Default::default()); - let session = Session::new( - S3FuseFilesystem::new(client, prefetcher, bucket_name, &Default::default(), filesystem_config), - mountpoint, - &options, - ) - .expect("Should have created FUSE session successfully"); + let fs = S3Filesystem::new(client, prefetcher, bucket_name, &Default::default(), filesystem_config); + let session = Session::new(S3FuseFilesystem::new(fs), mountpoint, &options) + .expect("Should have created FUSE session successfully"); BackgroundSession::new(session).expect("Should have started FUSE session successfully") } diff --git a/mountpoint-s3/src/cli.rs b/mountpoint-s3/src/cli.rs index 07dfb5830..e578d22e5 100644 --- a/mountpoint-s3/src/cli.rs +++ b/mountpoint-s3/src/cli.rs @@ -26,9 +26,8 @@ use nix::unistd::ForkResult; use regex::Regex; use sysinfo::{RefreshKind, System}; -use crate::build_info; use crate::data_cache::{CacheLimit, DiskDataCache, DiskDataCacheConfig, ExpressDataCache, ManagedCacheDir}; -use crate::fs::{CacheConfig, S3FilesystemConfig, ServerSideEncryption, TimeToLive}; +use crate::fs::{CacheConfig, ServerSideEncryption, TimeToLive}; use crate::fuse::session::FuseSession; use crate::fuse::S3FuseFilesystem; use crate::logging::{init_logging, prepare_log_file_name, LoggingConfig}; @@ -36,7 +35,7 @@ use crate::mem_limiter::MINIMUM_MEM_LIMIT; use crate::prefetch::{caching_prefetch, default_prefetch, Prefetch}; use crate::prefix::Prefix; use crate::s3::S3Personality; -use crate::{autoconfigure, metrics}; +use crate::{autoconfigure, build_info, metrics, S3Filesystem, S3FilesystemConfig}; const CLIENT_OPTIONS_HEADER: &str = "Client options"; const MOUNT_OPTIONS_HEADER: &str = "Mount options"; @@ -928,9 +927,10 @@ where Prefetcher: Prefetch + Send + Sync + 'static, { tracing::trace!(?filesystem_config, "creating file system"); - let fs = S3FuseFilesystem::new(client, prefetcher, bucket_name, prefix, filesystem_config); + let fs = S3Filesystem::new(client, prefetcher, bucket_name, prefix, filesystem_config); + let fuse_fs = S3FuseFilesystem::new(fs); tracing::debug!(?fuse_session_config, "creating fuse session"); - let session = Session::new(fs, &fuse_session_config.mount_point, &fuse_session_config.options) + let session = Session::new(fuse_fs, &fuse_session_config.mount_point, &fuse_session_config.options) .context("Failed to create FUSE session")?; let session = FuseSession::new(session, fuse_session_config.max_threads).context("Failed to start FUSE session")?; diff --git a/mountpoint-s3/src/fuse.rs b/mountpoint-s3/src/fuse.rs index 2df0ef311..f89d04d89 100644 --- a/mountpoint-s3/src/fuse.rs +++ b/mountpoint-s3/src/fuse.rs @@ -8,9 +8,8 @@ use std::time::SystemTime; use time::OffsetDateTime; use tracing::{field, instrument, Instrument}; -use crate::fs::{DirectoryEntry, DirectoryReplier, InodeNo, S3Filesystem, S3FilesystemConfig, ToErrno}; +use crate::fs::{DirectoryEntry, DirectoryReplier, InodeNo, S3Filesystem, ToErrno}; use crate::prefetch::Prefetch; -use crate::prefix::Prefix; #[cfg(target_os = "macos")] use fuser::ReplyXTimes; use fuser::{ @@ -76,15 +75,7 @@ where Client: ObjectClient + Clone + Send + Sync + 'static, Prefetcher: Prefetch, { - pub fn new( - client: Client, - prefetcher: Prefetcher, - bucket: &str, - prefix: &Prefix, - config: S3FilesystemConfig, - ) -> Self { - let fs = S3Filesystem::new(client, prefetcher, bucket, prefix, config); - + pub fn new(fs: S3Filesystem) -> Self { Self { fs } } } diff --git a/mountpoint-s3/tests/common/fuse.rs b/mountpoint-s3/tests/common/fuse.rs index 68adc376b..97fc302e2 100644 --- a/mountpoint-s3/tests/common/fuse.rs +++ b/mountpoint-s3/tests/common/fuse.rs @@ -8,7 +8,7 @@ use mountpoint_s3::data_cache::DataCache; use mountpoint_s3::fuse::S3FuseFilesystem; use mountpoint_s3::prefetch::{Prefetch, PrefetcherConfig}; use mountpoint_s3::prefix::Prefix; -use mountpoint_s3::S3FilesystemConfig; +use mountpoint_s3::{S3Filesystem, S3FilesystemConfig}; use mountpoint_s3_client::config::S3ClientAuthConfig; use mountpoint_s3_client::types::{ObjectPart, PutObjectParams}; use mountpoint_s3_client::ObjectClient; @@ -110,7 +110,13 @@ where let prefix = Prefix::new(prefix).expect("valid prefix"); let session = Session::new( - S3FuseFilesystem::new(client, prefetcher, bucket, &prefix, filesystem_config), + S3FuseFilesystem::new(S3Filesystem::new( + client, + prefetcher, + bucket, + &prefix, + filesystem_config, + )), mount_dir, &options, )