Skip to main content

Module colony_builder

Module colony_builder 

Source
Expand description

Colony builder with configurable persistence.

Provides a builder pattern for creating colonies with optional SQLite-backed persistence for the knowledge graph.

§Architecture

The Colony uses PetTopologyGraph internally for simulation (required for reference-based operations). Persistence is handled by:

  • Loading initial state from SQLite on creation
  • Saving state to SQLite on explicit save or drop

This gives the benefits of persistence without compromising simulation performance.

§Example

use phago_runtime::colony_builder::ColonyBuilder;
use phago_runtime::backend::BackendConfig;

// Create a colony with SQLite persistence
let mut colony = ColonyBuilder::new()
    .with_persistence("knowledge.db")
    .auto_save(true)
    .build()?;

// Run simulation
colony.run(100);

// Explicitly save (also happens on drop if auto_save is enabled)
colony.save()?;

Structs§

ColonyBuilder
Builder for creating colonies with optional persistence.
PersistentColony
A Colony with optional SQLite persistence.

Enums§

BuilderError
Error type for colony builder operations.