Snapshot¶
Module containing all classes and functions responsible for dealing with snapshots.
-
class
snapshot.
Snapshot
(json_repr)¶ Snapshot of an object’s state in a particular point of time.
For now, it’s basically just a dict.
- Parameters
json_repr (Dict[str, Any]) –
-
items
()¶ Mimics the built-in
dict.items()
method.- Returns
Exactly the same result as a
dict.items()
would.- Return type
ItemsView[str, Any]
-
class
snapshot.
SnapshotDiff
¶ Class representing the differences between two snapshots (instances of
Snapshot
class).- Contains 3 categories:
what was modified (same keys, different values)
what was added (new keys)
what was deleted (old keys not present anymore)
-
snapshot.
make_snapshot
(obj)¶ Creates a snapshot from
AttributesMixin
instance.- Parameters
obj (dsw_sdk.common.attributes.AttributesMixin) – instance of class
AttributesMixin
- Returns
snapshot of
obj
state- Return type
-
snapshot.
snapshots_diff
(old, new)¶ Compares two snapshots (assuming the first one is older and the second one is newer), returning attributes in which they differ.
- Parameters
old (snapshot.Snapshot) – former state of the object
new (snapshot.Snapshot) – newer (current) state of the object
- Returns
attributes that was added, changed or deleted
- Return type