scruby 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
scruby/__init__.py CHANGED
@@ -1,13 +1,15 @@
1
1
  """A fast key-value storage library.
2
2
 
3
- Scruby is a fast key-value storage library that provides an ordered mapping from string keys to string values.
3
+ Scruby is a fast key-value storage asynchronous library that provides an
4
+ ordered mapping from string keys to string values.
4
5
  The library uses fractal-tree addressing.
5
6
 
6
7
  The database consists of collections.
7
8
  The maximum size of the one collection is 16**8=4294967296 branches,
8
9
  each branch can store one or more keys.
9
10
 
10
- The value of any key in collection can be obtained in 8 steps, thereby achieving high performance.
11
+ The value of any key in collection can be obtained in 8 steps,
12
+ thereby achieving high performance.
11
13
 
12
14
  In the future, to search by value of key, the use of a quantum loop is supposed.
13
15
  """
scruby/db.py CHANGED
@@ -30,30 +30,26 @@ class Scruby[T]:
30
30
  ) -> None:
31
31
  self.__class_model = class_model
32
32
 
33
- def check_key(self, key: str) -> None:
34
- """Check the key."""
35
- if not isinstance(key, str):
36
- raise KeyError("The key is not a type of `str`.")
37
- if len(key) == 0:
38
- raise KeyError("The key should not be empty.")
39
-
40
33
  async def get_leaf_path(self, key: str) -> Path:
41
34
  """Get the path to the database cell by key.
42
35
 
43
36
  Args:
44
37
  key: Key name.
45
38
  """
46
- self.check_key(key)
47
- # Key to crc32 sum.
48
- key_crc32: str = f"{zlib.crc32(key.encode('utf-8')):08x}"
49
- # Convert crc32 sum in the segment of path.
50
- separated_crc32: str = "/".join(list(key_crc32))
39
+ if not isinstance(key, str):
40
+ raise KeyError("The key is not a type of `str`.")
41
+ if len(key) == 0:
42
+ raise KeyError("The key should not be empty.")
43
+ # Key to adler32 sum.
44
+ key_adler32: str = f"{zlib.adler32(key.encode('utf-8')):08x}"
45
+ # Convert adler32 sum in the segment of path.
46
+ separated_adler32: str = "/".join(list(key_adler32))
51
47
  # The path of the branch to the database.
52
48
  branch_path: Path = Path(
53
49
  *(
54
50
  constants.DB_ROOT,
55
51
  self.__class_model.__name__,
56
- separated_crc32,
52
+ separated_adler32,
57
53
  ),
58
54
  )
59
55
  # If the branch does not exist, need to create it.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scruby
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: A fast key-value storage library.
5
5
  Project-URL: Homepage, https://github.com/kebasyaty/scruby
6
6
  Project-URL: Repository, https://github.com/kebasyaty/scruby
@@ -65,10 +65,12 @@ Description-Content-Type: text/markdown
65
65
  <a href="https://github.com/kebasyaty/scruby/releases/" alt="GitHub release"><img src="https://img.shields.io/github/release/kebasyaty/scruby" alt="GitHub release"></a>
66
66
  </p>
67
67
  <p align="center">
68
- Scruby is a fast key-value storage library that provides an ordered mapping from string keys to string values.
68
+ Scruby is a fast key-value storage asynchronous library that provides an ordered mapping from string keys to string values.
69
+ <br>
69
70
  The library uses fractal-tree addressing.
70
71
  <br>
71
72
  The database consists of collections.
73
+ <br>
72
74
  The maximum size of the one collection is 16**8=4294967296 branches,
73
75
  each branch can store one or more keys.
74
76
  <br>
@@ -0,0 +1,8 @@
1
+ scruby/__init__.py,sha256=Bhg7pIV6u0YM7Dipr7vH7ka931bVuBoJugiYNd73HQ4,704
2
+ scruby/constants.py,sha256=kwF0FIbeChBxsNxOCQhMsDEn1lakD7MIQKJ-PHYeSAo,328
3
+ scruby/db.py,sha256=qhVoSMu-MDiIdPK4M3ruEZDXxcvKBPu-AS-J_xSNZE4,4763
4
+ scruby/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ scruby-0.6.1.dist-info/METADATA,sha256=qzdPamjqOufrJ7hibG37MaiUV27RAIcPikn9idMIYzg,6786
6
+ scruby-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ scruby-0.6.1.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
8
+ scruby-0.6.1.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- scruby/__init__.py,sha256=Mvy-90k-kNUAlYA7xuCEIT1uC8u5pepuDxGy6DglCxU,689
2
- scruby/constants.py,sha256=kwF0FIbeChBxsNxOCQhMsDEn1lakD7MIQKJ-PHYeSAo,328
3
- scruby/db.py,sha256=Xn7AWXly8nubvWqsRrJYpvozUHB1CXNineizVK6GNEw,4854
4
- scruby/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- scruby-0.6.0.dist-info/METADATA,sha256=2mxPkFwKcU2V-Mw6nz_fru7xo-TVdugS5XUPNYoJONg,6751
6
- scruby-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- scruby-0.6.0.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
8
- scruby-0.6.0.dist-info/RECORD,,
File without changes