Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/__init__.py
from .archive import ArchiveInterface | from .archive import ArchiveInterface | ||||
from .provenance import ProvenanceInterface | |||||
from .storage.archive import ArchiveStorage | |||||
from .postgresql.archive import ArchivePostgreSQL | from .postgresql.archive import ArchivePostgreSQL | ||||
from .postgresql.db_utils import connect | from .postgresql.db_utils import connect | ||||
from .postgresql.provenance import ProvenancePostgreSQL | from .postgresql.provenance import ProvenancePostgreSQL | ||||
from .postgresql_nopath.provenance import ProvenancePostgreSQLNoPath | from .postgresql_nopath.provenance import ProvenancePostgreSQLNoPath | ||||
from .provenance import ProvenanceInterface | |||||
from .storage.archive import ArchiveStorage | |||||
def get_archive(cls: str, **kwargs) -> ArchiveInterface: | def get_archive(cls: str, **kwargs) -> ArchiveInterface: | ||||
if cls == "api": | if cls == "api": | ||||
return ArchiveStorage(**kwargs["storage"]) | return ArchiveStorage(**kwargs["storage"]) | ||||
elif cls == "ps": | elif cls == "ps": | ||||
conn = connect(kwargs["db"]) | conn = connect(kwargs["db"]) | ||||
return ArchivePostgreSQL(conn) | return ArchivePostgreSQL(conn) | ||||
Show All 13 Lines |