-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathprotocols.py
More file actions
34 lines (26 loc) · 1.03 KB
/
protocols.py
File metadata and controls
34 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Reader protocol for libCacheSim Python bindings.
ReaderProtocol defines the interface contract for trace readers,
enabling different implementations (Python/C++) to work interchangeably.
"""
from __future__ import annotations
from typing import Iterator, Protocol, runtime_checkable, TYPE_CHECKING
if TYPE_CHECKING:
from .libcachesim_python import Request
@runtime_checkable
class ReaderProtocol(Protocol):
"""Protocol for trace readers
This protocol ensures that different reader implementations
(SyntheticReader, TraceReader) can be used interchangeably.
Only core methods are defined here.
"""
def get_num_of_req(self) -> int: ...
def read_one_req(self) -> Request: ...
def skip_n_req(self, n: int) -> int: ...
def reset(self) -> None: ...
def close(self) -> None: ...
def clone(self) -> "ReaderProtocol": ...
def get_working_set_size(self) -> tuple[int, int]: ...
def __iter__(self) -> Iterator[Request]: ...
def __next__(self) -> Request: ...
def __len__(self) -> int: ...