Part of canonical.launchpad.webapp
Class | LaunchpadTimeoutError | A variant of TimeoutError that reports the original PostgreSQL error. |
Class | RequestExpired | Request has timed out. |
Class | CommitLogger | Undocumented |
Function | set_request_started | Set the start time for the request being served by the current |
Function | clear_request_started | Clear the request timer. This function should be called when |
Function | summarize_requests | Produce human-readable summary of requests issued so far. |
Function | store_sql_statements_and_request_duration | Undocumented |
Function | get_request_statements | Get the list of executed statements in the request. |
Function | get_request_start_time | Get the time at which the request started. |
Function | get_request_duration | Get the duration of the current request in seconds. |
Function | get_request_remaining_seconds | Return how many seconds are remaining in the current request budget. |
Function | set_launchpad_default_timeout | Set the LAZR default timeout function on IProcessStartingEvent. |
Function | soft_timeout_expired | Returns True if the soft request timeout been reached. |
Class | StormAccessFromMainThread | The main thread must not access the database via Storm. |
Function | break_main_thread_db_access | Ensure that Storm connections are not made in the main thread. |
Class | ReadOnlyModeConnection | storm.database.Connection for read-only mode Launchpad. |
Class | LaunchpadDatabase | No class docstring; 2/4 methods documented |
Class | LaunchpadSessionDatabase | Undocumented |
Class | LaunchpadTimeoutTracer | Storm tracer class to keep statement execution time bounded. |
Class | LaunchpadStatementTracer | Storm tracer class to log executed statements. |
Class | StoreSelector | See canonical.launchpad.webapp.interfaces.IStoreSelector . |
Function | get_store | Return a flavored Store for the given database class. |
Function | get_master_store | Return the master Store for the given database class. |
Function | get_slave_store | Return the master Store for the given database class. |
Function | get_object_from_master_store | Return a copy of the given object retrieved from its master Store. |
Function | get_store_name | Helper to retrieve the store name for a ZStorm Store. |
Function | _get_dirty_commit_flags | Return the current dirty commit status |
Function | _reset_dirty_commit_flags | Set the dirty commit status to False unless previous is True |
Set the start time for the request being served by the current thread. :param start_time: The start time of the request. If given, it is used as the start time for the request, as returned by time(). If it is not given, the current time is used. :param request_statements; The sequence used to store the logged SQL statements. :type request_statements: mutable sequence. :param txn: The current transaction manager. If given, txn.commit() and txn.abort() calls are logged too. :param enable_timeout: If True, a timeout error is raised if the request runs for a longer time than the configured timeout.
The list is composed of (starttime, endtime, db_id, statement) tuples. Times are given in milliseconds since the start of the request.
If timouts are disabled, None is returned.
Parameters | no_exception | If True, do not raise an error if the request is out of time. Instead return a float e.g. -2.0 for 2 seconds over budget. |
now | Override the result of time.time() | |
timeout | A custom timeout in ms. | |
Returns | None or a float representing the remaining time budget. |
When the app server is running, we want ensure we don't use the connection cache from the main thread as this would only be done on process startup and would leave an open connection dangling, wasting resources.
This method is invoked by an IProcessStartingEvent - it would be easier to do on module load, but the test suite has legitimate uses for using connections from the main thread.
Returns the object if it already comes from the relevant master Store.
Registered as a trusted adapter, so if the input is security wrapped, so is the result. Otherwise an unwrapped object is returned.