Merge lp:~jdobrien/ubuntuone-client/bugfix-553547 into lp:ubuntuone-client

Proposed by John O'Brien
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 474
Merged at revision: not available
Proposed branch: lp:~jdobrien/ubuntuone-client/bugfix-553547
Merge into: lp:ubuntuone-client
Diff against target: 145 lines (+33/-28)
5 files modified
tests/syncdaemon/test_dbus.py (+2/-2)
tests/syncdaemon/test_vm.py (+4/-4)
ubuntuone/syncdaemon/action_queue.py (+8/-3)
ubuntuone/syncdaemon/event_queue.py (+2/-1)
ubuntuone/syncdaemon/volume_manager.py (+17/-18)
To merge this branch: bzr merge lp:~jdobrien/ubuntuone-client/bugfix-553547
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
Rick McBride (community) Approve
Review via email: mp+22953@code.launchpad.net

Commit message

Fix a discrepancy between the client and protocol where share_deletion notifications are handled.

Description of the change

This branch makes the adjustments to the client so it is compatible with the storage protocol branch lp:ubuntuone-storage-protocol/split-share-change and must be tested with that revision.

To post a comment you must log in.
Revision history for this message
Rick McBride (rmcbride) :
review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks good, tests pass

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_dbus.py'
2--- tests/syncdaemon/test_dbus.py 2010-03-26 18:29:38 +0000
3+++ tests/syncdaemon/test_dbus.py 2010-04-07 15:42:22 +0000
4@@ -1176,7 +1176,7 @@
5 match = self.bus.add_signal_receiver(share_handler,
6 signal_name='ShareChanged')
7 self.signal_receivers.add(match)
8- self.main.event_q.push('SV_SHARE_CHANGED', 'changed', info=share_holder)
9+ self.main.event_q.push('SV_SHARE_CHANGED', share_holder)
10 return d
11
12 def test_share_deleted(self):
13@@ -1217,7 +1217,7 @@
14 signal_name='ShareDeleted')
15 self.signal_receivers.add(match)
16
17- self.main.event_q.push('SV_SHARE_CHANGED', 'deleted', share_holder)
18+ self.main.event_q.push('SV_SHARE_DELETED', share_holder.share_id)
19 return d
20
21 def test_share_created(self):
22
23=== modified file 'tests/syncdaemon/test_vm.py'
24--- tests/syncdaemon/test_vm.py 2010-03-31 21:48:44 +0000
25+++ tests/syncdaemon/test_vm.py 2010-04-07 15:42:22 +0000
26@@ -223,9 +223,9 @@
27 share = Share(path=share_path, volume_id=str(share_holder.share_id),
28 access_level='View')
29 self.vm.add_share(share)
30- self.vm.handle_SV_SHARE_CHANGED(message='changed', info=share_holder)
31+ self.vm.handle_SV_SHARE_CHANGED(share_holder)
32 self.assertEquals('Modify', self.vm.shares[str(share_id)].access_level)
33- self.vm.handle_SV_SHARE_CHANGED('deleted', share_holder)
34+ self.vm.handle_SV_SHARE_DELETED(share_holder.share_id)
35 self.assertNotIn('share_id', self.vm.shares)
36
37 def test_persistence(self):
38@@ -600,7 +600,7 @@
39 'test_username',
40 'visible', 'Modify')
41 self.vm.handle_SYS_ROOT_RECEIVED('root_uuid')
42- self.vm.handle_SV_SHARE_CHANGED('changed', share_holder)
43+ self.vm.handle_SV_SHARE_CHANGED(share_holder)
44 shouldbe_dir = os.path.join(self.shares_dir,
45 u"año".encode("utf8") + " from visible")
46 self.assertEquals(shouldbe_dir, self.vm.shares['share_id'].path)
47@@ -612,7 +612,7 @@
48 'test_username',
49 u'Ramón', 'Modify')
50 self.vm.handle_SYS_ROOT_RECEIVED('root_uuid')
51- self.vm.handle_SV_SHARE_CHANGED('changed', share_holder)
52+ self.vm.handle_SV_SHARE_CHANGED(share_holder)
53 shouldbe_dir = os.path.join(self.shares_dir,
54 "share from " + u"Ramón".encode("utf8"))
55 self.assertEquals(shouldbe_dir, self.vm.shares['share_id'].path)
56
57=== modified file 'ubuntuone/syncdaemon/action_queue.py'
58--- ubuntuone/syncdaemon/action_queue.py 2010-04-05 14:51:51 +0000
59+++ ubuntuone/syncdaemon/action_queue.py 2010-04-07 15:42:22 +0000
60@@ -715,12 +715,17 @@
61 self.event_queue.push('SV_HASH_NEW',
62 share_id=share_id, node_id=node_id, hash=hash)
63
64- def _share_change_callback(self, message, info):
65+ def _share_change_callback(self, info):
66 """
67 Called by the client when notified that a share changed.
68 """
69- self.event_queue.push('SV_SHARE_CHANGED',
70- message=message, info=info)
71+ self.event_queue.push('SV_SHARE_CHANGED', info=info)
72+
73+ def _share_delete_callback(self, share_id):
74+ """
75+ Called by the client when notified that a share was deleted.
76+ """
77+ self.event_queue.push('SV_SHARE_DELETED', share_id=share_id)
78
79 def _share_answer_callback(self, share_id, answer):
80 """
81
82=== modified file 'ubuntuone/syncdaemon/event_queue.py'
83--- ubuntuone/syncdaemon/event_queue.py 2010-03-26 20:16:23 +0000
84+++ ubuntuone/syncdaemon/event_queue.py 2010-04-07 15:42:22 +0000
85@@ -80,7 +80,8 @@
86 'public_url'),
87 'AQ_CHANGE_PUBLIC_ACCESS_ERROR': ('share_id', 'node_id', 'error'),
88
89- 'SV_SHARE_CHANGED': ('message', 'info'),
90+ 'SV_SHARE_CHANGED': ('info',),
91+ 'SV_SHARE_DELETED': ('share_id',),
92 'SV_SHARE_ANSWERED': ('share_id', 'answer'),
93 'SV_HASH_NEW': ('share_id', 'node_id', 'hash'),
94 'SV_FILE_NEW': ('share_id', 'node_id', 'parent_id', 'name'),
95
96=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
97--- ubuntuone/syncdaemon/volume_manager.py 2010-03-31 21:48:44 +0000
98+++ ubuntuone/syncdaemon/volume_manager.py 2010-04-07 15:42:22 +0000
99@@ -523,23 +523,24 @@
100 # check AQ wait conditions
101 self.m.action_q.check_conditions()
102
103- def handle_SV_SHARE_CHANGED(self, message, info):
104+ def handle_SV_SHARE_CHANGED(self, share_info):
105 """ handle SV_SHARE_CHANGED event """
106- if message == 'changed':
107- if str(info.share_id) not in self.shares:
108- self.log.debug("New share notification, share_id: %s",
109- info.share_id)
110- dir_name = self._build_share_path(info.share_name,
111- info.from_visible_name)
112- path = os.path.join(self.m.shares_dir, dir_name)
113- share = Share.from_notify_holder(info, path)
114- self.add_share(share)
115- else:
116- self.log.debug('share changed! %s', info.share_id)
117- self.share_changed(info)
118- elif message == 'deleted':
119- self.log.debug('share deleted! %s', info.share_id)
120- self.share_deleted(str(info.share_id))
121+ if str(share_info.share_id) not in self.shares:
122+ self.log.debug("New share notification, share_id: %s",
123+ share_info.share_id)
124+ dir_name = self._build_share_path(share_info.share_name,
125+ share_info.from_visible_name)
126+ path = os.path.join(self.m.shares_dir, dir_name)
127+ share = Share.from_notify_holder(share_info, path)
128+ self.add_share(share)
129+ else:
130+ self.log.debug('share changed! %s', share_info.share_id)
131+ self.share_changed(share_info)
132+
133+ def handle_SV_SHARE_DELETED(self, share_id):
134+ """ handle SV_SHARE_DELETED event """
135+ self.log.debug('share deleted! %s', share_id)
136+ self.share_deleted(str(share_id))
137
138 def handle_AQ_CREATE_SHARE_OK(self, share_id, marker):
139 """ handle AQ_CREATE_SHARE_OK event. """
140@@ -1493,5 +1494,3 @@
141 def _pickle(self, value, fd, protocol):
142 """Pickle value in fd using protocol."""
143 cPickle.dump(value, fd, protocol=protocol)
144-
145-

Subscribers

People subscribed via source and target branches