MCPcopy Create free account
hub / github.com/apache/datafusion / try_new

Method try_new

datafusion/execution/src/disk_manager.rs:197–225  ·  view source on GitHub ↗
(config: DiskManagerConfig)

Source from the content-addressed store, hash-verified

195 #[expect(deprecated)]
196 #[deprecated(since = "48.0.0", note = "Use DiskManager::builder() instead")]
197 pub fn try_new(config: DiskManagerConfig) -> Result<Arc<Self>> {
198 match config {
199 DiskManagerConfig::Existing(manager) => Ok(manager),
200 DiskManagerConfig::NewOs => Ok(Arc::new(Self {
201 local_dirs: Mutex::new(Some(vec![])),
202 max_temp_directory_size: DEFAULT_MAX_TEMP_DIRECTORY_SIZE,
203 used_disk_space: Arc::new(AtomicU64::new(0)),
204 active_files_count: Arc::new(AtomicUsize::new(0)),
205 })),
206 DiskManagerConfig::NewSpecified(conf_dirs) => {
207 let local_dirs = create_local_dirs(&conf_dirs)?;
208 debug!(
209 "Created local dirs {local_dirs:?} as DataFusion working directory"
210 );
211 Ok(Arc::new(Self {
212 local_dirs: Mutex::new(Some(local_dirs)),
213 max_temp_directory_size: DEFAULT_MAX_TEMP_DIRECTORY_SIZE,
214 used_disk_space: Arc::new(AtomicU64::new(0)),
215 active_files_count: Arc::new(AtomicUsize::new(0)),
216 }))
217 }
218 DiskManagerConfig::Disabled => Ok(Arc::new(Self {
219 local_dirs: Mutex::new(None),
220 max_temp_directory_size: DEFAULT_MAX_TEMP_DIRECTORY_SIZE,
221 used_disk_space: Arc::new(AtomicU64::new(0)),
222 active_files_count: Arc::new(AtomicUsize::new(0)),
223 })),
224 }
225 }
226
227 pub fn set_max_temp_directory_size(
228 &mut self,

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
create_local_dirsFunction · 0.85

Tested by

no test coverage detected