#llm #registry #ml

llm-registry-db

Database layer for the LLM Registry - PostgreSQL integration with migrations and repository patterns

1 unstable release

0.1.0 Nov 18, 2025

#135 in #registry


Used in 3 crates (2 directly)

Apache-2.0 OR MIT

215KB
4.5K SLoC

Database layer for LLM Registry

This crate provides database persistence for the LLM Registry system, including:

  • Connection pool management with deadpool
  • Repository trait abstractions for assets
  • PostgreSQL implementation with SQLx
  • Event store for audit trails and event sourcing
  • Database migrations
  • Comprehensive error handling

Features

  • Compile-time verified queries: Using SQLx macros for type-safe SQL
  • Connection pooling: Efficient connection management with configurable pools
  • Transaction support: ACID guarantees for multi-step operations
  • Event sourcing: Complete audit trail of all registry operations
  • Flexible search: Full-text search and filtering capabilities
  • Dependency tracking: Graph-based dependency management with cycle detection

Example

use llm_registry_db::{PoolConfig, create_pool, PostgresAssetRepository};
use llm_registry_core::Asset;

// Create a connection pool
let config = PoolConfig::new("postgres://localhost/llm_registry")
    .max_connections(10);
let pool = create_pool(&config).await?;

// Create repository
let repo = PostgresAssetRepository::new(pool);

// Use the repository
// let asset = repo.create(my_asset).await?;

Dependencies

~59–81MB
~1.5M SLoC