lqft-python-engine 0.1.9__tar.gz → 0.2.0__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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lqft-python-engine
3
- Version: 0.1.9
4
- Summary: LQFT Engine: Full CRUD Support (v4.5 Stable)
3
+ Version: 0.2.0
4
+ Summary: LQFT Engine: Full CRUD Support & Enterprise Scaling (v4.5 Stable)
5
5
  Home-page: https://github.com/ParjadM/Log-Quantum-Fractal-Tree-LQFT-
6
6
  Author: Parjad Minooei
7
7
  License: MIT
@@ -2,7 +2,7 @@ import hashlib
2
2
  import weakref
3
3
 
4
4
  # ---------------------------------------------------------
5
- # LEGACY PURE PYTHON LQFT (For reference/fallback)
5
+ # LEGACY PURE PYTHON LQFT (For reference/fallback/benchmarks)
6
6
  # ---------------------------------------------------------
7
7
  class LQFTNode:
8
8
  __slots__ = ['children', 'value', 'key_hash', 'struct_hash', '__weakref__']
@@ -115,8 +115,8 @@ except ImportError:
115
115
  class AdaptiveLQFT:
116
116
  """
117
117
  A polymorphic, heuristic-driven data structure wrapper.
118
- - Scale < 50,000: Acts as an ultra-lightweight C-Hash (Python Dict).
119
- - Scale > 50,000: Automatically migrates to the Native C-Engine LQFT
118
+ - Scale < threshold: Acts as an ultra-lightweight C-Hash (Python Dict).
119
+ - Scale > threshold: Automatically migrates to the Native C-Engine LQFT
120
120
  for Merkle-DAG deduplication and folding.
121
121
  """
122
122
  def __init__(self, migration_threshold=50000):
@@ -140,7 +140,7 @@ class AdaptiveLQFT:
140
140
 
141
141
  for key, val in self._light_store.items():
142
142
  h = self._get_64bit_hash(key)
143
- lqft_c_engine.insert(h, val)
143
+ lqft_c_engine.insert(h, str(val))
144
144
 
145
145
  # Clear the lightweight store to free up memory
146
146
  self._light_store.clear()
@@ -159,7 +159,7 @@ class AdaptiveLQFT:
159
159
  else:
160
160
  # Phase 2: Massive Data Operations (Native C-Heap)
161
161
  h = self._get_64bit_hash(key)
162
- lqft_c_engine.insert(h, value)
162
+ lqft_c_engine.insert(h, str(value))
163
163
 
164
164
  def search(self, key):
165
165
  if not self.is_native:
@@ -168,9 +168,23 @@ class AdaptiveLQFT:
168
168
  h = self._get_64bit_hash(key)
169
169
  return lqft_c_engine.search(h)
170
170
 
171
+ def remove(self, key):
172
+ """Deletes a key from either the light store or the Merkle tree."""
173
+ if not self.is_native:
174
+ if key in self._light_store:
175
+ del self._light_store[key]
176
+ self.size -= 1
177
+ else:
178
+ h = self._get_64bit_hash(key)
179
+ lqft_c_engine.delete(h)
180
+
181
+ def delete(self, key):
182
+ """Alias for remove to satisfy all testing suites."""
183
+ self.remove(key)
184
+
171
185
  def clear(self):
172
186
  """
173
- Memory Reclamation: Manually trigger C-level heap cleanup.
187
+ Memory Reclamation: Manually trigger heap cleanup.
174
188
  In the Adaptive model, this handles both the Python dict and the C-Registry.
175
189
  """
176
190
  self._light_store.clear()
@@ -179,21 +193,23 @@ class AdaptiveLQFT:
179
193
  return lqft_c_engine.free_all()
180
194
  return 0
181
195
 
196
+ def get_stats(self):
197
+ """Fetches memory metrics from the C-Engine if active."""
198
+ if self.is_native and C_ENGINE_READY:
199
+ return lqft_c_engine.get_metrics()
200
+ return {"physical_nodes": 0}
201
+
182
202
  def __del__(self):
183
- """
184
- Finalizer: Reclaims unmanaged C memory when the Python object is deleted.
185
- Crucial for preventing memory leaks in long-running systems.
186
- """
203
+ """Finalizer: Reclaims unmanaged C memory when the Python object is deleted."""
187
204
  try:
188
205
  self.clear()
189
206
  except:
190
- # Silence errors during late interpreter shutdown/garbage collection
191
207
  pass
192
208
 
193
209
  def status(self):
194
210
  """Returns the current state of the engine."""
195
211
  return {
196
212
  "mode": "Native Merkle-DAG" if self.is_native else "Lightweight C-Hash",
197
- "items": self.size,
213
+ "items": self.size if not self.is_native else lqft_c_engine.get_metrics().get('physical_nodes', self.size),
198
214
  "threshold": self.threshold
199
215
  }
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lqft-python-engine
3
- Version: 0.1.9
4
- Summary: LQFT Engine: Full CRUD Support (v4.5 Stable)
3
+ Version: 0.2.0
4
+ Summary: LQFT Engine: Full CRUD Support & Enterprise Scaling (v4.5 Stable)
5
5
  Home-page: https://github.com/ParjadM/Log-Quantum-Fractal-Tree-LQFT-
6
6
  Author: Parjad Minooei
7
7
  License: MIT
@@ -27,8 +27,8 @@ lqft_extension = Extension(
27
27
 
28
28
  setup(
29
29
  name="lqft-python-engine",
30
- version="0.1.9",
31
- description="LQFT Engine: Full CRUD Support (v4.5 Stable)",
30
+ version="0.2.0",
31
+ description="LQFT Engine: Full CRUD Support & Enterprise Scaling (v4.5 Stable)",
32
32
  long_description=long_description,
33
33
  long_description_content_type="text/markdown",
34
34
  author="Parjad Minooei",