Initialization of versioned objects
This patch starts the work on versioned objects. The versioned objects will server two use cases: 1) an indirection layer for the database that lays the foundation for live upgrade in future; 2) an abstraction of objects that can be pumped to message queue (or other channels) or persisted into database, aka. the notification interface. Change-Id: I2040b1cdfbe4821cdab517ed14f116e1b0f8fdc5
This commit is contained in:
parent
7375830b46
commit
261918221e
@ -18,6 +18,7 @@ oslo.policy>=0.5.0 # Apache-2.0
|
|||||||
oslo.serialization>=1.10.0 # Apache-2.0
|
oslo.serialization>=1.10.0 # Apache-2.0
|
||||||
oslo.service>=1.10.0 # Apache-2.0
|
oslo.service>=1.10.0 # Apache-2.0
|
||||||
oslo.utils>=3.5.0 # Apache-2.0
|
oslo.utils>=3.5.0 # Apache-2.0
|
||||||
|
oslo.versionedobjects>=1.5.0,!=1.9.0 # Apache-2.0
|
||||||
PasteDeploy>=1.5.0 # MIT
|
PasteDeploy>=1.5.0 # MIT
|
||||||
pytz>=2013.6 # MIT
|
pytz>=2013.6 # MIT
|
||||||
PyYAML>=3.1.0 # MIT
|
PyYAML>=3.1.0 # MIT
|
||||||
|
0
senlin/objects/__init__.py
Normal file
0
senlin/objects/__init__.py
Normal file
28
senlin/objects/base.py
Normal file
28
senlin/objects/base.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
"""Senlin common internal object model"""
|
||||||
|
|
||||||
|
from oslo_versionedobjects import base
|
||||||
|
|
||||||
|
|
||||||
|
class SenlinObject(base.VersionedObject):
|
||||||
|
"""Base class for senlin objects.
|
||||||
|
|
||||||
|
This is the base class for all objects that can be remoted or instantiated
|
||||||
|
via RPC. Simply defining a sub-class of this class would make it remotely
|
||||||
|
instantiatable. Objects should implement the "get" class method and the
|
||||||
|
"save" object method.
|
||||||
|
"""
|
||||||
|
|
||||||
|
OBJ_PROJECT_NAMESPACE = 'senlin'
|
||||||
|
VERSION = '1.0'
|
0
senlin/tests/unit/objects/__init__.py
Normal file
0
senlin/tests/unit/objects/__init__.py
Normal file
24
senlin/tests/unit/objects/test_base.py
Normal file
24
senlin/tests/unit/objects/test_base.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from senlin.objects import base as obj_base
|
||||||
|
from senlin.tests.unit.common import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestBaseObject(base.SenlinTestCase):
|
||||||
|
|
||||||
|
def test_base_class(self):
|
||||||
|
obj = obj_base.SenlinObject()
|
||||||
|
self.assertEqual(obj_base.SenlinObject.OBJ_PROJECT_NAMESPACE,
|
||||||
|
obj.OBJ_PROJECT_NAMESPACE)
|
||||||
|
self.assertEqual(obj_base.SenlinObject.VERSION,
|
||||||
|
obj.VERSION)
|
Loading…
Reference in New Issue
Block a user