Complete API reference for Reflow components and systems.
- Creating Graphs - Basic graph operations and management
- Graph Analysis - Validation and performance analysis
- Graph Layout - Positioning and visualization
- Advanced Features - History, optimization, and extensions
- Creating Actors - Actor implementation and lifecycle
- Message Passing - Communication patterns
- Actor Model - Architectural concepts
- Network Management - Network creation and control
- Connection Handling - Connection management
- Event System - Network events and monitoring
- Message Types - Supported message formats
- Port Management - Input/output port handling
- Message Routing - Message routing and delivery
- Deno Runtime - JavaScript execution environment
- Module System - Module loading and management
- Permissions - Security and sandboxing
- Python Runtime - Python execution environment
- Package Management - Python package handling
- Virtual Environments - Isolation and dependencies
- WASM Runtime - WebAssembly execution
- Module Loading - WASM module management
- Memory Management - Memory allocation and cleanup
- Component Library - Built-in components
- Custom Components - Creating custom components
- Component Lifecycle - Component management
- Data Transformation - Data processing components
- Validation - Data validation components
- Aggregation - Data aggregation operations
- Conditional Logic - Branching and conditions
- Loops and Iteration - Iterative processing
- Error Handling - Error management
[runtime]
thread_pool_size = 8 # Number of worker threads
log_level = "info" # Logging level: trace, debug, info, warn, error
hot_reload = false # Enable hot reloading in development
[memory]
max_heap_size = "1GB" # Maximum heap size
gc_frequency = 100 # Garbage collection frequency[network]
max_connections = 1000 # Maximum concurrent connections
timeout_ms = 5000 # Connection timeout in milliseconds
buffer_size = 8192 # Message buffer size
[websocket]
enable = true # Enable WebSocket support
port = 8080 # WebSocket port
max_frame_size = 65536 # Maximum frame size[scripts.deno]
enable = true
allow_net = false # Network access permission
allow_read = true # File read permission
allow_write = false # File write permission
[scripts.python]
enable = true
virtual_env = "venv" # Virtual environment path
requirements = "requirements.txt"
[scripts.wasm]
enable = true
max_memory = "64MB" # Maximum WASM memory
stack_size = "1MB" # Stack sizeE001- Actor initialization failedE002- Message routing errorE003- Network connection failedE004- Script execution errorE005- Memory allocation failed
G001- Invalid graph structureG002- Cycle detected in graphG003- Port type mismatchG004- Orphaned node detectedG005- Invalid connection
C001- Component not foundC002- Invalid component configurationC003- Component lifecycle errorC004- Port compatibility errorC005- Component execution timeout
// Graph types
pub struct Graph {
pub name: String,
pub directed: bool,
pub metadata: HashMap<String, Value>,
}
pub struct GraphNode {
pub id: String,
pub component: String,
pub metadata: HashMap<String, Value>,
}
pub struct GraphConnection {
pub from_node: String,
pub from_port: String,
pub to_node: String,
pub to_port: String,
pub metadata: Option<HashMap<String, Value>>,
}
// Message types
pub enum Message {
Null,
Boolean(bool),
Integer(i64),
Float(f64),
String(String),
Array(Vec<Message>),
Object(HashMap<String, Message>),
Binary(Vec<u8>),
}
// Actor types
pub trait Actor: Send + Sync {
fn process(&mut self, inputs: HashMap<String, Message>) -> Result<HashMap<String, Message>, ActorError>;
fn get_input_ports(&self) -> Vec<PortDefinition>;
fn get_output_ports(&self) -> Vec<PortDefinition>;
}pub struct RuntimeConfig {
pub thread_pool_size: usize,
pub log_level: String,
pub hot_reload: bool,
}
pub struct NetworkConfig {
pub max_connections: usize,
pub timeout_ms: u64,
pub buffer_size: usize,
}
pub struct ScriptConfig {
pub runtime: ScriptRuntime,
pub source: String,
pub entry_point: String,
pub permissions: ScriptPermissions,
}// Create and manage graphs
const graph = new Graph("MyGraph", true, {});
graph.addNode("node1", "Component", {});
graph.addConnection("node1", "out", "node2", "in", {});
// Graph analysis
const validation = graph.validate();
const cycles = graph.detectCycles();
const layout = graph.calculateLayout();// Network management
const network = new Network();
network.addActor("processor", processorActor);
network.connect("source", "output", "processor", "input");
await network.start();// Message creation and handling
const message = Message.fromJson({"key": "value"});
const result = await actor.process({"input": message});REFLOW_LOG_LEVEL- Override logging levelREFLOW_THREAD_POOL_SIZE- Override thread pool sizeREFLOW_CONFIG_PATH- Configuration file path
REFLOW_DEV_MODE- Enable development featuresREFLOW_HOT_RELOAD- Enable hot reloadingREFLOW_DEBUG_ACTORS- Enable actor debugging
REFLOW_PRODUCTION- Enable production optimizationsREFLOW_METRICS_ENDPOINT- Metrics collection endpointREFLOW_HEALTH_CHECK_PORT- Health check port
- Use memory pooling for frequently allocated objects
- Configure appropriate garbage collection settings
- Monitor memory usage with built-in profiling tools
- Balance thread pool size with available CPU cores
- Use async operations for I/O bound tasks
- Implement backpressure for high-throughput scenarios
- Enable compiler optimizations for production builds
- Use profile-guided optimization when available
- Monitor performance metrics and bottlenecks
- Troubleshooting Guide - Common issues and solutions
- Performance Optimization - Advanced optimization techniques
- Extended APIs - Creating custom extensions