def internal_kv_get(self, key: bytes) -> bytes: req = gcs_service_pb2.InternalKVGetRequest(key=key) reply = self._kv_stub.InternalKVGet(req) if reply.status.code == GcsCode.OK: return reply.value elif reply.status.code == GcsCode.NotFound: return None else: raise RuntimeError(f"Failed to get value for key {key} " f"due to error {reply.status.message}")
def internal_kv_get(self, key: bytes, namespace: Optional[bytes]) -> bytes: logger.debug(f"internal_kv_get {key} {namespace}") req = gcs_service_pb2.InternalKVGetRequest(namespace=namespace, key=key) reply = self._kv_stub.InternalKVGet(req) if reply.status.code == GcsCode.OK: return reply.value elif reply.status.code == GcsCode.NotFound: return None else: raise RuntimeError(f"Failed to get value for key {key} " f"due to error {reply.status.message}")