"""Manager for multiple ledger."""
from abc import ABC, abstractmethod
from typing import Optional, Tuple, Mapping
from ...core.error import BaseError
from ...core.profile import Profile
from ...ledger.base import BaseLedger
from ...messaging.valid import IndyDID
[docs]class MultipleLedgerManagerError(BaseError):
"""Generic multiledger error."""
[docs]class BaseMultipleLedgerManager(ABC):
"""Base class for handling multiple ledger support."""
def __init__(self, profile: Profile):
"""Initialize Multiple Ledger Manager."""
[docs] @abstractmethod
async def get_write_ledger(self) -> Tuple[str, BaseLedger]:
"""Return write ledger."""
[docs] @abstractmethod
async def get_prod_ledgers(self) -> Mapping:
"""Return configured production ledgers."""
[docs] @abstractmethod
async def get_nonprod_ledgers(self) -> Mapping:
"""Return configured non production ledgers."""
@abstractmethod
async def _get_ledger_by_did(
self, ledger_id: str, did: str
) -> Optional[Tuple[str, BaseLedger, bool]]:
"""Build and submit GET_NYM request and process response."""