# HG changeset patch # User Thierry Florac # Date 1595241280 -7200 # Node ID 3fb0f88ee0523536d8ae9c6f6d7ff613561e27d2 # Parent 0c536f62e02a11cefb3a2606042e82e763fbd351 Module refactoring diff -r 0c536f62e02a -r 3fb0f88ee052 src/pyams_content_es/interfaces.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content_es/interfaces.py Mon Jul 20 12:34:40 2020 +0200 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +from zope.interface import Interface +from zope.schema import Choice + +__docformat__ = 'restructuredtext' + + +from pyams_content_es import _ + + +# +# Indexer interfaces +# + +INDEXER_NAME = 'ElasticSearch content indexer' +INDEXER_STARTER_KEY = 'pyams_content.es.start_handler' +INDEXER_HANDLER_KEY = 'pyams_content.es.tcp_handler' +INDEXER_AUTH_KEY = 'pyams_content.es.allow_auth' +INDEXER_CLIENTS_KEY = 'pyams_content.es.allow_clients' + + +# +# Utility interfaces +# + +class IContentIndexerUtility(Interface): + """Content indexer utility interface""" + + zodb_name = Choice(title=_("ZODB connection name"), + description=_("Name of ZODB connection defining indexer connection"), + required=False, + vocabulary="PyAMS ZODB connections") + + def get_socket(self): + """Get 0MQ socket matching utility settings""" + + def index_document(self, document): + """Index given document""" + + def unindex_document(self, document): + """Un-index given document""" + + def test_process(self): + """Send test request to indexer process""" + + +# +# Contents interfaces +# + +class IDocumentIndexInfo(Interface): + """Document index info""" + + +class IDocumentIndexTarget(Interface): + """Document index target marker interface""" diff -r 0c536f62e02a -r 3fb0f88ee052 src/pyams_content_es/interfaces/__init__.py --- a/src/pyams_content_es/interfaces/__init__.py Mon Jul 20 12:33:08 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -# -# Copyright (c) 2008-2015 Thierry Florac -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# - -__docformat__ = 'restructuredtext' - - -# import standard library - -# import interfaces - -# import packages -from zope.interface import Interface -from zope.schema import Choice - -from pyams_content_es import _ - - -# -# Indexer interfaces -# - -INDEXER_NAME = 'ElasticSearch content indexer' -INDEXER_STARTER_KEY = 'pyams_content.es.start_handler' -INDEXER_HANDLER_KEY = 'pyams_content.es.tcp_handler' -INDEXER_AUTH_KEY = 'pyams_content.es.allow_auth' -INDEXER_CLIENTS_KEY = 'pyams_content.es.allow_clients' - - -# -# Utility interfaces -# - -class IContentIndexerUtility(Interface): - """Content indexer utility interface""" - - zodb_name = Choice(title=_("ZODB connection name"), - description=_("Name of ZODB connection defining indexer connection"), - required=False, - vocabulary="PyAMS ZODB connections") - - def get_socket(self): - """Get 0MQ socket matching utility settings""" - - def index_document(self, document): - """Index given document""" - - def unindex_document(self, document): - """Un-index given document""" - - def test_process(self): - """Send test request to indexer process""" - - -# -# Contents interfaces -# - -class IDocumentIndexInfo(Interface): - """Document index info""" - - -class IDocumentIndexTarget(Interface): - """Document index target marker interface"""