virtuals-binary-codec 0.1.1__tar.gz → 0.1.2__tar.gz

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.
Files changed (17) hide show
  1. {virtuals_binary_codec-0.1.1/src/virtuals_binary_codec.egg-info → virtuals_binary_codec-0.1.2}/PKG-INFO +1 -1
  2. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/pyproject.toml +1 -1
  3. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec/binary_codec.pyx +8 -3
  4. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2/src/virtuals_binary_codec.egg-info}/PKG-INFO +1 -1
  5. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/LICENSE +0 -0
  6. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/MANIFEST.in +0 -0
  7. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/README.md +0 -0
  8. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/setup.cfg +0 -0
  9. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/setup.py +0 -0
  10. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec/__init__.py +0 -0
  11. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec/binary_codec.pyi +0 -0
  12. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec/exceptions.py +0 -0
  13. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec.egg-info/SOURCES.txt +0 -0
  14. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec.egg-info/dependency_links.txt +0 -0
  15. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec.egg-info/not-zip-safe +0 -0
  16. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec.egg-info/requires.txt +0 -0
  17. {virtuals_binary_codec-0.1.1 → virtuals_binary_codec-0.1.2}/src/virtuals_binary_codec.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: virtuals-binary-codec
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Cython-optimized binary key codec for Virtuals.
5
5
  Author-email: Gor Arakelyan <gorarkln@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
10
10
  # ============================================================================
11
11
  [project]
12
12
  name = "virtuals-binary-codec"
13
- version = "0.1.1"
13
+ version = "0.1.2"
14
14
  description = "Cython-optimized binary key codec for Virtuals."
15
15
  readme = "README.md"
16
16
  license = "Apache-2.0"
@@ -132,6 +132,11 @@ cdef class BinaryKeyCodec:
132
132
  - Null bytes in content: 0x00 -> 0x00 0xFF (escaped)
133
133
  - Terminator is bare 0x00 (not escaped)
134
134
  - This ensures shorter strings sort before longer strings with same prefix
135
+
136
+ Empty strings:
137
+ - "" encodes as 0x02 0x00 and sorts before every other string
138
+ - Unambiguous: a terminator is followed by a type marker (0x01/0x02) or
139
+ the end of the key, never by the escape byte 0xFF
135
140
  """
136
141
 
137
142
  def encode(self, tuple key):
@@ -180,9 +185,9 @@ cdef class BinaryKeyCodec:
180
185
  str_data = <const unsigned char*>PyBytes_AS_STRING(str_bytes)
181
186
  str_len = PyBytes_GET_SIZE(str_bytes)
182
187
 
183
- # Check string length bounds
184
- if str_len == 0:
185
- raise EncodeError(f"Empty string at index {i} not allowed")
188
+ # Check string length bound. The empty string is legal: it
189
+ # encodes as TYPE_STR + TERMINATOR and sorts before every
190
+ # other string.
186
191
  if str_len > MAX_STRING_LENGTH:
187
192
  raise EncodeError(
188
193
  f"String at index {i} too long: {str_len} bytes "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: virtuals-binary-codec
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Cython-optimized binary key codec for Virtuals.
5
5
  Author-email: Gor Arakelyan <gorarkln@gmail.com>
6
6
  License-Expression: Apache-2.0