pub struct BfsBuilder<Expander, Callback, Provider, const EXPANSION_NODES: usize> { /* private fields */ }Expand description
Used to define all the parameters of a BFS and run it.
Implementations§
Source§impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>where
Expander: BfsExpander<EXPANSION_NODES> + Clone + Sync,
Callback: BfsCallback + Clone + Sync,
Provider: BfsSettingsProvider + Sync,
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>where
Expander: BfsExpander<EXPANSION_NODES> + Clone + Sync,
Callback: BfsCallback + Clone + Sync,
Provider: BfsSettingsProvider + Sync,
Sourcepub fn chunk_size_bytes(self, chunk_size_bytes: usize) -> Self
pub fn chunk_size_bytes(self, chunk_size_bytes: usize) -> Self
The size of each bit array chunk in bytes. Must be at most 2^29.
Sourcepub fn update_memory(self, update_memory: usize) -> Self
pub fn update_memory(self, update_memory: usize) -> Self
The amount of memory to use for storing updates (adjacent nodes) in bytes.
Sourcepub fn num_update_blocks(self, num_update_blocks: usize) -> Self
pub fn num_update_blocks(self, num_update_blocks: usize) -> Self
The number of blocks in which to divide the update memory.
Sourcepub fn capacity_check_frequency(self, capacity_check_frequency: usize) -> Self
pub fn capacity_check_frequency(self, capacity_check_frequency: usize) -> Self
The frequency (one check per capacity_check_frequency new nodes) at which to check the
capacity of an update block. When capacity is reached, the block will be stored and a new
block taken.
Sourcepub fn initial_states(self, initial_states: &[u64]) -> Self
pub fn initial_states(self, initial_states: &[u64]) -> Self
The nodes at depth 0, from which the search starts.
Sourcepub fn state_size(self, state_size: u64) -> Self
pub fn state_size(self, state_size: u64) -> Self
The number of nodes in the graph.
Sourcepub fn root_directories(self, root_directories: &[PathBuf]) -> Self
pub fn root_directories(self, root_directories: &[PathBuf]) -> Self
The working directories that will contain all of the intermediate data. Each directory should be on a different hard drive.
Sourcepub fn initial_memory_limit(self, initial_memory_limit: usize) -> Self
pub fn initial_memory_limit(self, initial_memory_limit: usize) -> Self
Approximate amount of memory in bytes to use for the initial in-memory breadth-first search, before switching to the disk-based search.
Sourcepub fn available_disk_space_limit(self, available_disk_space_limit: u64) -> Self
pub fn available_disk_space_limit(self, available_disk_space_limit: u64) -> Self
The minimum amount of available disk space (in bytes) that should be kept free on each drive.
Sourcepub fn update_array_threshold(self, update_array_threshold: u64) -> Self
pub fn update_array_threshold(self, update_array_threshold: u64) -> Self
The threshold at which to switch from writing an update file containing a list of node indices, to writing a bit array of updates.
Sourcepub fn use_locked_io(self, use_locked_io: bool) -> Self
pub fn use_locked_io(self, use_locked_io: bool) -> Self
Whether disk I/O should be locked using a mutex to prevent multiple threads from performing I/O on the same disk at the same time.
Sourcepub fn sync_filesystem(self, sync_filesystem: bool) -> Self
pub fn sync_filesystem(self, sync_filesystem: bool) -> Self
Whether to call sync on the filesystem before deleting files. If this is set to false and
a system failure occurs, it’s possible that data could be lost and the search would need to
be restarted from the beginning.
Sourcepub fn compute_checksums(self, compute_checksums: bool) -> Self
pub fn compute_checksums(self, compute_checksums: bool) -> Self
Whether to compute and verify checksums for all data written to disk.
Sourcepub fn use_compression(self, use_compression: bool) -> Self
pub fn use_compression(self, use_compression: bool) -> Self
Whether update files and bit arrays should be compressed.
Sourcepub fn expander(self, expander: Expander) -> Self
pub fn expander(self, expander: Expander) -> Self
The implementor of the BfsExpander trait that defines the graph to traverse.
Sourcepub fn callback(self, callback: Callback) -> Self
pub fn callback(self, callback: Callback) -> Self
The implementor of the BfsCallback trait that defines callbacks to run during the
search.
Sourcepub fn settings_provider(self, settings_provider: Provider) -> Self
pub fn settings_provider(self, settings_provider: Provider) -> Self
The implementor of the BfsSettingsProvider trait that provides various additional
settings for the search.
Sourcepub fn run_no_defaults(self) -> Result<(), BfsBuilderError>
pub fn run_no_defaults(self) -> Result<(), BfsBuilderError>
Runs the BFS with the given settings, requiring all fields of the BfsBuilder to be set
explicitly, without using any default values.
Sourcepub fn run(self) -> Result<(), BfsBuilderError>
pub fn run(self) -> Result<(), BfsBuilderError>
Runs the BFS with the given settings, using default values for any parameters that were not set, if possible.
Default values are:
threads: 1update_memory: 1 GiBcapacity_check_frequency: 256initial_memory_limit: 64 MiBuse_locked_io: falsesync_filesystem: truecompute_checksums: trueuse_compression: trueupdate_array_threshold:chunk_size_bytesnum_update_blocks:2 * threads * num_chunks, wherenum_chunks = state_size / (8 * chunk_size_bytes)
Trait Implementations§
Source§impl<Expander: Debug, Callback: Debug, Provider: Debug, const EXPANSION_NODES: usize> Debug for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
impl<Expander: Debug, Callback: Debug, Provider: Debug, const EXPANSION_NODES: usize> Debug for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
Source§impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> Default for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>where
Expander: BfsExpander<EXPANSION_NODES> + Clone + Sync,
Callback: BfsCallback + Clone + Sync,
Provider: BfsSettingsProvider + Sync,
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> Default for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>where
Expander: BfsExpander<EXPANSION_NODES> + Clone + Sync,
Callback: BfsCallback + Clone + Sync,
Provider: BfsSettingsProvider + Sync,
Auto Trait Implementations§
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> Freeze for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> RefUnwindSafe for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> Send for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> Sync for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> Unpin for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
impl<Expander, Callback, Provider, const EXPANSION_NODES: usize> UnwindSafe for BfsBuilder<Expander, Callback, Provider, EXPANSION_NODES>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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