2022-09-30 11:40:22 +03:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2021-09-21 19:05:45 +03:00
|
|
|
import logging
|
|
|
|
|
2021-09-16 04:31:41 +03:00
|
|
|
from chia.data_layer.data_layer import DataLayer
|
2022-09-08 20:57:15 +03:00
|
|
|
from chia.server.server import ChiaServer
|
2021-09-17 15:03:48 +03:00
|
|
|
|
2021-09-16 04:31:41 +03:00
|
|
|
|
|
|
|
class DataLayerAPI:
|
2023-06-14 04:12:25 +03:00
|
|
|
log: logging.Logger
|
2021-09-16 04:31:41 +03:00
|
|
|
data_layer: DataLayer
|
|
|
|
|
2021-09-21 19:05:45 +03:00
|
|
|
def __init__(self, data_layer: DataLayer) -> None:
|
2023-06-14 04:12:25 +03:00
|
|
|
self.log = logging.getLogger(__name__)
|
2021-09-16 04:31:41 +03:00
|
|
|
self.data_layer = data_layer
|
|
|
|
|
2023-02-02 00:31:46 +03:00
|
|
|
# def _set_state_changed_callback(self, callback: StateChangedProtocol) -> None:
|
2021-09-17 15:03:48 +03:00
|
|
|
# self.full_node.state_changed_callback = callback
|
2021-09-16 04:31:41 +03:00
|
|
|
|
|
|
|
@property
|
2022-09-08 20:57:15 +03:00
|
|
|
def server(self) -> ChiaServer:
|
2021-09-16 04:31:41 +03:00
|
|
|
return self.data_layer.server
|
|
|
|
|
2023-06-14 04:12:25 +03:00
|
|
|
def ready(self) -> bool:
|
2021-09-16 04:31:41 +03:00
|
|
|
return self.data_layer.initialized
|