Add a new SDL storage API function 'is_active()'
Implement a new SDL storage API function 'is_active()' to check healthiness
of an SDL instance. For now function only validates SDL DB backend (Redis)
connection. This function can be integrated into SDL client (such as A1
Mediator) health checks and runtime initializations.
Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I8bf457b9528e39223ea65a20d422d2fab49602bb
diff --git a/ricsdl-package/examples/sync.py b/ricsdl-package/examples/sync.py
index f01369a..6ea9ef9 100644
--- a/ricsdl-package/examples/sync.py
+++ b/ricsdl-package/examples/sync.py
@@ -78,6 +78,11 @@
# database services.
# mysdl = _try_func_return(lambda: SyncStorage(fake_db_backend='dict'))
+# Checks if SDL is operational. Note that it is not necessary to call `is_active()` after each
+# SDL instance creation. Below example is here just to show how to call it spontaneously
+# when SDL healthiness is needed to check.
+is_active = mysdl.is_active()
+assert is_active is True
# Sets a value 'my_value' for a key 'my_key' under given namespace. Note that value
# type must be bytes and multiple key values can be set in one set function call.