Skip to content

Handling of import errors

Description

̀̀PDI_import can be used to expose buffer with access properties set to PDI_IN. The question is how to handle import errors when:

  • no import is performed (no plug-in or bad configuration)
  • import has failed but the buffer is unchanged
  • import has failed and the data is or may be corrupted (worst case)
  • transactions prevent using the return status of import
Proposal

Composing with @jbigot and other ideas, we have:

  1. Setting and checking errors
  • When sharing with the access property "PDI_IN", the latest content should be considered as invalid (Default). A flag could be added to the access properties for that for instance PDI_NO_CONTENT or PDI_UNDEFINED.
  • The flag has to be removed by the plug-ins on success only or if the buffer content has been corrupted PDI_UNAVAILABLE or PDI_CORRUPTED. To avoid developer from manipulating the data structure, a PDI_data_set_validity( PDI_data_t data, int is_available) should be provided.
  • A function should be provided to test the data validity (useful if two plugins are coupled) PDI_data_is_available( PDI_data_t data) or int PDI_data_validity( PDI_data_t data)
  1. Handling errors
  • A (global) default setting of PDI can be made available to stop the program after a transaction if the data are corrupted:
required_for_success:
  transaction: init
  • Plug-ins can provide their own mechanism during transaction
    • Local to the plug-in
    • Coupled with an other plug-in: on_success / on_failure: "action to perform". This last point still need some reflection to be factorised for all plug-in.
Edited by Julien Bigot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information