Expand description
ManifoldDB - A Multi-Paradigm Embedded Database
ManifoldDB is an embedded database that unifies graph, vector, and relational data operations in a single system.
§Features
- Graph Database: Store and traverse nodes and relationships
- Vector Database: Store embeddings and perform similarity search
- SQL Support: Query using familiar SQL syntax with extensions
- ACID Transactions: Full transactional support across all operations
§Quick Start
§Opening a Database
ⓘ
use manifoldb::Database;
// Open or create a database file
let db = Database::open("mydb.manifold")?;
// Or create an in-memory database for testing
let db = Database::in_memory()?;§Using Transactions
ManifoldDB provides ACID transactions for all operations:
ⓘ
use manifoldb::Database;
let db = Database::in_memory()?;
// Write transaction
let mut tx = db.begin()?;
let entity = tx.create_entity()?.with_label("Person").with_property("name", "Alice");
tx.put_entity(&entity)?;
tx.commit()?;
// Read transaction
let tx = db.begin_read()?;
if let Some(entity) = tx.get_entity(entity_id)? {
println!("Found: {:?}", entity);
}§Executing SQL Queries
ⓘ
use manifoldb::Database;
let db = Database::open("mydb.manifold")?;
// Execute statements
db.execute("INSERT INTO users (name, age) VALUES ('Alice', 30)")?;
// Query data
let results = db.query("SELECT * FROM users WHERE age > 25")?;
for row in results {
println!("{:?}", row);
}§Graph Operations
ⓘ
use manifoldb::Database;
let db = Database::in_memory()?;
let mut tx = db.begin()?;
// Create nodes
let alice = tx.create_entity()?.with_label("Person").with_property("name", "Alice");
let bob = tx.create_entity()?.with_label("Person").with_property("name", "Bob");
tx.put_entity(&alice)?;
tx.put_entity(&bob)?;
// Create edges
let follows = tx.create_edge(alice.id, bob.id, "FOLLOWS")?;
tx.put_edge(&follows)?;
tx.commit()?;
// Query with graph patterns
let friends = db.query("
SELECT * FROM users
MATCH (u)-[:FOLLOWS]->(f)
WHERE u.name = 'Alice'
")?;§Vector Search
ⓘ
use manifoldb::{Database, Value};
let db = Database::open("mydb.manifold")?;
// Store vectors as entity properties
let mut tx = db.begin()?;
let doc = tx.create_entity()?
.with_label("Document")
.with_property("embedding", vec![0.1f32, 0.2, 0.3]);
tx.put_entity(&doc)?;
tx.commit()?;
// Vector similarity search
let query_vector = vec![0.1f32, 0.2, 0.3];
let similar = db.query_with_params("
SELECT * FROM documents
ORDER BY embedding <-> $1
LIMIT 10
", &[Value::Vector(query_vector)])?;§Configuration
Use DatabaseBuilder for advanced configuration:
ⓘ
use manifoldb::{DatabaseBuilder, VectorSyncStrategy};
let db = DatabaseBuilder::new()
.path("mydb.manifold")
.cache_size(128 * 1024 * 1024) // 128MB cache
.vector_sync_strategy(VectorSyncStrategy::Async)
.open()?;§Modules
config- Database configuration and builderdatabase- Main database interfaceerror- Error typestransaction- Transaction management
Re-exports§
pub use config::Config;pub use config::DatabaseBuilder;pub use database::Database;pub use database::FromValue;pub use database::QueryParams;pub use database::QueryResult;pub use database::QueryRow;pub use error::Error;pub use error::Result;pub use metrics::CacheMetricsSnapshot;pub use metrics::DatabaseMetrics;pub use metrics::MetricsSnapshot;pub use metrics::QueryMetrics;pub use metrics::QueryMetricsSnapshot;pub use metrics::StorageMetrics;pub use metrics::StorageMetricsSnapshot;pub use metrics::TransactionMetrics;pub use metrics::TransactionMetricsSnapshot;pub use metrics::VectorMetrics;pub use metrics::VectorMetricsSnapshot;pub use prepared::PreparedStatement;pub use prepared::PreparedStatementCache;pub use transaction::BatchWriter;pub use transaction::BatchWriterConfig;pub use transaction::BatchedTransaction;pub use transaction::DatabaseTransaction;pub use transaction::TransactionManager;pub use transaction::TransactionManagerConfig;pub use transaction::VectorSyncStrategy;pub use transaction::WriteBuffer;pub use transaction::WriteOp;pub use transaction::WriteQueue;pub use index::IndexInfo;pub use index::IndexMetadata;pub use index::IndexStats;pub use index::IndexType;
Modules§
- backup
- Backup and restore utilities for ManifoldDB.
- cache
- Query result caching for ManifoldDB.
- config
- Database configuration and builder pattern.
- database
- Main database interface.
- error
- Error types for
ManifoldDB. - execution
- SQL execution bridge.
- index
- Payload indexing for efficient filtered vector search.
- metrics
- Metrics and observability for
ManifoldDB. - prepared
- Prepared statements with query plan caching.
- schema
- Schema metadata storage for DDL operations.
- transaction
- Transaction management for
ManifoldDB. - vector
- Vector index management for HNSW indexes.
Macros§
- params
- Create query parameters from an array.
Structs§
- Collection
Id - Unique identifier for a collection in the database.
- Delete
Result - Result of a cascade delete operation.
- Edge
- An edge (relationship) between two entities in the graph.
- EdgeId
- Unique identifier for an edge (relationship) in the graph.
- Edge
Type - The type of an edge, describing the relationship.
- Entity
- An entity (node) in the graph.
- Entity
Id - Unique identifier for an entity (node) in the graph.
- Entity
Search Builder - Builder for unified vector search operations.
- Label
- A label that categorizes an entity.
- Property
- A key-value property on an entity or edge.
- Scored
Entity - An entity with an associated similarity score from vector search.
- Scored
Id - A lightweight scored reference containing just the ID and score.
- Traversal
Constraint - A constraint that limits vector search results to entities reachable via a graph traversal.
- Traversal
Pattern Builder - Builder for constructing graph traversal patterns.
Enums§
- Distance
Metric - Distance metric for comparing vectors.
- Filter
- A filter expression for narrowing search results.
- Sparse
Distance Metric - Sparse distance metric for comparing sparse vectors.
- Transaction
Error - Errors that can occur during transaction operations.
- Value
- A value that can be stored as a property on an entity or edge.
- Vector
Data - Vector data supporting different embedding types.
Traits§
- Storage
Engine - A storage engine that provides transactional key-value operations.
- Transaction
- A transaction that provides ACID key-value operations.
Type Aliases§
- Transaction
Result - Result type alias for transaction operations.