pyocf: implement get_(front_)volume() in Cache and Core
This common interface is later going to be used for generic code implementing cache/core exported object I/O. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
2672f5460a
commit
e0c762387c
@ -35,12 +35,12 @@ from ..utils import Size, struct_to_dict
|
|||||||
from .core import Core
|
from .core import Core
|
||||||
from .queue import Queue
|
from .queue import Queue
|
||||||
from .stats.cache import CacheInfo
|
from .stats.cache import CacheInfo
|
||||||
|
from .io import IoDir
|
||||||
from .ioclass import IoClassesInfo, IoClassInfo
|
from .ioclass import IoClassesInfo, IoClassInfo
|
||||||
from .stats.shared import UsageStats, RequestsStats, BlocksStats, ErrorsStats
|
from .stats.shared import UsageStats, RequestsStats, BlocksStats, ErrorsStats
|
||||||
from .ctx import OcfCtx
|
from .ctx import OcfCtx
|
||||||
from .volume import RamVolume
|
from .volume import RamVolume
|
||||||
|
|
||||||
|
|
||||||
class Backfill(Structure):
|
class Backfill(Structure):
|
||||||
_fields_ = [("_max_queue_size", c_uint32), ("_queue_unblock_size", c_uint32)]
|
_fields_ = [("_max_queue_size", c_uint32), ("_queue_unblock_size", c_uint32)]
|
||||||
|
|
||||||
@ -655,6 +655,12 @@ class Cache:
|
|||||||
|
|
||||||
self.cores.remove(core)
|
self.cores.remove(core)
|
||||||
|
|
||||||
|
def get_front_volume(self):
|
||||||
|
return Volume.get_instance(lib.ocf_cache_get_front_volume(self.cache_handle))
|
||||||
|
|
||||||
|
def get_volume(self):
|
||||||
|
return Volume.get_instance(lib.ocf_cache_get_volume(self.cache_handle))
|
||||||
|
|
||||||
def get_stats(self):
|
def get_stats(self):
|
||||||
cache_info = CacheInfo()
|
cache_info = CacheInfo()
|
||||||
usage = UsageStats()
|
usage = UsageStats()
|
||||||
@ -803,6 +809,10 @@ lib.ocf_mngt_cache_remove_core.argtypes = [c_void_p, c_void_p, c_void_p]
|
|||||||
lib.ocf_mngt_cache_add_core.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p]
|
lib.ocf_mngt_cache_add_core.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p]
|
||||||
lib.ocf_cache_get_name.argtypes = [c_void_p]
|
lib.ocf_cache_get_name.argtypes = [c_void_p]
|
||||||
lib.ocf_cache_get_name.restype = c_char_p
|
lib.ocf_cache_get_name.restype = c_char_p
|
||||||
|
lib.ocf_cache_get_front_volume.argtypes = [c_void_p]
|
||||||
|
lib.ocf_cache_get_front_volume.restype = c_void_p
|
||||||
|
lib.ocf_cache_get_volume.argtypes = [c_void_p]
|
||||||
|
lib.ocf_cache_get_volume.restype = c_void_p
|
||||||
lib.ocf_mngt_cache_cleaning_set_policy.argtypes = [
|
lib.ocf_mngt_cache_cleaning_set_policy.argtypes = [
|
||||||
c_void_p,
|
c_void_p,
|
||||||
c_uint32,
|
c_uint32,
|
||||||
|
@ -114,6 +114,12 @@ class Core:
|
|||||||
|
|
||||||
return Io.from_pointer(io)
|
return Io.from_pointer(io)
|
||||||
|
|
||||||
|
def get_front_volume(self):
|
||||||
|
return Volume.get_instance(lib.ocf_core_get_front_volume(self.handle))
|
||||||
|
|
||||||
|
def get_volume(self):
|
||||||
|
return Volume.get_instance(lib.ocf_core_get_volume(self.handle))
|
||||||
|
|
||||||
def new_core_io(
|
def new_core_io(
|
||||||
self, queue: Queue, addr: int, length: int, direction: IoDir,
|
self, queue: Queue, addr: int, length: int, direction: IoDir,
|
||||||
io_class: int, flags: int
|
io_class: int, flags: int
|
||||||
@ -227,7 +233,6 @@ class Core:
|
|||||||
lib = OcfLib.getInstance()
|
lib = OcfLib.getInstance()
|
||||||
lib.ocf_core_get_uuid_wrapper.restype = POINTER(Uuid)
|
lib.ocf_core_get_uuid_wrapper.restype = POINTER(Uuid)
|
||||||
lib.ocf_core_get_uuid_wrapper.argtypes = [c_void_p]
|
lib.ocf_core_get_uuid_wrapper.argtypes = [c_void_p]
|
||||||
lib.ocf_core_get_volume.restype = c_void_p
|
|
||||||
lib.ocf_volume_new_io.argtypes = [
|
lib.ocf_volume_new_io.argtypes = [
|
||||||
c_void_p,
|
c_void_p,
|
||||||
c_void_p,
|
c_void_p,
|
||||||
@ -240,6 +245,8 @@ lib.ocf_volume_new_io.argtypes = [
|
|||||||
lib.ocf_volume_new_io.restype = c_void_p
|
lib.ocf_volume_new_io.restype = c_void_p
|
||||||
lib.ocf_core_get_volume.argtypes = [c_void_p]
|
lib.ocf_core_get_volume.argtypes = [c_void_p]
|
||||||
lib.ocf_core_get_volume.restype = c_void_p
|
lib.ocf_core_get_volume.restype = c_void_p
|
||||||
|
lib.ocf_core_get_front_volume.argtypes = [c_void_p]
|
||||||
|
lib.ocf_core_get_front_volume.restype = c_void_p
|
||||||
lib.ocf_mngt_core_set_seq_cutoff_policy.argtypes = [c_void_p, c_uint32]
|
lib.ocf_mngt_core_set_seq_cutoff_policy.argtypes = [c_void_p, c_uint32]
|
||||||
lib.ocf_mngt_core_set_seq_cutoff_policy.restype = c_int
|
lib.ocf_mngt_core_set_seq_cutoff_policy.restype = c_int
|
||||||
lib.ocf_mngt_core_set_seq_cutoff_threshold.argtypes = [c_void_p, c_uint32]
|
lib.ocf_mngt_core_set_seq_cutoff_threshold.argtypes = [c_void_p, c_uint32]
|
||||||
|
Loading…
Reference in New Issue
Block a user