Coverage for src / cufile_patcher / plugins / base.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-11 15:06 +0000

1from __future__ import annotations 

2 

3import ctypes 

4from abc import ABC, abstractmethod 

5 

6from ..cufile_types import CUfileHandle_t 

7 

8 

9class CuFileBackend(ABC): 

10 """Interface for pluggable cuFile backend implementations.""" 

11 

12 @abstractmethod 

13 def driver_open(self) -> None: 

14 ... 

15 

16 @abstractmethod 

17 def driver_close(self) -> None: 

18 ... 

19 

20 @abstractmethod 

21 def handle_register(self, fd: int) -> CUfileHandle_t: 

22 ... 

23 

24 @abstractmethod 

25 def handle_deregister(self, handle: CUfileHandle_t) -> None: 

26 ... 

27 

28 @abstractmethod 

29 def read( 

30 self, 

31 handle: CUfileHandle_t, 

32 buf: ctypes.c_void_p, 

33 size: int, 

34 file_offset: int, 

35 dev_offset: int, 

36 ) -> int: 

37 ... 

38 

39 @abstractmethod 

40 def write( 

41 self, 

42 handle: CUfileHandle_t, 

43 buf: ctypes.c_void_p, 

44 size: int, 

45 file_offset: int, 

46 dev_offset: int, 

47 ) -> int: 

48 ...