@@ -440,7 +440,7 @@ class DictStore(MutableMapping):
440
440
441
441
Notes
442
442
-----
443
- This class should be safe to read or write in multiple threads.
443
+ Safe to write in multiple threads.
444
444
445
445
"""
446
446
@@ -647,10 +647,10 @@ class DirectoryStore(MutableMapping):
647
647
-----
648
648
Atomic writes are used, which means that data are first written to a
649
649
temporary file, then moved into place when the write is successfully
650
- completed.
650
+ completed. Files are only held open while they are being read or written and are
651
+ closed immediately afterwards, so there is no need to manually close any files.
651
652
652
- Files are only held open while they are being read or written and are closed
653
- immediately afterwards, so there is no need to manually close any files.
653
+ Safe to write in multiple threads or processes.
654
654
655
655
"""
656
656
@@ -901,6 +901,8 @@ class NestedDirectoryStore(DirectoryStore):
901
901
files for multidimensional arrays will be organised into a directory
902
902
hierarchy, thus reducing the number of files in any one directory.
903
903
904
+ Safe to write in multiple threads or processes.
905
+
904
906
"""
905
907
906
908
def __init__ (self , path ):
@@ -1030,6 +1032,8 @@ class also supports the context manager protocol, which ensures the ``close()``
1030
1032
Alternatively, use a :class:`DirectoryStore` when writing the data, then
1031
1033
manually Zip the directory and use the Zip file for subsequent reads.
1032
1034
1035
+ Safe to write in multiple threads but not in multiple processes.
1036
+
1033
1037
"""
1034
1038
1035
1039
def __init__ (self , path , compression = zipfile .ZIP_STORED , allowZip64 = True , mode = 'a' ):
@@ -1310,6 +1314,10 @@ class DBMStore(MutableMapping):
1310
1314
corresponding open function, e.g., `dbm.gnu.open` to use the GNU DBM
1311
1315
library.
1312
1316
1317
+ Safe to write in multiple threads. May be safe to write in multiple processes,
1318
+ depending on which DBM implementation is being used, although this has not been
1319
+ tested.
1320
+
1313
1321
"""
1314
1322
1315
1323
def __init__ (self , path , flag = 'c' , mode = 0o666 , open = None , write_lock = True ,
@@ -1322,6 +1330,7 @@ def __init__(self, path, flag='c', mode=0o666, open=None, write_lock=True,
1322
1330
import dbm
1323
1331
open = dbm .open
1324
1332
path = os .path .abspath (path )
1333
+ # noinspection PyArgumentList
1325
1334
self .db = open (path , flag , mode , ** open_kwargs )
1326
1335
self .path = path
1327
1336
self .flag = flag
@@ -1471,6 +1480,14 @@ class LMDBStore(MutableMapping):
1471
1480
... z[...] = 42
1472
1481
... # no need to call store.close()
1473
1482
1483
+ Notes
1484
+ -----
1485
+ By default writes are not immediately flushed to disk to increase performance. You
1486
+ can ensure data are flushed to disk by calling the ``flush()`` or ``close()`` methods.
1487
+
1488
+ Should be safe to write in multiple threads or processes due to the synchronization
1489
+ support within LMDB, although writing from multiple processes has not been tested.
1490
+
1474
1491
"""
1475
1492
1476
1493
def __init__ (self , path , buffers = True , ** kwargs ):
0 commit comments