@@ -160,21 +160,16 @@ def _load(self, caller_key: "KeySpecifier | None" = None) -> None:
160160 InvalidKeyError: If the key specifier is invalid or mismatches
161161 the header, or if the file has operations but no key specifier.
162162 """
163- # Check if file exists - if not, treat as empty table
164163 if not self ._path .exists ():
165164 self ._load_empty_table (caller_key )
166165 return
167166
168- # Read and parse the file
169167 header , operations = read_table_file (
170168 self ._path , max_file_size = self ._max_file_size
171169 )
172170 self ._header = header
173-
174- # Track file stats for auto-reload
175171 self ._update_file_stats ()
176172
177- # Resolve which key specifier to use
178173 resolved_key = self ._resolve_key_specifier (caller_key , header , operations )
179174 if resolved_key is None :
180175 # Empty file with no key specifier - OK for now
@@ -185,7 +180,6 @@ def _load(self, caller_key: "KeySpecifier | None" = None) -> None:
185180
186181 self ._key_specifier = resolved_key
187182
188- # Compute logical state if we have operations
189183 if operations :
190184 self ._state = compute_logical_state (operations , self ._key_specifier )
191185 else :
@@ -205,12 +199,10 @@ def _load_from_content(self, content: bytes) -> None:
205199 ParseError: If the content contains invalid data.
206200 """
207201 if not content :
208- # Empty content - nothing to load
209202 self ._state = {}
210203 self ._cached_sorted_keys = None
211204 return
212205
213- # Parse the content
214206 header , operations = parse_table_content (content )
215207 self ._header = header
216208
@@ -223,7 +215,6 @@ def _load_from_content(self, content: bytes) -> None:
223215
224216 self ._key_specifier = resolved_key
225217
226- # Compute logical state if we have operations
227218 if operations :
228219 self ._state = compute_logical_state (operations , self ._key_specifier )
229220 else :
@@ -395,8 +386,6 @@ def reload(self) -> None:
395386 self ._load ()
396387 self ._cached_sorted_keys = None
397388
398- # --- Write Operations ---
399-
400389 def _require_key_specifier (self ) -> KeySpecifier :
401390 """Return key specifier or raise InvalidKeyError if not set."""
402391 if self ._key_specifier is None :
@@ -525,14 +514,11 @@ def delete(self, key: Key) -> bool:
525514 # Validate key arity matches specifier
526515 validate_key_arity (key , key_specifier )
527516
528- # Validate key length
529517 validate_key_length (key )
530518
531- # Build tombstone
532519 tombstone = build_tombstone (key , key_specifier )
533520 serialized = serialize_json (tombstone )
534521
535- # Write under lock - returns whether key existed (checked after reload)
536522 return self ._write_with_lock (serialized , key , None )
537523
538524 def clear (self ) -> None :
0 commit comments