mercurymesh-privacy-preserv.../mercurymesh/registry.py

24 lines
762 B
Python

from __future__ import annotations
from typing import Dict, Any
class GraphOfContractsRegistry:
"""Minimal in-tree registry for adapters and signal contracts."""
def __init__(self) -> None:
self.version: int = 1
self.adapters: Dict[str, Dict[str, Any]] = {}
self.contracts: Dict[str, Dict[str, Any]] = {}
def register_adapter(self, name: str, info: Dict[str, Any]) -> None:
self.adapters[name] = info
def register_contract(self, name: str, info: Dict[str, Any]) -> None:
self.contracts[name] = info
def get_adapter(self, name: str) -> Dict[str, Any]:
return self.adapters.get(name, {})
def get_contract(self, name: str) -> Dict[str, Any]:
return self.contracts.get(name, {})