3
from ctypes.util import find_library
6
libgfc = CDLL(find_library("gfchangelog"), use_errno=True)
15
raise OSError(errn, os.strerror(errn))
18
def _get_api(cls, call):
19
return getattr(cls.libgfc, call)
22
def cl_register(cls, brick, path, log_file, log_level, retries = 0):
23
ret = cls._get_api('gf_changelog_register')(brick, path,
24
log_file, log_level, retries)
30
ret = cls._get_api('gf_changelog_scan')()
35
def cl_startfresh(cls):
36
ret = cls._get_api('gf_changelog_start_fresh')()
41
def cl_getchanges(cls):
42
""" remove hardcoding for path name length """
44
return f.split('.')[-1]
46
buf = create_string_buffer('\0', 4096)
47
call = cls._get_api('gf_changelog_next_change')
53
changes.append(buf.raw[:ret-1])
58
return sorted(changes, key=clsort)
61
def cl_done(cls, clfile):
62
ret = cls._get_api('gf_changelog_done')(clfile)