[HiStorage] Remove delete and clear as necessary methods (#10039)
This commit is contained in:
@@ -103,20 +103,6 @@ class HiCacheStorage(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def delete(self, key: str) -> bool:
|
||||
"""
|
||||
Delete the entry associated with the given key.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def clear(self) -> bool:
|
||||
"""
|
||||
Clear all entries in the storage.
|
||||
"""
|
||||
pass
|
||||
|
||||
def batch_exists(self, keys: List[str]) -> int:
|
||||
"""
|
||||
Check if the keys exist in the storage.
|
||||
@@ -227,15 +213,6 @@ class HiCacheFile(HiCacheStorage):
|
||||
tensor_path = os.path.join(self.file_path, f"{key}.bin")
|
||||
return os.path.exists(tensor_path)
|
||||
|
||||
def delete(self, key: str) -> None:
|
||||
key = self._get_suffixed_key(key)
|
||||
tensor_path = os.path.join(self.file_path, f"{key}.bin")
|
||||
try:
|
||||
os.remove(tensor_path)
|
||||
except FileNotFoundError:
|
||||
logger.warning(f"Key {key} does not exist. Cannot delete.")
|
||||
return
|
||||
|
||||
def clear(self) -> bool:
|
||||
try:
|
||||
for filename in os.listdir(self.file_path):
|
||||
|
||||
@@ -264,9 +264,6 @@ class MooncakeStore(HiCacheStorage):
|
||||
return i // key_multiplier
|
||||
return len(query_keys) // key_multiplier
|
||||
|
||||
def delete(self, key) -> None:
|
||||
raise (NotImplementedError)
|
||||
|
||||
def close(self):
|
||||
# MooncakeDistributedStore will automatically call the destructor, so
|
||||
# it is unnecessary to close it manually.
|
||||
|
||||
Reference in New Issue
Block a user