[KV Offload] Pass ReqContext to touch(), complete_load(), and complete_store() (#41366)

Signed-off-by: Ronen Schaffer <ronen.schaffer@ibm.com>
This commit is contained in:
Ronen Schaffer
2026-05-10 15:09:25 +03:00
committed by GitHub
parent a54f0d1049
commit e175192d33
5 changed files with 70 additions and 50 deletions
+11 -3
View File
@@ -147,22 +147,24 @@ class OffloadingManager(ABC):
"""
pass
def touch(self, keys: Collection[OffloadKey]):
def touch(self, keys: Collection[OffloadKey], req_context: ReqContext):
"""
Mark the given blocks as recently used.
This could in practice mean moving them to the end of an LRU list.
Args:
keys: the keys identifying the blocks.
req_context: per-request context (e.g. kv_transfer_params).
"""
return
def complete_load(self, keys: Collection[OffloadKey]):
def complete_load(self, keys: Collection[OffloadKey], req_context: ReqContext):
"""
Marks previous blocks that were prepared to load as done loading.
Args:
keys: the keys identifying the blocks.
req_context: per-request context (e.g. kv_transfer_params).
"""
return
@@ -189,7 +191,12 @@ class OffloadingManager(ABC):
"""
pass
def complete_store(self, keys: Collection[OffloadKey], success: bool = True):
def complete_store(
self,
keys: Collection[OffloadKey],
req_context: ReqContext,
success: bool = True,
):
"""
Marks blocks which were previously prepared to be stored, as stored.
Following this call, the blocks become loadable.
@@ -198,6 +205,7 @@ class OffloadingManager(ABC):
Args:
keys: the keys identifying the blocks.
req_context: per-request context (e.g. kv_transfer_params).
success: whether the blocks were stored successfully.
"""
return
+8 -3
View File
@@ -106,10 +106,12 @@ class CPUOffloadingManager(OffloadingManager):
blocks.append(block)
return self._get_load_store_spec(keys, blocks)
def touch(self, keys: Collection[OffloadKey]) -> None:
def touch(self, keys: Collection[OffloadKey], req_context: ReqContext) -> None:
self._policy.touch(keys)
def complete_load(self, keys: Collection[OffloadKey]) -> None:
def complete_load(
self, keys: Collection[OffloadKey], req_context: ReqContext
) -> None:
for key in keys:
block = self._policy.get(key)
assert block is not None, f"Block {key!r} not found"
@@ -172,7 +174,10 @@ class CPUOffloadingManager(OffloadingManager):
)
def complete_store(
self, keys: Collection[OffloadKey], success: bool = True
self,
keys: Collection[OffloadKey],
req_context: ReqContext,
success: bool = True,
) -> None:
stored_keys: list[OffloadKey] = []
+11 -6
View File
@@ -105,16 +105,21 @@ class FilterReusedOffloadingManager(OffloadingManager):
) -> LoadStoreSpec:
return self._backing.prepare_load(keys, req_context)
def touch(self, keys: Collection[OffloadKey]) -> None:
return self._backing.touch(keys)
def touch(self, keys: Collection[OffloadKey], req_context: ReqContext) -> None:
return self._backing.touch(keys, req_context)
def complete_load(self, keys: Collection[OffloadKey]) -> None:
return self._backing.complete_load(keys)
def complete_load(
self, keys: Collection[OffloadKey], req_context: ReqContext
) -> None:
return self._backing.complete_load(keys, req_context)
def complete_store(
self, keys: Collection[OffloadKey], success: bool = True
self,
keys: Collection[OffloadKey],
req_context: ReqContext,
success: bool = True,
) -> None:
return self._backing.complete_store(keys, success)
return self._backing.complete_store(keys, req_context, success)
def take_events(self) -> Iterable[OffloadingEvent]:
return self._backing.take_events()