pub struct DiskManager {
local_dirs: Mutex<Option<Vec<Arc<TempDir>>>>,
max_temp_directory_size: u64,
used_disk_space: Arc<AtomicU64>,
}Expand description
Manages files generated during query execution, e.g. spill files generated while processing dataset larger than available memory.
Fields§
§local_dirs: Mutex<Option<Vec<Arc<TempDir>>>>TempDirs to put temporary files in.
If Some(vec![]) a new OS specified temporary directory will be created
If None an error will be returned (configured not to spill)
max_temp_directory_size: u64The maximum amount of data (in bytes) stored inside the temporary directories. Default to 100GB
used_disk_space: Arc<AtomicU64>Used disk space in the temporary directories. Now only spilled data for external executors are counted.
Implementations§
Source§impl DiskManager
impl DiskManager
Sourcepub fn builder() -> DiskManagerBuilder
pub fn builder() -> DiskManagerBuilder
Creates a builder for DiskManager
Sourcepub fn try_new(config: DiskManagerConfig) -> Result<Arc<Self>>
👎Deprecated since 48.0.0: Use DiskManager::builder() instead
pub fn try_new(config: DiskManagerConfig) -> Result<Arc<Self>>
Create a DiskManager given the configuration
pub fn set_max_temp_directory_size( &mut self, max_temp_directory_size: u64, ) -> Result<()>
pub fn set_arc_max_temp_directory_size( this: &mut Arc<Self>, max_temp_directory_size: u64, ) -> Result<()>
pub fn with_max_temp_directory_size( self, max_temp_directory_size: u64, ) -> Result<Self>
pub fn used_disk_space(&self) -> u64
Sourcepub fn tmp_files_enabled(&self) -> bool
pub fn tmp_files_enabled(&self) -> bool
Return true if this disk manager supports creating temporary
files. If this returns false, any call to create_tmp_file
will error.
Sourcepub fn create_tmp_file(
self: &Arc<Self>,
request_description: &str,
) -> Result<RefCountedTempFile>
pub fn create_tmp_file( self: &Arc<Self>, request_description: &str, ) -> Result<RefCountedTempFile>
Return a temporary file from a randomized choice in the configured locations
If the file can not be created for some reason, returns an error message referencing the request description
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DiskManager
impl !RefUnwindSafe for DiskManager
impl Send for DiskManager
impl Sync for DiskManager
impl Unpin for DiskManager
impl UnwindSafe for DiskManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more