This commit is contained in:
jinli.yl 2026-05-26 15:55:42 +08:00
parent 9a7877a3a4
commit 6ad02f0a8f
4 changed files with 10 additions and 7 deletions

View file

@ -1,4 +1,4 @@
"""File catalog """
"""file catalog"""
from .base_file_catalog import BaseFileCatalog
from .local_file_catalog import LocalFileCatalog

View file

@ -18,11 +18,9 @@ class BaseFileCatalog(BaseComponent):
component_type = ComponentEnum.FILE_CATALOG
def __init__(self, catalog_name: str = "default", catalog_version: str = "v1", **kwargs):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.catalog_name: str = catalog_name or self.name
self.catalog_version: str = catalog_version
self.catalog_path: Path = self.vault_metadata_path / self.component_type.value / self.catalog_name
self.catalog_path: Path = self.vault_metadata_path / self.component_type.value
self.catalog_path.mkdir(parents=True, exist_ok=True)
# -- Lifecycle ---------------------------------------------------------

View file

@ -15,7 +15,7 @@ class LocalFileCatalog(BaseFileCatalog):
super().__init__(**kwargs)
self.encoding = encoding
self._nodes: dict[str, FileNode] = {}
self._catalog_file = self.catalog_path / f"nodes_{self.catalog_version}.jsonl"
self._catalog_file = self.catalog_path / f"{self.name}.jsonl"
async def load(self) -> None:
if not self._catalog_file.exists():

View file

@ -5,4 +5,9 @@ from .local_file_graph import LocalFileGraph
from .neo4j_file_graph import Neo4jFileGraph
from .nx_file_graph import NxFileGraph
__all__ = ["BaseFileGraph", "LocalFileGraph", "Neo4jFileGraph", "NxFileGraph"]
__all__ = [
"BaseFileGraph",
"LocalFileGraph",
"Neo4jFileGraph",
"NxFileGraph",
]