diff --git a/README.md b/README.md index 106266e..ad25484 100755 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ A `ShareDB` instance may be opened simultaneously in children, for reading in pa ```python >>> from ShareDB import ShareDB # Easy import >>> print(ShareDB.__version__) # Check version -1.0.5 +1.1.0 >>> myDB = ShareDB(path='./test.ShareDB') # Store ShareDB locally >>> myDB['Name'] = ['Ayaan Hossain'] # Insert information >>> myDB.get(key='Name') # Retrieve values diff --git a/ShareDB/ShareDB.py b/ShareDB/ShareDB.py index 3758d0f..0a72f8d 100755 --- a/ShareDB/ShareDB.py +++ b/ShareDB/ShareDB.py @@ -48,7 +48,7 @@ class ShareDB(object): and Python 3.6 and above. ''' - __version__ = '1.0.7' + __version__ = '1.1.0' __author__ = 'Ayaan Hossain' @@ -73,11 +73,12 @@ def __init__(self, (default=False) readers - integer, max no. of processes that may read data in parallel - (default=40 processes) + (default=100 processes) buffer_size - integer, max no. of commits after which a sync is triggered (default=100,000) - map_size - integer, max amount of bytes to allocate for storage - (default=1TB) + map_size - integer, max amount of bytes to allocate for storage, + if None, then the entire disk is marked for use (safe) + (default=10**12, or 1 TB) Returns: self to ShareDB object. @@ -175,6 +176,10 @@ def __init__(self, if not os.path.isdir(path): os.makedirs(path) + # Determine map_size + if map_size is None: + map_size, _, __ = shutil.disk_usage(path) + # Create configuration if absent if not os.path.exists(path + 'ShareDB.config'): config = ShareDB._store_config( diff --git a/docs/API.md b/docs/API.md index a22eadb..ca22da6 100755 --- a/docs/API.md +++ b/docs/API.md @@ -23,7 +23,7 @@ | `compress` | `string` | if `True` - will compress the values using `zlib` | `False` | | `readers` | `integer` | max no. of processes that may read data in parallel | `100` | | `buffer_size` | `integer` | max no. of commits after which a sync is triggered | `100,000` | -| `map_size` | `integer` | max amount of bytes to allocate for storage | `10**12` (1 TB) | +| `map_size` | `integer` | max amount of bytes to allocate for storage, if `None`, then the entire disk is marked for use (safe) | `10**12` (1 TB) | **_Returns_**: `self` to `ShareDB` object. diff --git a/setup.py b/setup.py index b3fe684..b45f403 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ name='ShareDB', # Link: https://www.python.org/dev/peps/pep-0440/#version-scheme - version='1.0.7', + version='1.1.0', description="An on-disk pythonic embedded key-value store for compressed data storage and distributed data analysis.", diff --git a/tests/test_ShareDB.py b/tests/test_ShareDB.py index a6aa5ff..397050c 100755 --- a/tests/test_ShareDB.py +++ b/tests/test_ShareDB.py @@ -317,7 +317,7 @@ def get_myDB_resources(total): compress=random.choice([True, False]), readers=40, buffer_size=100, - map_size=10**7) + map_size=random.choice([None, 10**7])) # Populate myDB with random items and record keys key_val_dict = {}