|
cut 3.3.0
|
Python wrapper for OLDB client, uses Singleton pattern. More...
Public Member Functions | |
| __new__ (cls) | |
| Method that indicates how a new object for this class is created. | |
| use_in_memory (self) | |
| Intended for tending, this method prepares an in-memory OLDB. | |
| bool | connect (self, CiiOldbConfigClass configuration=None, int timeout=5) |
| Connects to OLDB. | |
| disconnect (self) | |
| Disconnects from OLDB. | |
| connect_async (self, CiiOldbConfigClass configuration=None, int timeout=5) | |
| Single connection attempt in a separate thread. | |
| start_connect_cycle (self, CiiOldbConfigClass configuration=None) | |
| Starts a cycle of connection/pings until stopped. | |
| CiiOldb | get_client (self) |
| Returns the OLDB client object reference. | |
| bool | ping (self) |
| Executes short query on OLDB to check if connected is still available. | |
Protected Member Functions | |
| _connect_cycle (self, CiiOldbConfigClass configuration=None) | |
| Starts a Connection cycle. | |
Python wrapper for OLDB client, uses Singleton pattern.
This class facilitates connection to OLDB. Configures timeouts, concentrates retries to connect, checks for status of connection, among other things.
This class does not use QObject, as it is intended to be used in a taurus plugin.
| comms.oldbadapter.OldbAdapter.__new__ | ( | cls | ) |
Method that indicates how a new object for this class is created.
Implements singleton pattern. The first object created will store a "static" reference of the same object, and from then on the "static" reference is returned.
|
protected |
Starts a Connection cycle.
Do not use this method in a synchronous manner, otherwise it will block without finishing.
This method enter a neverending cycle. It will try to:
| bool comms.oldbadapter.OldbAdapter.connect | ( | self, | |
| CiiOldbConfigClass | configuration = None, | ||
| int | timeout = 5 ) |
Connects to OLDB.
If connection fails, every other attempt will be reported as failed during the window.
The whole method is protected by a mutex. So at any point in time, only one connection attempt can happen. If a second attempt is requested, the mutex will make sure they are "queued".
Also fires a Connection event to the listeners.
| [in] | configuration | Allows to inject a particular CiiOldbConfigClass |
| comms.oldbadapter.OldbAdapter.connect_async | ( | self, | |
| CiiOldbConfigClass | configuration = None, | ||
| int | timeout = 5 ) |
Single connection attempt in a separate thread.
Developer should connect a listener before invoking this method.
| comms.oldbadapter.OldbAdapter.disconnect | ( | self | ) |
Disconnects from OLDB.
Also fires a Connection event to the listeners.
@TODO: Implement close
| CiiOldb comms.oldbadapter.OldbAdapter.get_client | ( | self | ) |
Returns the OLDB client object reference.
If the reference is None, the developer needs to request connection first.
| bool comms.oldbadapter.OldbAdapter.ping | ( | self | ) |
Executes short query on OLDB to check if connected is still available.
| comms.oldbadapter.OldbAdapter.start_connect_cycle | ( | self, | |
| CiiOldbConfigClass | configuration = None ) |
Starts a cycle of connection/pings until stopped.
Every second, the cycle will try to connect to the OLDB, with a timeout of 1 second. If succesfull, it will use the ping() method, which will update the connection status automatically. If disconnection is detected, will start connections attempts.
All connection changes are notified to listeners.
Only one connection cycle can be running. Additional requests will be logged and return immediately.