| 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | # All rights reserved. |
| 3 | # |
| 4 | # This source code is licensed under the terms described in the LICENSE file in |
| 5 | # the root directory of this source tree. |
| 6 | |
| 7 | from datetime import datetime |
| 8 | from typing import List, Optional, Protocol |
| 9 | |
| 10 | |
| 11 | class KVStore(Protocol): |
| 12 | # TODO: make the value type bytes instead of str |
| 13 | async def set( |
| 14 | self, key: str, value: str, expiration: Optional[datetime] = None |
| 15 | ) -> None: ... |
| 16 | |
| 17 | async def get(self, key: str) -> Optional[str]: ... |
| 18 | |
| 19 | async def delete(self, key: str) -> None: ... |
| 20 | |
| 21 | async def range(self, start_key: str, end_key: str) -> List[str]: ... |