No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #-*- coding: utf-8 -*-
  2. __plugin_type__ = 'datasource'
  3. __plugin_name__ = 'mongodb_datasource'
  4. __version__ = '0.0.1'
  5. __plugin_type__ = 'datasource'
  6. __loader__ = "main.py"
  7. __confspec__ = "confspec.py"
  8. __author__ = "Lodel2 dev team"
  9. __fullname__ = "MongoDB plugin"
  10. ## @brief Activates the plugin
  11. #
  12. # @note It is possible there to add some specific actions (like checks, etc ...) for the plugin
  13. #
  14. # @return bool|str : True if all the checks are OK, an error message if not
  15. def _activate():
  16. from lodel import buildconf
  17. return buildconf.PYMONGO
  18. #
  19. # Doxygen comments
  20. #
  21. ##@defgroup plugin_mongodb_datasource MongoDB datasource plugin
  22. #@brief Doc about mongodb datasource
  23. ##@page plugin_mongodb_backref_complexity Reflexion on back reference complexity
  24. #@ingroup plugin_mongodb_bref_op
  25. #
  26. #Their is a huge performance issue in the way we implemented references
  27. #and back references for mongodb datasource :
  28. #
  29. #For each write action (update, delete or insert) we HAVE TO run a select
  30. #on all concerned LeObject. In fact those methods headers looks like
  31. #<pre>def write_action(target_cls, filters, [datas])</pre>
  32. #
  33. #We have no idea if all the modified objects are of the target class (they
  34. #can be of any target's child classes). So that means we have no idea of the
  35. #@ref base_classes.Reference "References" that will be modified by the action.
  36. #
  37. #Another problem is that when we run an update or a delete we have no idea
  38. #of the values that will be updated or deleted (we do not have the concerned
  39. #instances datas). As a result we cannot replace or delete the concerned
  40. #back references.
  41. #
  42. #In term of complexity the number of DB query looks like :
  43. #<pre>
  44. #With n the number of instances to modify :
  45. #queryO(n) ~= 2n ( n * select + n * update )
  46. #</pre>
  47. #But it can go really bad, really fast if we take in consideration that
  48. #query's can be done on mixed classes or abstract classes. With :
  49. #- n : the number of LeObect child classes represented by the abstract class
  50. #- m : the number of LeObject child classes for each n
  51. #- o : the number of concerned back_reference classes for each m
  52. #
  53. #<pre>queryO(n,m,o) ~= n + (n*m) + (n*m*o) => n + n*m select and n*m*o updates</pre>
  54. #
  55. #All of this is really sad especially as the update and the delete will be
  56. #run on LeObject instances....
  57. #