]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/tests/functional/pyocf/types/cleaner.py
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / ocf / tests / functional / pyocf / types / cleaner.py
1 #
2 # Copyright(c) 2019 Intel Corporation
3 # SPDX-License-Identifier: BSD-3-Clause-Clear
4 #
5
6 from ctypes import c_void_p, CFUNCTYPE, Structure, c_int
7 from .shared import SharedOcfObject
8
9
10 class CleanerOps(Structure):
11 INIT = CFUNCTYPE(c_int, c_void_p)
12 KICK = CFUNCTYPE(None, c_void_p)
13 STOP = CFUNCTYPE(None, c_void_p)
14
15 _fields_ = [("init", INIT), ("kick", KICK), ("stop", STOP)]
16
17
18 class Cleaner(SharedOcfObject):
19 _instances_ = {}
20 _fields_ = [("cleaner", c_void_p)]
21
22 def __init__(self):
23 self._as_parameter_ = self.cleaner
24 super().__init__()
25
26 @classmethod
27 def get_ops(cls):
28 return CleanerOps(init=cls._init, kick=cls._kick, stop=cls._stop)
29
30 @staticmethod
31 @CleanerOps.INIT
32 def _init(cleaner):
33 return 0
34
35 @staticmethod
36 @CleanerOps.KICK
37 def _kick(cleaner):
38 pass
39
40 @staticmethod
41 @CleanerOps.STOP
42 def _stop(cleaner):
43 pass