mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-10 12:29:49 +03:00
49140b2b3c
* server: Introduce `ApiProtocol` * genericize (#5) * `ApiProtocol.api_ready` -> `ApiProtocol.ready()` * Add `ApiProtocol.log` and give APIs separate loggers * Fix `CrawlerAPI` * Drop some unrelated removals * Fix some of the generic hinting * Revert some changes in `timelord_api.py` * Fix `CawlerAPI` readiness * Fix hinting * Get some `CrawlerAPI` coverage --------- Co-authored-by: Kyle Altendorf <sda@fstab.net>
26 lines
662 B
Python
26 lines
662 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from chia.data_layer.data_layer import DataLayer
|
|
from chia.server.server import ChiaServer
|
|
|
|
|
|
class DataLayerAPI:
|
|
log: logging.Logger
|
|
data_layer: DataLayer
|
|
|
|
def __init__(self, data_layer: DataLayer) -> None:
|
|
self.log = logging.getLogger(__name__)
|
|
self.data_layer = data_layer
|
|
|
|
# def _set_state_changed_callback(self, callback: StateChangedProtocol) -> None:
|
|
# self.full_node.state_changed_callback = callback
|
|
|
|
@property
|
|
def server(self) -> ChiaServer:
|
|
return self.data_layer.server
|
|
|
|
def ready(self) -> bool:
|
|
return self.data_layer.initialized
|