-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ pylint = "*" | |
[packages] | ||
flask = "*" | ||
flask-restful = "*" | ||
py4j = "*" | ||
rpyc = "*" | ||
|
||
[requires] | ||
python_version = "3.8" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from rpyc import connect | ||
|
||
class ConnectionHandler(object): | ||
connection = connect('localhost', 18861) | ||
root = None | ||
|
||
def get_handler(self): | ||
return self.root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from file_indexer_api.common.connection_handler import ConnectionHandler | ||
from file_indexer_api.common.indexer_handler import IndexerHandler | ||
from file_indexer_api.common.searcher_handler import SearcherHandler | ||
|
||
class ConnectionHandlerFactory(): | ||
@staticmethod | ||
def create_connection_handler(type): | ||
if type == 'indexer': | ||
return IndexerHandler | ||
if type == 'searcher': | ||
return SearcherHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from file_indexer_api.common.connection_handler import ConnectionHandler | ||
|
||
class IndexerHandler(ConnectionHandler): | ||
root = ConnectionHandler.root.index() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from file_indexer_api.common.connection_handler import ConnectionHandler | ||
|
||
class SearcherHandler(ConnectionHandler): | ||
root = ConnectionHandler.root.searcher() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from file_indexer_api.common.connection_handler_factory import ConnectionHandlerFactory | ||
|
||
class Indexer(): | ||
def __init__(self): | ||
self.indexer = ConnectionHandlerFactory.create_connection_handler('indexer') | ||
|
||
def index(self, path): | ||
self.indexer.get_handler(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from file_indexer_api.common.connection_handler_factory import ConnectionHandlerFactory | ||
|
||
class Searcher(): | ||
def __init__(self): | ||
self.searcher = ConnectionHandlerFactory.create_connection_handler('indexer') | ||
|
||
def search(self, query): | ||
self.searcher.get_handler(query) |