26 lines
659 B
Python
26 lines
659 B
Python
from dataclasses import dataclass
|
|
from typing import Dict, List
|
|
|
|
|
|
@dataclass
|
|
class GoCRegistryEntry:
|
|
adapter_id: str
|
|
supported_domains: List[str]
|
|
contract_version: str
|
|
|
|
|
|
class GoCRegistry:
|
|
"""Lightweight in-memory Graph-of-Contracts registry stub."""
|
|
|
|
def __init__(self) -> None:
|
|
self._registry: Dict[str, GoCRegistryEntry] = {}
|
|
|
|
def register(self, entry: GoCRegistryEntry) -> None:
|
|
self._registry[entry.adapter_id] = entry
|
|
|
|
def get(self, adapter_id: str) -> GoCRegistryEntry:
|
|
return self._registry[adapter_id]
|
|
|
|
def list_all(self) -> List[GoCRegistryEntry]:
|
|
return list(self._registry.values())
|