Skip to main content

LoadConfig

Struct LoadConfig 

Source
pub struct LoadConfig<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> { /* private fields */ }
Expand description

A load configuration for a BvGraph/BvGraphSeq.

A basic configuration is returned by BvGraph::with_basename/BvGraphSeq::with_basename. The configuration can then be customized using the setter methods of this struct, chained in builder style, and finalized by calling load.

§Defaults

The default configuration returned by with_basename uses:

§Configuration Axes

§Access Mode

  • BvGraph::with_basename returns a configuration for random access, which requires the Elias–Fano offsets file (.ef). The resulting graph supports both random access and sequential iteration.
  • BvGraphSeq::with_basename returns a configuration for sequential access, which only needs the graph file (.graph). The resulting graph supports only sequential iteration.

§Endianness

  • endianness: sets the endianness of the graph file. Use endianness::<BE>() for big-endian (the default and the Java convention) or endianness::<LE>() for little-endian.

§Code Dispatch

  • dispatch: chooses between:
    • Dynamic (default): reads the codes from the properties file; slightly slower due to indirect dispatch, but works with any graph.
    • Static: the codes are fixed at compile time via const generics, enabling more aggressive optimization. The defaults match the Java defaults (γ for outdegrees, unary for references, γ for blocks, γ for intervals, ζ₃ for residuals). If your graph uses non-default codes, you must specify them explicitly.

§Load Mode

Controls how the graph bitstream and the offsets are accessed.

  • mode: sets the load mode for both the graph and the offsets. You can also set them independently:
    • graph_mode: sets the mode for the graph only;
    • offsets_mode: sets the mode for the offsets only (random access only).

The available modes are:

  • Mmap (default): memory maps the file. This is the most memory-efficient mode, as the OS manages paging. It is the recommended mode for large graphs.
  • LoadMem: reads the file into allocated memory.
  • LoadMmap: reads the file into memory obtained via mmap, rather than the standard allocator.
  • File: reads the graph from a file stream. The offsets are fully deserialized in memory using ε-serde’s load_full. Note that the graph file must be padded correctly for this mode.

§Memory flags

When using Mmap or LoadMmap, you can set MemoryFlags to request transparent huge pages, etc.:

  • flags: sets flags for both the graph and offsets.
  • graph_flags: sets flags for the graph only.
  • offsets_flags: sets flags for the offsets only (random access only).

§Examples

Load with all defaults (big-endian, dynamic dispatch, memory-mapped):

let graph = BvGraph::with_basename("BASENAME").load()?;

Load a little-endian graph:

let graph = BvGraph::with_basename("BASENAME")
    .endianness::<LE>()
    .load()?;

Load with static dispatch (using default codes):

let graph = BvGraph::with_basename("BASENAME")
    .dispatch::<Static>()
    .load()?;

Load into memory rather than memory-mapping:

let graph = BvGraph::with_basename("BASENAME")
    .mode::<LoadMem>()
    .load()?;

Load a sequential-access graph (no .ef file needed):

let graph = BvGraphSeq::with_basename("BASENAME").load()?;

Combine options:

let graph = BvGraph::with_basename("BASENAME")
    .endianness::<LE>()
    .dispatch::<Static>()
    .mode::<LoadMem>()
    .load()?;

Implementations§

Source§

impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>

Source

pub fn endianness<E2: Endianness>(self) -> LoadConfig<E2, A, D, GLM, OLM>
where GLM: LoadMode, OLM: LoadMode,

Set the endianness of the graph and offsets file.

Source§

impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>

Source

pub fn dispatch<D2: Dispatch>(self) -> LoadConfig<E, A, D2, GLM, OLM>

Choose between Static and Dynamic dispatch.

Source§

impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>

Source

pub fn mode<LM: LoadMode>(self) -> LoadConfig<E, A, D, LM, LM>

Choose the LoadMode for the graph and offsets.

Source§

impl<E: Endianness, A: Access, D: Dispatch> LoadConfig<E, A, D, Mmap, Mmap>

Source

pub fn flags(self, flags: MemoryFlags) -> LoadConfig<E, A, D, Mmap, Mmap>

Set flags for memory-mapping (both graph and offsets).

Source§

impl<E: Endianness, A: Access, D: Dispatch> LoadConfig<E, A, D, LoadMmap, LoadMmap>

Source

pub fn flags( self, flags: MemoryFlags, ) -> LoadConfig<E, A, D, LoadMmap, LoadMmap>

Set flags for memory obtained from mmap() (both graph and offsets).

Source§

impl<E: Endianness, A: Access, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, A, D, GLM, OLM>

Source

pub fn graph_mode<NGLM: LoadMode>(self) -> LoadConfig<E, A, D, NGLM, OLM>

Choose the LoadMode for the graph only.

Source§

impl<E: Endianness, A: Access, D: Dispatch, OLM: LoadMode> LoadConfig<E, A, D, Mmap, OLM>

Source

pub fn graph_flags(self, flags: MemoryFlags) -> LoadConfig<E, A, D, Mmap, OLM>

Set flags for memory-mapping the graph.

Source§

impl<E: Endianness, A: Access, D: Dispatch, OLM: LoadMode> LoadConfig<E, A, D, LoadMmap, OLM>

Source

pub fn graph_flags( self, flags: MemoryFlags, ) -> LoadConfig<E, A, D, LoadMmap, OLM>

Set flags for memory obtained from mmap() for the graph.

Source§

impl<E: Endianness, D: Dispatch, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Random, D, GLM, OLM>

Source

pub fn offsets_mode<NOLM: LoadMode>(self) -> LoadConfig<E, Random, D, GLM, NOLM>

Choose the LoadMode for the offsets only.

Source§

impl<E: Endianness, D: Dispatch, GLM: LoadMode> LoadConfig<E, Random, D, GLM, Mmap>

Source

pub fn offsets_flags( self, flags: MemoryFlags, ) -> LoadConfig<E, Random, D, GLM, Mmap>

Set flags for memory-mapping the offsets.

Source§

impl<E: Endianness, D: Dispatch, GLM: LoadMode> LoadConfig<E, Random, D, GLM, LoadMmap>

Source

pub fn offsets_flags( self, flags: MemoryFlags, ) -> LoadConfig<E, Random, D, GLM, LoadMmap>

Set flags for memory obtained from mmap() for the graph.

Source§

impl<E: Endianness, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Random, Dynamic, GLM, OLM>

Source

pub fn load( self, ) -> Result<BvGraph<DynCodesDecoderFactory<E, GLM::Factory<E>, OLM::Offsets>>>
where <GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>, for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E> + BitSeek,

Load a random-access graph with dynamic dispatch.

Source§

impl<E: Endianness, GLM: LoadMode, OLM: LoadMode> LoadConfig<E, Sequential, Dynamic, GLM, OLM>

Source

pub fn load( self, ) -> Result<BvGraphSeq<DynCodesDecoderFactory<E, GLM::Factory<E>, Owned<EmptyDict<usize, usize>>>>>
where <GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>, for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E>,

Load a sequential graph with dynamic dispatch.

Source§

impl<E: Endianness, GLM: LoadMode, OLM: LoadMode, const OUTDEGREES: usize, const REFERENCES: usize, const BLOCKS: usize, const INTERVALS: usize, const RESIDUALS: usize> LoadConfig<E, Random, Static<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>, GLM, OLM>

Source

pub fn load( self, ) -> Result<BvGraph<ConstCodesDecoderFactory<E, GLM::Factory<E>, OLM::Offsets, OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>>>
where <GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>, for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E> + BitSeek,

Load a random-access graph with static dispatch.

Source§

impl<E: Endianness, GLM: LoadMode, OLM: LoadMode, const OUTDEGREES: usize, const REFERENCES: usize, const BLOCKS: usize, const INTERVALS: usize, const RESIDUALS: usize> LoadConfig<E, Sequential, Static<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>, GLM, OLM>

Source

pub fn load( self, ) -> Result<BvGraphSeq<ConstCodesDecoderFactory<E, GLM::Factory<E>, Owned<EmptyDict<usize, usize>>, OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS>>>
where <GLM as LoadMode>::Factory<E>: CodesReaderFactoryHelper<E>, for<'a> LoadModeCodesReader<'a, E, GLM>: CodesRead<E>,

Load a sequential graph with static dispatch.

Trait Implementations§

Source§

impl<E: Clone + Endianness, A: Clone + Access, D: Clone + Dispatch, GLM: Clone + LoadMode, OLM: Clone + LoadMode> Clone for LoadConfig<E, A, D, GLM, OLM>

Source§

fn clone(&self) -> LoadConfig<E, A, D, GLM, OLM>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug + Endianness, A: Debug + Access, D: Debug + Dispatch, GLM: Debug + LoadMode, OLM: Debug + LoadMode> Debug for LoadConfig<E, A, D, GLM, OLM>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E, A, D, GLM, OLM> Freeze for LoadConfig<E, A, D, GLM, OLM>

§

impl<E, A, D, GLM, OLM> RefUnwindSafe for LoadConfig<E, A, D, GLM, OLM>

§

impl<E, A, D, GLM, OLM> Send for LoadConfig<E, A, D, GLM, OLM>
where A: Send, D: Send, GLM: Send, OLM: Send,

§

impl<E, A, D, GLM, OLM> Sync for LoadConfig<E, A, D, GLM, OLM>
where A: Sync, D: Sync, GLM: Sync, OLM: Sync,

§

impl<E, A, D, GLM, OLM> Unpin for LoadConfig<E, A, D, GLM, OLM>
where E: Unpin, A: Unpin, D: Unpin, GLM: Unpin, OLM: Unpin,

§

impl<E, A, D, GLM, OLM> UnsafeUnpin for LoadConfig<E, A, D, GLM, OLM>

§

impl<E, A, D, GLM, OLM> UnwindSafe for LoadConfig<E, A, D, GLM, OLM>
where E: UnwindSafe, A: UnwindSafe, D: UnwindSafe, GLM: UnwindSafe, OLM: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CastableFrom<T> for T

Source§

fn cast_from(value: T) -> T

Call Self as W
Source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

Source§

fn cast(self) -> U

Call W::cast_from(self)
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DowncastableFrom<T> for T

Source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
Source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

Source§

fn downcast(self) -> U

Call W::downcast_from(self)
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Splat<T> for T

Source§

fn splat(value: T) -> T

Source§

impl<T> To<T> for T

Source§

fn to(self) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UpcastableFrom<T> for T

Source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
Source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

Source§

fn upcast(self) -> U

Call W::upcast_from(self)
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V