yangdx commited on
Commit
fc6211e
·
1 Parent(s): 6cce1ca

feat: Remove immediate persistence in delete operation for JsonDocStatusStorage

Browse files
Files changed (1) hide show
  1. lightrag/kg/json_doc_status_impl.py +13 -1
lightrag/kg/json_doc_status_impl.py CHANGED
@@ -123,11 +123,23 @@ class JsonDocStatusStorage(DocStatusStorage):
123
  return self._data.get(id)
124
 
125
  async def delete(self, doc_ids: list[str]):
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  async with self._storage_lock:
127
  for doc_id in doc_ids:
128
  self._data.pop(doc_id, None)
129
  await set_all_update_flags(self.namespace)
130
- await self.index_done_callback()
131
 
132
  async def drop(self) -> dict[str, str]:
133
  """Drop all document status data from storage and clean up resources
 
123
  return self._data.get(id)
124
 
125
  async def delete(self, doc_ids: list[str]):
126
+ """Delete specific records from storage by their IDs
127
+
128
+ This method will:
129
+ 1. Remove the specified records from in-memory storage
130
+ 2. Update flags to notify other processes that data persistence is needed
131
+ 3. The changes will be persisted to disk during the next index_done_callback
132
+
133
+ Args:
134
+ ids (list[str]): List of document IDs to be deleted from storage
135
+
136
+ Returns:
137
+ None
138
+ """
139
  async with self._storage_lock:
140
  for doc_id in doc_ids:
141
  self._data.pop(doc_id, None)
142
  await set_all_update_flags(self.namespace)
 
143
 
144
  async def drop(self) -> dict[str, str]:
145
  """Drop all document status data from storage and clean up resources