Add metadata plugin mechanism

Until now we only supported storing resources in memory, and that
mechanism was tightly coupled with everything else.

This patch decouples the metadata storing into a plugin mechanism using
'Python entrypoints.  The default storing mechanism is still in memory,
and for now it's the only mechanism available.

The JSON serialization mechanism has not yet been adapted to the
metadata plugin mechanism, so it will only work with the default plugin.
This commit is contained in:
Gorka Eguileor
2018-03-15 18:23:19 +01:00
parent db5ed94fa3
commit d913aedd3d
10 changed files with 1176 additions and 793 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import setuptools
with open('README.rst') as readme_file:
readme = readme_file.read()
@@ -47,7 +47,7 @@ extras = {
'infi.dtypes.iqn'],
}
setup(
setuptools.setup(
name='cinderlib',
version='0.1.0',
description=("Cinder Library allows using storage drivers outside of "
@@ -56,11 +56,7 @@ setup(
author="Gorka Eguileor",
author_email='geguileo@redhat.com',
url='https://github.com/akrog/cinderlib',
packages=[
'cinderlib',
],
package_dir={'cinderlib':
'cinderlib'},
packages=setuptools.find_packages(exclude=['tmp', 'tests.*', 'tests.*']),
include_package_data=True,
install_requires=requirements,
extras_requires=extras,
@@ -81,4 +77,9 @@ setup(
],
test_suite='unittest2.collector',
tests_require=test_requirements,
entry_points={
'cinderlib.persistence.storage': [
'memory = cinderlib.persistence.memory:MemoryPersistence',
],
},
)