[HiStorage] Remove delete and clear as necessary methods (#10039)
This commit is contained in:
@@ -103,20 +103,6 @@ class HiCacheStorage(ABC):
|
|||||||
"""
|
"""
|
||||||
pass
|
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:
|
def batch_exists(self, keys: List[str]) -> int:
|
||||||
"""
|
"""
|
||||||
Check if the keys exist in the storage.
|
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")
|
tensor_path = os.path.join(self.file_path, f"{key}.bin")
|
||||||
return os.path.exists(tensor_path)
|
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:
|
def clear(self) -> bool:
|
||||||
try:
|
try:
|
||||||
for filename in os.listdir(self.file_path):
|
for filename in os.listdir(self.file_path):
|
||||||
|
|||||||
@@ -264,9 +264,6 @@ class MooncakeStore(HiCacheStorage):
|
|||||||
return i // key_multiplier
|
return i // key_multiplier
|
||||||
return len(query_keys) // key_multiplier
|
return len(query_keys) // key_multiplier
|
||||||
|
|
||||||
def delete(self, key) -> None:
|
|
||||||
raise (NotImplementedError)
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
# MooncakeDistributedStore will automatically call the destructor, so
|
# MooncakeDistributedStore will automatically call the destructor, so
|
||||||
# it is unnecessary to close it manually.
|
# it is unnecessary to close it manually.
|
||||||
|
|||||||
Reference in New Issue
Block a user