"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zaqar/storage/pipeline.py" between
zaqar-5.0.0.tar.gz and zaqar-7.0.0.tar.gz

About: OpenStack Zaqar is a multi-tenant cloud messaging and notification service for web and mobile developers.
The "Rocky" series (latest release).

pipeline.py  (zaqar-5.0.0):pipeline.py  (zaqar-7.0.0)
skipping to change at line 15 skipping to change at line 15
# of the License at # of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under # License for the specific language governing permissions and limitations under
# the License. # the License.
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from osprofiler import profiler from osprofiler import profiler
from stevedore import driver from stevedore import driver
from stevedore import extension from stevedore import extension
from zaqar import common from zaqar import common
from zaqar.common import decorators from zaqar.common import decorators
from zaqar.i18n import _ from zaqar.conf import storage
from zaqar.storage import base from zaqar.storage import base
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
_PIPELINE_RESOURCES = ('queue', 'message', 'claim', 'subscription')
_PIPELINE_CONFIGS = tuple((
cfg.ListOpt(resource + '_pipeline', default=[],
help=_('Pipeline to use for processing {0} operations. '
'This pipeline will be consumed before calling '
'the storage driver\'s controller methods.')
.format(resource))
for resource in _PIPELINE_RESOURCES
))
_PIPELINE_GROUP = 'storage'
def _config_options():
return [(_PIPELINE_GROUP, _PIPELINE_CONFIGS)]
def _get_storage_pipeline(resource_name, conf, *args, **kwargs): def _get_storage_pipeline(resource_name, conf, *args, **kwargs):
"""Constructs and returns a storage resource pipeline. """Constructs and returns a storage resource pipeline.
This is a helper function for any service supporting This is a helper function for any service supporting
pipelines for the storage layer. The function returns pipelines for the storage layer. The function returns
a pipeline based on the `{resource_name}_pipeline` a pipeline based on the `{resource_name}_pipeline`
config option. config option.
Stages in the pipeline implement controller methods Stages in the pipeline implement controller methods
that they want to hook. A stage can halt the that they want to hook. A stage can halt the
skipping to change at line 65 skipping to change at line 48
not None; otherwise, processing will continue not None; otherwise, processing will continue
to the next stage, ending with the actual storage to the next stage, ending with the actual storage
controller. controller.
:param conf: Configuration instance. :param conf: Configuration instance.
:type conf: `cfg.ConfigOpts` :type conf: `cfg.ConfigOpts`
:returns: A pipeline to use. :returns: A pipeline to use.
:rtype: `Pipeline` :rtype: `Pipeline`
""" """
conf.register_opts(_PIPELINE_CONFIGS, conf.register_opts(storage.ALL_OPTS,
group=_PIPELINE_GROUP) group=storage.GROUP_NAME)
storage_conf = conf[_PIPELINE_GROUP] storage_conf = conf[storage.GROUP_NAME]
pipeline = [] pipeline = []
for ns in storage_conf[resource_name + '_pipeline']: for ns in storage_conf[resource_name + '_pipeline']:
try: try:
mgr = driver.DriverManager('zaqar.storage.stages', mgr = driver.DriverManager('zaqar.storage.stages',
ns, ns,
invoke_args=args, invoke_args=args,
invoke_kwds=kwargs, invoke_kwds=kwargs,
invoke_on_load=True) invoke_on_load=True)
pipeline.append(mgr.driver) pipeline.append(mgr.driver)
 End of changes. 5 change blocks. 
21 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)