remove unused lighthouse search from daemon
This commit is contained in:
parent
7f96e35b0e
commit
472bb6af1b
3 changed files with 1 additions and 81 deletions
|
@ -160,7 +160,6 @@ class AdjustableSettings(Setting):
|
|||
self.check_ui_requirements = True
|
||||
self.local_ui_path = False
|
||||
self.api_port = 5279
|
||||
self.search_servers = ['lighthouse1.lbry.io:50005']
|
||||
self.data_rate = .0001 # points/megabyte
|
||||
self.min_info_rate = .02 # points/1000 infos
|
||||
self.min_valuable_info_rate = .05 # points/1000 infos
|
||||
|
|
|
@ -207,7 +207,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
'is_running', 'is_first_run',
|
||||
'get_time_behind_blockchain', 'stop',
|
||||
'daemon_status', 'get_start_notice',
|
||||
'version', 'get_search_servers'
|
||||
'version'
|
||||
]
|
||||
last_version = {'last_version': {'lbrynet': lbrynet_version, 'lbryum': lbryum_version}}
|
||||
conf.settings.update(last_version)
|
||||
|
@ -276,7 +276,6 @@ class Daemon(AuthJSONRPCServer):
|
|||
self.name_cache = {}
|
||||
self.set_wallet_attributes()
|
||||
self.exchange_rate_manager = ExchangeRateManager()
|
||||
self.lighthouse_client = LighthouseClient()
|
||||
calls = {
|
||||
Checker.INTERNET_CONNECTION: LoopingCall(CheckInternetConnection(self)),
|
||||
Checker.VERSION: LoopingCall(CheckRemoteVersions(self)),
|
||||
|
@ -1065,9 +1064,6 @@ class Daemon(AuthJSONRPCServer):
|
|||
|
||||
return defer.succeed(None)
|
||||
|
||||
def _search(self, search):
|
||||
return self.lighthouse_client.search(search)
|
||||
|
||||
def jsonrpc_is_running(self):
|
||||
"""
|
||||
Check if lbrynet daemon is running
|
||||
|
@ -1567,42 +1563,6 @@ class Daemon(AuthJSONRPCServer):
|
|||
d.addCallback(lambda r: self._render_response(r, OK_CODE))
|
||||
return d
|
||||
|
||||
def jsonrpc_search_nametrie(self, p):
|
||||
"""
|
||||
Search the nametrie for claims
|
||||
|
||||
Args:
|
||||
'search': search query, string
|
||||
Returns:
|
||||
List of search results
|
||||
"""
|
||||
|
||||
# TODO: change this function to "search"
|
||||
|
||||
if 'search' in p.keys():
|
||||
search = p['search']
|
||||
else:
|
||||
return self._render_response(None, BAD_REQUEST)
|
||||
|
||||
# TODO: have ui accept the actual outputs
|
||||
def _clean(n):
|
||||
t = []
|
||||
for i in n:
|
||||
td = {k: i['value'][k] for k in i['value']}
|
||||
td['cost_est'] = float(i['cost'])
|
||||
td['thumbnail'] = i['value'].get('thumbnail', "img/Free-speech-flag.svg")
|
||||
td['name'] = i['name']
|
||||
t.append(td)
|
||||
return t
|
||||
|
||||
log.info('Search: %s' % search)
|
||||
|
||||
d = self._search(search)
|
||||
d.addCallback(_clean)
|
||||
d.addCallback(lambda results: self._render_response(results, OK_CODE))
|
||||
|
||||
return d
|
||||
|
||||
@AuthJSONRPCServer.auth_required
|
||||
def jsonrpc_delete_lbry_file(self, p):
|
||||
"""
|
||||
|
@ -2248,18 +2208,6 @@ class Daemon(AuthJSONRPCServer):
|
|||
d.addCallback(lambda r: self._render_response(r, OK_CODE))
|
||||
return d
|
||||
|
||||
def jsonrpc_get_search_servers(self):
|
||||
"""
|
||||
Get list of lighthouse servers
|
||||
Args:
|
||||
None
|
||||
Returns:
|
||||
List of address:port
|
||||
"""
|
||||
|
||||
d = self._render_response(lbrynet_settings.search_servers, OK_CODE)
|
||||
return d
|
||||
|
||||
def jsonrpc_get_mean_availability(self):
|
||||
"""
|
||||
Get mean blob availability
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
import logging
|
||||
import random
|
||||
from txjsonrpc.web.jsonrpc import Proxy
|
||||
from lbrynet.conf import settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LighthouseClient(object):
|
||||
def __init__(self, servers=None):
|
||||
self.servers = servers or settings.search_servers
|
||||
|
||||
def _get_random_server(self):
|
||||
return Proxy(random.choice(self.servers))
|
||||
|
||||
def _run_query(self, func, arg):
|
||||
return self._get_random_server().callRemote(func, arg)
|
||||
|
||||
def search(self, search):
|
||||
return self._run_query('search', search)
|
||||
|
||||
def announce_sd(self, sd_hash):
|
||||
log.info("Announce sd to lighthouse")
|
||||
return self._run_query('announce_sd', sd_hash)
|
||||
|
||||
def check_available(self, sd_hash):
|
||||
return self._run_query('check_available', sd_hash)
|
Loading…
Reference in a new issue