The watcher.objects.base Module

Watcher common internal object model

class watcher.objects.base.NotSpecifiedSentinel[source]

Bases: object

class watcher.objects.base.ObjectListBase[source]

Bases: object

Mixin class for lists of objects.

This mixin class can be added as a base class for an object that is implementing a list of objects. It adds a single field of ‘objects’, which is the list store, and behaves like a list itself. It supports serialization of the list of objects automatically.

count(value)[source]

List count of value occurrences.

index(value)[source]

List index of value.

obj_make_compatible(primitive, target_version)[source]
obj_what_changed()[source]
class watcher.objects.base.WatcherObject(context, **kwargs)[source]

Bases: object

Base class and object factory.

This forms the base of all objects that can be remoted or instantiated via RPC. Simply defining a class that inherits from this base class will make it remotely instantiatable. Objects should implement the necessary “get” classmethod routines as well as “save” object methods as appropriate.

as_dict()[source]
get(key, value=<class 'watcher.objects.base.NotSpecifiedSentinel'>)[source]

For backwards-compatibility with dict-based objects.

NOTE(danms): May be removed in the future.

items()[source]
iteritems()[source]

For backwards-compatibility with dict-based objects.

NOTE(danms): May be removed in the future.

obj_attr_is_set(attrname)[source]

Test object to see if attrname is present.

Returns True if the named attribute has a value set, or False if not. Raises AttributeError if attrname is not a valid attribute for this object.

classmethod obj_class_from_name(objname, objver)[source]

Returns a class from the registry based on a name and version.

obj_clone()[source]

Create a copy.

classmethod obj_from_primitive(primitive, context=None)[source]

Simple base-case hydration.

This calls self._attr_from_primitive() for each item in fields.

obj_get_changes()[source]

Returns a dict of changed fields and their new values.

obj_load_attr(attrname)[source]

Load an additional attribute from the real object.

This should use self._conductor, and cache any data that might be useful for future load operations.

classmethod obj_name()[source]

Get canonical object name.

This object name will be used over the wire for remote hydration.

obj_reset_changes(fields=None)[source]

Reset the list of fields that have been changed.

Note that this is NOT “revert to previous values”

obj_to_primitive()[source]

Simple base-case dehydration.

This calls self._attr_to_primitive() for each item in fields.

obj_what_changed()[source]

Returns a set of fields that have been modified.

save(context)[source]

Save the changed fields back to the store.

This is optional for subclasses, but is presented here in the base class for consistency among those that do.

update(updates)[source]

For backwards-compatibility with dict-base objects.

NOTE(danms): May be removed in the future.

class watcher.objects.base.WatcherObjectMetaclass(names, bases, dict_)[source]

Bases: type

Metaclass that allows tracking of object classes.

class watcher.objects.base.WatcherObjectSerializer[source]

Bases: oslo_messaging.serializer.NoOpSerializer

A WatcherObject-aware Serializer.

This implements the Oslo Serializer interface and provides the ability to serialize and deserialize WatcherObject entities. Any service that needs to accept or return WatcherObjects as arguments or result values should pass this to its RpcProxy and RpcDispatcher objects.

deserialize_entity(context, entity)[source]
serialize_entity(context, entity)[source]

Previous topic

The watcher.objects.audit_template Module

Next topic

The watcher.objects.efficacy_indicator Module

Project Source

This Page