codernity avatar codernity committed 64cf972

Documentation updates

Comments (0)

Files changed (3)

CodernityDB/patch.py

 
 
 def patch_cache_lfu(lock_obj):
+    """
+    Patnches cache mechanizm to be thread safe (gevent ones also)
+
+    .. note::
+
+       It's internal CodernityDB mechanizm, it will be called when needed
+
+    """
     import lfu_cache
     import lfu_cache_with_lock
     lfu_lock1lvl = lfu_cache_with_lock.create_cache1lvl(lock_obj)
 
 
 def patch_cache_rr(lock_obj):
+    """
+    Patches cache mechanizm to be thread safe (gevent ones also)
+
+    .. note::
+
+       It's internal CodernityDB mechanizm, it will be called when needed
+
+    """
     import rr_cache
+    import rr_cache_with_lock
+    rr_lock1lvl = rr_cache_with_lock.create_cache1lvl(lock_obj)
+    rr_lock2lvl = rr_cache_with_lock.create_cache2lvl(lock_obj)
+    __patch(rr_cache, 'cache1lvl', rr_lock1lvl)
+    __patch(rr_cache, 'cache2lvl', rr_lock2lvl)
 
 
 def patch_flush_fsync(db_obj):
     setattr(db_obj, 'flush', always_fsync(db_obj))
 
     return
-    import rr_cache_with_lock
-    rr_lock1lvl = rr_cache_with_lock.create_cache1lvl(lock_obj)
-    rr_lock2lvl = rr_cache_with_lock.create_cache2lvl(lock_obj)
-    __patch(rr_cache, 'cache1lvl', rr_lock1lvl)
-    __patch(rr_cache, 'cache2lvl', rr_lock2lvl)
     :members:
     :undoc-members:
     :show-inheritance:
+
+
+Patches
+-------
+
+.. automodule:: CodernityDB.patch
+    :members:
+    :show-inheritance:
+    :undoc-members:
 
 
 .. warning::
-    CodernityDB does no sync kernel buffers with disk itself. To be sure that data is written to disk please call :py:meth:`~CodernityDB.database.Database.fsync`
+    CodernityDB does no sync kernel buffers with disk itself. To be sure that data is written to disk please call :py:meth:`~CodernityDB.database.Database.fsync`, or use :py:meth:`CodernityDB.patch.patch_flush_fsync` to call fsync always when flush is called (after data modification).
 
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.