wip
This commit is contained in:
parent
970d0ba6e1
commit
413c8e1426
4 changed files with 137 additions and 10 deletions
|
@ -477,7 +477,7 @@ class API:
|
|||
'build': (str) "dev" | "qa" | "rc" | "release",
|
||||
}
|
||||
"""
|
||||
return await self.service.get_version()
|
||||
return self.service.get_version()
|
||||
|
||||
async def resolve(
|
||||
self,
|
||||
|
@ -784,9 +784,11 @@ class API:
|
|||
return {'is_encrypted': None, 'is_syncing': None, 'is_locked': None}
|
||||
wallet = self.wallets.get_or_default(wallet_id)
|
||||
return {
|
||||
'is_encrypted': wallet.is_encrypted,
|
||||
'is_syncing': len(self.ledger._update_tasks) > 0,
|
||||
'is_locked': wallet.is_locked
|
||||
#'is_encrypted': wallet.is_encrypted,
|
||||
#'is_locked': wallet.is_locked,
|
||||
'is_encrypted': False,
|
||||
'is_locked': False,
|
||||
'is_syncing': not self.service.sync.done.is_set(),
|
||||
}
|
||||
|
||||
async def wallet_unlock(
|
||||
|
@ -1581,7 +1583,6 @@ class API:
|
|||
))
|
||||
stream_filter_dict, kwargs = pop_kwargs('stream_filter', extract_stream_filter(**kwargs))
|
||||
pagination, kwargs = pop_kwargs('pagination', extract_pagination(**kwargs))
|
||||
assert_consumed_kwargs(kwargs)
|
||||
wallet = self.wallets.get_or_default(wallet_id)
|
||||
# if {'claim_id', 'claim_ids'}.issubset(kwargs):
|
||||
# raise ValueError("Only 'claim_id' or 'claim_ids' is allowed, not both.")
|
||||
|
@ -1604,8 +1605,14 @@ class API:
|
|||
'order_by': order_by
|
||||
})
|
||||
kwargs.pop("no_totals", None) # deprecated, ignoring
|
||||
kwargs.pop("any_tags", None) # deprecated, ignoring
|
||||
kwargs.pop("not_tags", None) # deprecated, ignoring
|
||||
kwargs.pop("limit_claims_per_channel", None) # deprecated, ignoring
|
||||
claim_filter_dict['channel_ids'] = kwargs.pop('channel_ids')
|
||||
claim_filter_dict['not_channel_ids'] = kwargs.pop('not_channel_ids')
|
||||
assert_consumed_kwargs(kwargs)
|
||||
claim_filter_dict.update(kwargs)
|
||||
if protobuf:
|
||||
if protobuf or 1:
|
||||
return await self.service.protobuf_search_claims(**remove_nulls(claim_filter_dict))
|
||||
result = await self.service.search_claims(
|
||||
wallet.accounts, **remove_nulls(claim_filter_dict)
|
||||
|
|
|
@ -36,6 +36,7 @@ class Sync:
|
|||
|
||||
self._on_ready_controller = EventController()
|
||||
self.on_ready = self._on_ready_controller.stream
|
||||
self.done = asyncio.Event()
|
||||
|
||||
def on_bulk_started(self):
|
||||
return self.on_progress.where() # filter for bulk started event
|
||||
|
@ -85,10 +86,122 @@ class Service:
|
|||
await self.db.close()
|
||||
|
||||
async def get_status(self):
|
||||
pass
|
||||
synced = True
|
||||
return {
|
||||
"blob_manager": {
|
||||
"connections": {
|
||||
"incoming_bps": {},
|
||||
"max_incoming_mbs": 0.0,
|
||||
"max_outgoing_mbs": 0.0,
|
||||
"outgoing_bps": {},
|
||||
"total_incoming_mbs": 0.0,
|
||||
"total_outgoing_mbs": 0.0,
|
||||
"total_received": 0,
|
||||
"total_sent": 0
|
||||
},
|
||||
"finished_blobs": 0
|
||||
},
|
||||
"connection_status": {
|
||||
"code": "connected",
|
||||
"message": "No connection problems detected"
|
||||
},
|
||||
"dht": {
|
||||
"node_id": "9ceb289bec5357cf259cb353666cbb0c5852492dd1294bc17fe70d44c4c8ac07bd5c7e3b6c5df467e5f1e2151ad7e48a",
|
||||
"peers_in_routing_table": 36
|
||||
},
|
||||
"ffmpeg_status": {
|
||||
"analyze_audio_volume": True,
|
||||
"available": True,
|
||||
"which": "/usr/bin/ffmpeg"
|
||||
},
|
||||
"hash_announcer": {
|
||||
"announce_queue_size": 0
|
||||
},
|
||||
"installation_id": "9TFNje8mcbZ2y7jg6e3915roopqdNq34NpUZP5qWxczMmqvAjJBesdVsRpECBeUmPr",
|
||||
"is_running": True,
|
||||
"skipped_components": [],
|
||||
"startup_status": {
|
||||
"blob_manager": True,
|
||||
"database": True,
|
||||
"dht": True,
|
||||
"exchange_rate_manager": True,
|
||||
"file_manager": synced,
|
||||
"hash_announcer": synced,
|
||||
"libtorrent_component": True,
|
||||
"peer_protocol_server": True,
|
||||
"upnp": True,
|
||||
"wallet": synced,
|
||||
"wallet_server_payments": True
|
||||
},
|
||||
"upnp": {
|
||||
"aioupnp_version": "0.0.18",
|
||||
"dht_redirect_set": False,
|
||||
"external_ip": "45.162.228.190",
|
||||
"gateway": "No gateway found",
|
||||
"peer_redirect_set": False,
|
||||
"redirects": {}
|
||||
},
|
||||
"wallet": {
|
||||
"available_servers": 5,
|
||||
"best_blockhash": "c114dc272f3851580bc801dbcdf9cd58320b99bf0f069cea58edd3689de30760",
|
||||
"blocks": 894990,
|
||||
"blocks_behind": 0,
|
||||
"connected": "18.229.92.202:50001",
|
||||
"connected_features": {
|
||||
"daily_fee": "0",
|
||||
"description": "",
|
||||
"donation_address": "",
|
||||
"genesis_hash": "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463",
|
||||
"hash_function": "sha256",
|
||||
"hosts": {},
|
||||
"payment_address": "",
|
||||
"protocol_max": "0.99.0",
|
||||
"protocol_min": "0.54.0",
|
||||
"pruning": None,
|
||||
"server_version": "0.86.1",
|
||||
"trending_algorithm": "ar"
|
||||
},
|
||||
"headers_synchronization_progress": 100,
|
||||
"known_servers": 1,
|
||||
"servers": [
|
||||
{
|
||||
"availability": True,
|
||||
"host": "spv.lbry.tech",
|
||||
"latency": 0,
|
||||
"port": 5279
|
||||
},
|
||||
]
|
||||
},
|
||||
"wallet_server_payments": {
|
||||
"max_fee": "0.0",
|
||||
"running": False
|
||||
}
|
||||
}
|
||||
|
||||
def get_version(self):
|
||||
pass
|
||||
# fixme: get real
|
||||
return {
|
||||
"build": "release",
|
||||
"desktop": "Unknown",
|
||||
"distro": {
|
||||
"codename": "buster",
|
||||
"id": "debian",
|
||||
"like": "",
|
||||
"version": "10",
|
||||
"version_parts": {
|
||||
"build_number": "",
|
||||
"major": "10",
|
||||
"minor": ""
|
||||
}
|
||||
},
|
||||
"lbrynet_version": "0.87.0",
|
||||
"os_release": "4.19.155-1.pvops.qubes.x86_64",
|
||||
"os_system": "Linux",
|
||||
"platform": "Linux-4.19.155-1.pvops.qubes.x86_64-x86_64-with-debian-10.7",
|
||||
"processor": "",
|
||||
"python_version": "3.7.9",
|
||||
"version": "0.87.0"
|
||||
}
|
||||
|
||||
async def find_ffmpeg(self):
|
||||
pass
|
||||
|
|
|
@ -70,6 +70,7 @@ class Daemon:
|
|||
self.app['subscriptions']: Dict[str, Tuple[BroadcastSubscription, WeakSet]] = {}
|
||||
self.app.router.add_get('/ws', self.on_connect)
|
||||
self.app.router.add_post('/api', self.on_rpc)
|
||||
self.app.router.add_post('/', self.on_rpc)
|
||||
self.app.on_shutdown.append(self.on_shutdown)
|
||||
self.runner = AppRunner(self.app)
|
||||
|
||||
|
@ -116,8 +117,8 @@ class Daemon:
|
|||
async def on_rpc(self, request):
|
||||
data = await request.json()
|
||||
params = data.get('params', {})
|
||||
method = getattr(self.api, data['method'])
|
||||
try:
|
||||
method = getattr(self.api, data['method'])
|
||||
result = await method(**params)
|
||||
encoded_result = jsonrpc_dumps_pretty(result, service=self.service)
|
||||
return Response(
|
||||
|
@ -125,6 +126,7 @@ class Daemon:
|
|||
content_type='application/json'
|
||||
)
|
||||
except Exception as e:
|
||||
print(e, method, params)
|
||||
log.exception("RPC error")
|
||||
raise e
|
||||
|
||||
|
|
|
@ -61,7 +61,11 @@ class LightClient(Service):
|
|||
pass
|
||||
|
||||
async def search_claims(self, accounts, **kwargs):
|
||||
pass
|
||||
kwargs.pop('offset', None)
|
||||
kwargs.pop('limit', None)
|
||||
kwargs.pop('channel_ids', None)
|
||||
kwargs.pop('not_channel_ids', None)
|
||||
return await self.client.first.claim_search(**kwargs)
|
||||
|
||||
async def search_supports(self, accounts, **kwargs):
|
||||
pass
|
||||
|
@ -320,6 +324,7 @@ class FastSync(Sync):
|
|||
# self.filters.download(height, self.service.wallets),
|
||||
# ])
|
||||
await self._on_synced_controller.add(height)
|
||||
self.done.set()
|
||||
|
||||
async def loop(self):
|
||||
while True:
|
||||
|
|
Loading…
Reference in a new issue