Expand description
OxiFY Storage - SQLite persistence layer
This crate provides database storage for workflows and executions using SQLite.
§Architecture Overview
§Connection Pooling Strategy
The storage layer uses sqlx::SqlitePool for connection management with the following strategy:
§Configuration
- Max Connections: Configurable (default: 10) - Upper limit of connections in pool
- Min Connections: Configurable (default: 2) - Minimum idle connections to maintain
- Acquire Timeout: 30 seconds - Maximum time to wait for an available connection
§Best Practices
- Use WAL mode for better concurrency
- Keep transactions short
- Use pool methods, never create direct connections
Example:
ⓘ
let config = DatabaseConfig {
database_url: "sqlite:oxify.db?mode=rwc".to_string(),
max_connections: 20,
min_connections: 5,
};
let pool = DatabasePool::new(config).await?;Re-exports§
pub use cache::Cache;pub use cache::CacheConfig;pub use cache::CacheMetrics;pub use cache::CacheStats;pub use connection_leak_detector::ConnectionToken;pub use connection_leak_detector::LeakDetector;pub use connection_leak_detector::LeakDetectorConfig;pub use connection_leak_detector::LeakReport;pub use connection_leak_detector::LeakStats;pub use connection_leak_detector::SuspectedLeak;pub use health::ComponentHealth;pub use health::HealthCheck;pub use health::HealthCheckConfig;pub use health::HealthReport;pub use health::HealthStatus;pub use maintenance::IndexBloatInfo;pub use maintenance::MaintenanceConfig;pub use maintenance::MaintenanceResults;pub use maintenance::MaintenanceService;pub use maintenance::TableStats;pub use metrics_exporter::Metric;pub use metrics_exporter::MetricType;pub use metrics_exporter::MetricsExporter;pub use metrics_exporter::MetricsFormat;pub use migration_runner::Migration;pub use migration_runner::MigrationRunner;pub use migration_runner::MigrationStatus;pub use pagination::CursorDirection;pub use pagination::PageInfo;pub use pagination::PaginationBuilder;pub use pagination::PaginationRequest;pub use pagination::PaginationResponse;pub use pagination::PaginationStrategy;pub use soft_delete::SoftDeleteBuilder;pub use soft_delete::SoftDeleteFilter;pub use soft_delete::SoftDeleteMetadata;pub use soft_delete::SoftDeleteRestorer;
Modules§
- cache
- In-Memory Caching Layer
- connection_
leak_ detector - Connection leak detection and monitoring
- db_
utils - Database utility functions
- health
- Health check system for production monitoring
- maintenance
- Database Maintenance Utilities for SQLite
- metrics_
exporter - Prometheus Metrics Exporter
- migration_
runner - Database Migration Runner
- migrations
- Database migration utilities
- pagination
- Pagination utilities for database queries
- query_
builder - SQL Query Builder Utilities
- retry
- Retry utilities for handling transient database errors
- soft_
delete - Soft delete utilities for marking records as deleted without physical removal
- validation
- Validation utilities for storage layer
Structs§
- Bulk
Operation Result - Result of a bulk operation for a single item
- Database
Config - Database configuration
- Database
Pool - Database connection pool
- Encryption
Service - Encryption service for secrets
- Execution
Row - Database row for executions (SQLite compatible)
- Execution
Store - Execution storage layer
- Import
Error - Import error for a single workflow
- Import
Options - Import options
- Import
Result - Import result with statistics
- Pool
Metrics - Extended pool metrics for monitoring and observability
- Pool
Stats - Pool statistics
- User
Permission Row - Database row for user permissions
- User
Role Row - Database row for user roles
- UserRow
- Database row for users (SQLite compatible)
- User
Store - User storage operations
- Version
Comparison - Comparison between two workflow versions
- Workflow
Export - Workflow export format
- Workflow
Row - Database row for workflows (SQLite compatible) Note: tags is stored as JSON string, not array
- Workflow
Store - Workflow storage layer
- Workflow
Version - Workflow version record
- Workflow
Version Store - Workflow version storage layer
Enums§
- Conflict
Strategy - Strategy for handling conflicts during import
- Pool
Health - Pool health status
- Resource
Id - Resource identifier that can be a UUID, string, or other type
- Resource
Type - Resource type for not found errors
- Storage
Error - Errors that can occur during storage operations
Type Aliases§
- Result
- Result type for storage operations