Files
snake-python/server/metrics/MemoryMetricsStore.py
T

19 lines
543 B
Python

class MemoryMetricsStore:
def __init__(self, **kwargs):
self._snapshots:dict[str, dict] = {}
async def publish(self, worker_id:str, snapshot:dict) -> None:
self._snapshots[worker_id] = dict(snapshot)
async def load_all(self) -> list[dict]:
return [dict(value) for value in self._snapshots.values()]
async def clear_all(self) -> None:
self._snapshots.clear()
async def acquire_startup_cleanup_lock(self, lock_key:str, ttl_seconds:int=300) -> bool:
return True
async def close(self) -> None:
return None