Remove deprecated storage backends and Kubernetes deployment configuration: - Delete unused storage implementations: FAISS, JSON, Memgraph, Milvus, MongoDB, Nano Vector DB, Neo4j, NetworkX, Qdrant, Redis - Remove Kubernetes deployment manifests and installation scripts - Delete legacy examples for deprecated backends - Consolidate to PostgreSQL-only storage backend Streamline dependencies and add new capabilities: - Remove deprecated code documentation and migration guides - Add full-text search caching layer with FTS cache module - Implement metrics collection and monitoring pipeline - Add explain and metrics API routes - Simplify configuration with PostgreSQL-focused setup Update documentation and configuration: - Rewrite README to focus on supported features - Update environment and configuration examples - Remove Kubernetes-specific documentation - Add new utility scripts for PDF uploads and pipeline monitoring
71 lines
2.3 KiB
Python
71 lines
2.3 KiB
Python
STORAGE_IMPLEMENTATIONS = {
|
|
'KV_STORAGE': {
|
|
'implementations': [
|
|
'PGKVStorage',
|
|
],
|
|
'required_methods': ['get_by_id', 'upsert'],
|
|
},
|
|
'GRAPH_STORAGE': {
|
|
'implementations': [
|
|
'PGGraphStorage',
|
|
],
|
|
'required_methods': ['upsert_node', 'upsert_edge'],
|
|
},
|
|
'VECTOR_STORAGE': {
|
|
'implementations': [
|
|
'PGVectorStorage',
|
|
],
|
|
'required_methods': ['query', 'upsert'],
|
|
},
|
|
'DOC_STATUS_STORAGE': {
|
|
'implementations': [
|
|
'PGDocStatusStorage',
|
|
],
|
|
'required_methods': ['get_docs_by_status'],
|
|
},
|
|
}
|
|
|
|
# Storage implementation environment variable without default value
|
|
STORAGE_ENV_REQUIREMENTS: dict[str, list[str]] = {
|
|
# KV Storage Implementations
|
|
'PGKVStorage': ['POSTGRES_USER', 'POSTGRES_PASSWORD', 'POSTGRES_DATABASE'],
|
|
# Graph Storage Implementations
|
|
'PGGraphStorage': [
|
|
'POSTGRES_USER',
|
|
'POSTGRES_PASSWORD',
|
|
'POSTGRES_DATABASE',
|
|
],
|
|
# Vector Storage Implementations
|
|
'PGVectorStorage': ['POSTGRES_USER', 'POSTGRES_PASSWORD', 'POSTGRES_DATABASE'],
|
|
# Document Status Storage Implementations
|
|
'PGDocStatusStorage': ['POSTGRES_USER', 'POSTGRES_PASSWORD', 'POSTGRES_DATABASE'],
|
|
}
|
|
|
|
# Storage implementation module mapping
|
|
STORAGES = {
|
|
'PGKVStorage': '.kg.postgres_impl',
|
|
'PGVectorStorage': '.kg.postgres_impl',
|
|
'PGGraphStorage': '.kg.postgres_impl',
|
|
'PGDocStatusStorage': '.kg.postgres_impl',
|
|
}
|
|
|
|
|
|
def verify_storage_implementation(storage_type: str, storage_name: str) -> None:
|
|
"""Verify if storage implementation is compatible with specified storage type
|
|
|
|
Args:
|
|
storage_type: Storage type (KV_STORAGE, GRAPH_STORAGE etc.)
|
|
storage_name: Storage implementation name
|
|
|
|
Raises:
|
|
ValueError: If storage implementation is incompatible or missing required methods
|
|
"""
|
|
if storage_type not in STORAGE_IMPLEMENTATIONS:
|
|
raise ValueError(f'Unknown storage type: {storage_type}')
|
|
|
|
storage_info = STORAGE_IMPLEMENTATIONS[storage_type]
|
|
if storage_name not in storage_info['implementations']:
|
|
raise ValueError(
|
|
f"Storage implementation '{storage_name}' is not compatible with {storage_type}. "
|
|
f'Compatible implementations are: {", ".join(storage_info["implementations"])}'
|
|
)
|