$TEST_WAITING
The test is waiting to be processed.
$TEST_RUNNING
The test is currently being processed.
$TEST_COMPLETED
The test was already processed.
This state encompasses all of the following:
The Zonemaster Engine test terminated normally.
A critical error occurred while processing.
The processing was cancelled because it took too long.
get_db_class
Get the database adapter class for the given database type.
Throws and exception if the database adapter class cannot be loaded.
test_progress( $test_id, $progress )
Get/set the progress value of the test associated with $test_id
.
The given $progress
must be either undef
(when getting) or an number in the range 0-100 inclusive (when setting).
If defined, $progress
is clamped to 1-99 inclusive.
Dies when:
attempting to access a test that does not exist
attempting to update a test that is in a state other than "running"
attempting to set a progress value that is lower than the current one
an error occurs in the database interface
get_test_request( $queue_label )
Find a waiting test and claim it for processing.
If $queue_label is defined it must be an integer. If defined, only tests in the associated queue are considered. Otherwise tests from all queues are considered.
Returns the test id and the batch id of the claimed test. If there are no waiting tests to claim, undef
is returned for both ids.
Only tests in the "waiting" state are considered. When a test is claimed it is removed from the queue and it transitions to the "running" state.
It is safe for multiple callers running in parallel to allocate tests from the same queues.
Dies when an error occurs in the database interface.
claim_test( $test_id )
Claim a test for processing.
Transitions a test from the "waiting" state to the "running" state.
Returns true on successful transition. Returns false if the given test does not exist or if it is not in the "waiting" state.
Dies when an error occurs in the database interface.
process_unfinished_tests($queue_label, $test_run_timeout)
Append a new log entry BACKEND_TEST_AGENT:UNABLE_TO_FINISH_TEST
to all the tests started more that $test_run_timeout seconds in the queue $queue_label. Then store the results in database.
select_unfinished_tests($queue_label, $test_run_timeout)
Search for all tests started more than $test_run_timeout seconds in the queue $queue_label.
force_end_test($hash_id, $msg)
Store the Zonemaster::Engine::Logger::Entry $msg log entry into the database and mark test with $hash_id as COMPLETED.
process_dead_test($hash_id)
Store a new log entry BACKEND_TEST_AGENT:TEST_DIED
in database for the test with $hash_id.
encode_params
Encode the params object into a JSON string. First a projection of some parameters is performed then all additional properties are kept. Returns an UTF-8 binary string of the union of the given hash and its normalization using default values, see https://github.com/zonemaster/zonemaster/blob/master/docs/public/using/backend/rpcapi-reference.md#params-2
generate_fingerprint
Returns a fingerprint (an UTF-8 binary string) of the hash passed in argument (which contain text string). The fingerprint is computed after projecting the hash. Such fingerprint are usefull to find similar tests in the database.
undelegated
Returns the value 1 if the test to be created is if type undelegated, else value 0. The test is considered to be undelegated if the "ds_info" or "nameservers" parameters is are defined with data after projection.