mi::bridge::IClient_job Class Reference
[Bridge client]
Description
Represents the client-side part of a job that can be executed by the Bridge server. The corresponding server-side part of the job must return the same ID from mi::neuraylib::ISerializable::get_class_id() and be registered as a Bridge job on the server.
The client-side part must implement mi::neuraylib::ISerializable::serialize() to serialize the data that is received by mi::bridge::IServer_job::deserialize(), and mi::bridge::IClient_job::receive_remote_result() to deserialize the result of the job which is produced by mi::bridge::IServer_job::execute().
It is recommended to derived your implementation from mi::bridge::Client_job and overriding only the required methods.
See also:
mi::bridge::IClient_transaction::execute()
Public Member Functions
- virtual void error_callback( Sint32 error_code, const char* msg) =0
- A callback that indicates an error during job execution. More...
- virtual void get_references( neuraylib::ITag_set* result) const =0
- Returns the database elements that will be used by this job on the server, identified by a set of tags. More...
- virtual void get_references( IElement_set* result) const =0
- Returns the database elements that will be used by this job on the server, identified by a set of names. More...
- virtual void progress_callback( IClient_job_progress* job_progress) =0
- A callback that provides progress information. More...
- virtual void receive_remote_result( neuraylib::IDeserializer* deserializer, bool last_result) =0
- Deserializes the job result from the execution of the job on the server. More...
- virtual bool upload_only() const =0
- Indicates whether the referenced elements should really be updated in the server-side database. More...
Member Functions
- virtual void mi::bridge::IClient_job::error_callback( Sint32 error_code, const char* msg) [pure virtual]
-
A callback that indicates an error during job execution.
Parameters
- error_code
-
- 0: The client transaction was aborted before the job was done.
- -1: Network error.
- -2: Corresponding server side job does not exist.
- <= -3: Unspecified error.
- msg
- A short explanation of the error.
- virtual void mi::bridge::IClient_job::get_references( neuraylib::ITag_set* result) const [pure virtual]
-
Returns the database elements that will be used by this job on the server, identified by a set of tags. The Bridge will guarantee that any elements returned by this method and any elements indirectly referenced by them will be updated in the server-side cache and database before this Bridge job executes on the server.
Note:The elements identified by the overload get_references( IElement_set*)constwill also be updated.
See also:
Parameters
- result
- The set of tags referenced by the Bridge job. The passed-in tag set is empty.
- virtual void mi::bridge::IClient_job::get_references( IElement_set* result) const [pure virtual]
-
Returns the database elements that will be used by this job on the server, identified by a set of names. The Bridge will guarantee that any elements returned by this method and any elements indirectly referenced by them will be updated in the server-side cache and database before this Bridge job executes on the server.
Note:The elements identified by the overload get_references( neuraylib::ITag_set*)const will also be updated.
See also:
Parameters
- result
- The set of element names referenced by the Bridge job. The passed-in element set is empty.
- virtual void mi::bridge::IClient_job::progress_callback( IClient_job_progress* job_progress) [pure virtual]
-
A callback that provides progress information. This method is called whenever the state of the job changes and also periodically if the job stays in a state for a long time. During execution of the job, custom progress information can be encoded into chunks of result data.
See also:
Client_job_state, receive_remote_result(), IServer_job::execute()
Parameters
- job_progress
- An instance that contains all progress information. The instance may only be used from within this callback.
- virtual void mi::bridge::IClient_job::receive_remote_result( neuraylib::IDeserializer* deserializer, bool last_result) [pure virtual]
-
Deserializes the job result from the execution of the job on the server. The execution of the job might produce intermediate results by flushing the data serialized so far. Each call to mi::neuraylib::ISerializer::flush() on the server will result in a single call to receive_remote_result() with the last_result flag set to false, even if no data was flushed. When the execution on the server finishes this method will be called one last time with the last_result flag set to true with the remaining data.
See mi::bridge::IServer_job::execute() for more information and a couple of example use cases.
Parameters
- deserializer
- The deserializer from which to read the (partial) result.
- last_result
- true if this is the last chunk of result data the job will produce, false otherwise.
- virtual bool mi::bridge::IClient_job::upload_only() const [pure virtual]
-
Indicates whether the referenced elements should really be updated in the server-side database. Usually, this method returns false, meaning that referenced elements are updated in the server-side cache and database. In some circumstances it is not necessary to update the server-side database because only the cache is needed, e.g., when saving snapshots. In this case, one can optimize the update process by returning true, meaning that only the server side cache but not the database are updated before executing the job.
See also: