diff options
author | Aravinda VK <avishwan@redhat.com> | 2014-05-13 11:56:50 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2014-05-13 10:21:44 -0700 |
commit | ba9aec54be5b8f00125ad018618a86de769fb6b5 (patch) | |
tree | 6e5d4be6725c72dec37b9fcff15cea3f45127af3 /geo-replication/syncdaemon/libgfchangelog.py | |
parent | e64dd0a358e7a7b4c0da86a6b17adf6f125c00d5 (diff) |
geo-rep: Changelog History API changes
Additional argument added to API gf_history_changelog,
actual_end - The end time till where changelogs are available.
Added sort to history_get_changes API output.
BUG: 1091961
Change-Id: Id043409882a83cd0a7b9adc3d34d5147d17e532e
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/7747
Reviewed-by: ajeet jha <ajha@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/libgfchangelog.py')
-rw-r--r-- | geo-replication/syncdaemon/libgfchangelog.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/geo-replication/syncdaemon/libgfchangelog.py b/geo-replication/syncdaemon/libgfchangelog.py index e6bfbefd0a6..89ae032016f 100644 --- a/geo-replication/syncdaemon/libgfchangelog.py +++ b/geo-replication/syncdaemon/libgfchangelog.py @@ -9,7 +9,7 @@ # import os -from ctypes import CDLL, create_string_buffer, get_errno +from ctypes import CDLL, create_string_buffer, get_errno, byref, c_ulong from ctypes.util import find_library from syncdutils import ChangelogException @@ -86,12 +86,14 @@ class Changes(object): @classmethod def cl_history_changelog(cls, changelog_path, start, end, num_parallel): + actual_end = c_ulong() ret = cls._get_api('gf_history_changelog')(changelog_path, start, end, - num_parallel) + num_parallel, + byref(actual_end)) if ret == -1: cls.raise_changelog_err() - return ret + return (ret, actual_end.value) @classmethod def cl_history_startfresh(cls): @@ -101,6 +103,10 @@ class Changes(object): @classmethod def cl_history_getchanges(cls): + """ remove hardcoding for path name length """ + def clsort(f): + return f.split('.')[-1] + changes = [] buf = create_string_buffer('\0', 4096) call = cls._get_api('gf_history_changelog_next_change') @@ -113,7 +119,7 @@ class Changes(object): if ret == -1: cls.raise_changelog_err() - return changes + return sorted(changes, key=clsort) @classmethod def cl_history_done(cls, clfile): |