Merge lp:~dobey/ubuntu/lucid/ubuntuone-storage-protocol/trunk into lp:ubuntu/lucid/ubuntuone-storage-protocol
- Lucid (10.04)
- trunk
- Merge into lucid
Proposed by
dobey
on 2010-02-17
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~dobey/ubuntu/lucid/ubuntuone-storage-protocol/trunk |
| Merge into: | lp:ubuntu/lucid/ubuntuone-storage-protocol |
| Diff against target: |
4871 lines (+3459/-357) 16 files modified
PKG-INFO (+1/-1) debian/changelog (+6/-0) setup.py (+1/-1) tests/test_client.py (+467/-0) tests/test_dircontent.py (+13/-9) tests/test_throttling.py (+58/-120) tests/test_volumes.py (+164/-0) ubuntuone/storageprotocol/client.py (+375/-170) ubuntuone/storageprotocol/dircontent.proto (+3/-0) ubuntuone/storageprotocol/dircontent.py (+1/-1) ubuntuone/storageprotocol/dircontent_pb2.py (+105/-0) ubuntuone/storageprotocol/protocol.proto (+79/-19) ubuntuone/storageprotocol/protocol_pb2.py (+2018/-0) ubuntuone/storageprotocol/request.py (+3/-2) ubuntuone/storageprotocol/sharersp.py (+24/-34) ubuntuone/storageprotocol/volumes.py (+141/-0) |
| To merge this branch: | bzr merge lp:~dobey/ubuntu/lucid/ubuntuone-storage-protocol/trunk |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Ubuntu branches | 2010-02-17 | Pending | |
|
Review via email:
|
|||
Commit Message
Description of the Change
To post a comment you must log in.
lp:~dobey/ubuntu/lucid/ubuntuone-storage-protocol/trunk
updated
on 2010-02-17
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'PKG-INFO' |
| 2 | --- PKG-INFO 2009-12-07 17:00:00 +0000 |
| 3 | +++ PKG-INFO 2010-02-17 23:29:10 +0000 |
| 4 | @@ -1,6 +1,6 @@ |
| 5 | Metadata-Version: 1.0 |
| 6 | Name: ubuntuone-storage-protocol |
| 7 | -Version: 1.1.0 |
| 8 | +Version: 1.1.2 |
| 9 | Summary: UNKNOWN |
| 10 | Home-page: UNKNOWN |
| 11 | Author: UNKNOWN |
| 12 | |
| 13 | === modified file 'debian/changelog' |
| 14 | --- debian/changelog 2009-12-07 17:00:00 +0000 |
| 15 | +++ debian/changelog 2010-02-17 23:29:10 +0000 |
| 16 | @@ -1,3 +1,9 @@ |
| 17 | +ubuntuone-storage-protocol (1.1.2-0ubuntu1) UNRELEASED; urgency=low |
| 18 | + |
| 19 | + * New upstream release. |
| 20 | + |
| 21 | + -- Rodney Dawes <rodney.dawes@canonical.com> Wed, 17 Feb 2010 18:23:53 -0500 |
| 22 | + |
| 23 | ubuntuone-storage-protocol (1.1.0-0ubuntu1) lucid; urgency=low |
| 24 | |
| 25 | * New upstream release |
| 26 | |
| 27 | === modified file 'setup.py' |
| 28 | --- setup.py 2009-12-07 17:00:00 +0000 |
| 29 | +++ setup.py 2010-02-17 23:29:10 +0000 |
| 30 | @@ -119,7 +119,7 @@ |
| 31 | |
| 32 | |
| 33 | setup(name='ubuntuone-storage-protocol', |
| 34 | - version='1.1.0', |
| 35 | + version='1.1.2', |
| 36 | packages=['ubuntuone', |
| 37 | 'ubuntuone.storageprotocol'], |
| 38 | data_files=[('/etc/ssl/certs', |
| 39 | |
| 40 | === added file 'tests/test_client.py' |
| 41 | --- tests/test_client.py 1970-01-01 00:00:00 +0000 |
| 42 | +++ tests/test_client.py 2010-02-17 23:29:10 +0000 |
| 43 | @@ -0,0 +1,467 @@ |
| 44 | +# coding=utf-8 |
| 45 | +# |
| 46 | +# Author: Natalia B. Bidart <natalia.bidart@canonical.com> |
| 47 | +# |
| 48 | +# Copyright (C) 2009 Canonical Ltd. |
| 49 | +# |
| 50 | +# This program is free software: you can redistribute it and/or modify it |
| 51 | +# under the terms of the GNU Affero General Public License version 3, |
| 52 | +# as published by the Free Software Foundation. |
| 53 | +# |
| 54 | +# This program is distributed in the hope that it will be useful, but |
| 55 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 56 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 57 | +# PURPOSE. See the GNU Affero General Public License for more details. |
| 58 | +# |
| 59 | +# You should have received a copy of the GNU Affero General Public License |
| 60 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 61 | +"""Tests for the protocol client.""" |
| 62 | + |
| 63 | +import unittest |
| 64 | +import uuid |
| 65 | + |
| 66 | +from twisted.internet.defer import Deferred |
| 67 | + |
| 68 | +from ubuntuone.storageprotocol import protocol_pb2 |
| 69 | +from ubuntuone.storageprotocol.client import ( |
| 70 | + StorageClient, CreateUDF, ListVolumes, DeleteVolume |
| 71 | +) |
| 72 | +from ubuntuone.storageprotocol import volumes |
| 73 | + |
| 74 | +PATH = u'~/Documents/pdfs/moño/' |
| 75 | +NAME = u'UDF-me' |
| 76 | +VOLUME = uuid.UUID('12345678-1234-1234-1234-123456789abc') |
| 77 | +NODE = uuid.UUID('FEDCBA98-7654-3211-2345-6789ABCDEF12') |
| 78 | +USER = u'Dude' |
| 79 | + |
| 80 | +class FakedError(Exception): |
| 81 | + """Stub to replace Request.error.""" |
| 82 | + |
| 83 | + |
| 84 | +def stub_function(*args, **kwargs): |
| 85 | + """Stub to replace non-related functions.""" |
| 86 | + return None |
| 87 | + |
| 88 | +def faked_error(message): |
| 89 | + """Stub to replace Request.error.""" |
| 90 | + raise FakedError |
| 91 | + |
| 92 | +def was_called(self, flag): |
| 93 | + """Helper to assert a function was called.""" |
| 94 | + assert not getattr(self, flag) |
| 95 | + def set_flag(*args, **kwargs): |
| 96 | + """Record the calling was made.""" |
| 97 | + setattr(self, flag, True) |
| 98 | + return set_flag |
| 99 | + |
| 100 | +def build_list_volumes(): |
| 101 | + """Build a LIST_VOLUMES message.""" |
| 102 | + message = protocol_pb2.Message() |
| 103 | + message.type = protocol_pb2.Message.VOLUMES_INFO |
| 104 | + return message |
| 105 | + |
| 106 | +def build_volume_created(): |
| 107 | + """Build VOLUME_CREATED message.""" |
| 108 | + message = protocol_pb2.Message() |
| 109 | + message.type = protocol_pb2.Message.VOLUME_CREATED |
| 110 | + return message |
| 111 | + |
| 112 | +def build_volume_deleted(): |
| 113 | + """Build VOLUME_DELETED message.""" |
| 114 | + message = protocol_pb2.Message() |
| 115 | + message.type = protocol_pb2.Message.VOLUME_DELETED |
| 116 | + return message |
| 117 | + |
| 118 | +def set_root_message(message): |
| 119 | + """Set a simple Root message.""" |
| 120 | + message.type = protocol_pb2.Volumes.ROOT |
| 121 | + message.root.node = str(NODE) |
| 122 | + |
| 123 | +def set_udf_message(message): |
| 124 | + """Set a simple UDFs message.""" |
| 125 | + message.type = protocol_pb2.Volumes.UDF |
| 126 | + message.udf.volume = str(VOLUME) |
| 127 | + message.udf.node = str(NODE) |
| 128 | + message.udf.suggested_path = PATH |
| 129 | + |
| 130 | +def set_share_message(message): |
| 131 | + """Set a simple Share message.""" |
| 132 | + message.type = protocol_pb2.Volumes.SHARE |
| 133 | + message.share.share_id = str(VOLUME) |
| 134 | + message.share.direction = 0 |
| 135 | + message.share.subtree = str(NODE) |
| 136 | + message.share.share_name = u'test' |
| 137 | + message.share.other_username = USER |
| 138 | + message.share.other_visible_name = USER |
| 139 | + message.share.accepted = False |
| 140 | + message.share.access_level = 0 |
| 141 | + |
| 142 | + |
| 143 | +class DummyAttribute(object): |
| 144 | + """Helper class to replace non-related classes.""" |
| 145 | + |
| 146 | + def __getattribute__(self, name): |
| 147 | + """Attributes can be whatever we need.""" |
| 148 | + return stub_function |
| 149 | + |
| 150 | + |
| 151 | +class FakedProtocol(StorageClient): |
| 152 | + """Fake StorageClient to avoid twisted.""" |
| 153 | + |
| 154 | + def __init__(self, *args, **kwargs): |
| 155 | + """Override transports and keep track of messages.""" |
| 156 | + StorageClient.__init__(self, *args, **kwargs) |
| 157 | + self.transport = DummyAttribute() |
| 158 | + self.messages = [] |
| 159 | + |
| 160 | + def sendMessage(self, message): |
| 161 | + """Keep track of messages.""" |
| 162 | + self.messages.append(message) |
| 163 | + |
| 164 | + |
| 165 | +class ClientTestCase(unittest.TestCase): |
| 166 | + """Check that MultiQuery works using an iterator.""" |
| 167 | + |
| 168 | + def setUp(self): |
| 169 | + """Initialize testing client.""" |
| 170 | + self.client = FakedProtocol() |
| 171 | + self.called = False |
| 172 | + self.volume = None |
| 173 | + |
| 174 | + def tearDown(self): |
| 175 | + """Clean up.""" |
| 176 | + self.client = None |
| 177 | + |
| 178 | + # client to server |
| 179 | + def test_create_udf(self): |
| 180 | + """Test create_udf.""" |
| 181 | + original = CreateUDF.start |
| 182 | + CreateUDF.start = was_called(self, 'called') |
| 183 | + |
| 184 | + try: |
| 185 | + result = self.client.create_udf(path=PATH, name=NAME) |
| 186 | + self.assertTrue(self.called, 'CreateUDF.start() was called') |
| 187 | + self.assertTrue(isinstance(result, Deferred)) |
| 188 | + finally: |
| 189 | + CreateUDF.start = original |
| 190 | + |
| 191 | + def test_list_volumes(self): |
| 192 | + """Test list_volumes.""" |
| 193 | + original = ListVolumes.start |
| 194 | + ListVolumes.start = was_called(self, 'called') |
| 195 | + |
| 196 | + try: |
| 197 | + result = self.client.list_volumes() |
| 198 | + self.assertTrue(self.called, 'ListVolumes.start() was called') |
| 199 | + self.assertTrue(isinstance(result, Deferred)) |
| 200 | + finally: |
| 201 | + ListVolumes.start = original |
| 202 | + |
| 203 | + def test_delete_volume(self): |
| 204 | + """Test delete_volume.""" |
| 205 | + original = DeleteVolume.start |
| 206 | + DeleteVolume.start = was_called(self, 'called') |
| 207 | + |
| 208 | + try: |
| 209 | + result = self.client.delete_volume(volume_id=VOLUME) |
| 210 | + self.assertTrue(self.called, 'DeleteVolume.start() was called') |
| 211 | + self.assertTrue(isinstance(result, Deferred)) |
| 212 | + finally: |
| 213 | + DeleteVolume.start = original |
| 214 | + |
| 215 | + def test_set_volume_deleted_callback(self): |
| 216 | + """Test callback setting.""" |
| 217 | + a_callback = lambda x: None |
| 218 | + self.client.set_volume_deleted_callback(a_callback) |
| 219 | + # pylint: disable-msg= W0212 |
| 220 | + self.assertTrue(self.client._volume_deleted_callback is a_callback) |
| 221 | + |
| 222 | + def test_callback_must_be_callable(self): |
| 223 | + """Test set callback parameters.""" |
| 224 | + self.assertRaises(TypeError, self.client.set_volume_created_callback, |
| 225 | + 'hello') |
| 226 | + |
| 227 | + self.assertRaises(TypeError, self.client.set_volume_deleted_callback, |
| 228 | + 'world') |
| 229 | + |
| 230 | + def test_set_volume_created_callback(self): |
| 231 | + """Test callback setting.""" |
| 232 | + a_callback = lambda y, z: None |
| 233 | + self.client.set_volume_created_callback(a_callback) |
| 234 | + # pylint: disable-msg= W0212 |
| 235 | + self.assertTrue(self.client._volume_created_callback is a_callback) |
| 236 | + |
| 237 | + # server to client |
| 238 | + def test_handle_volume_created(self): |
| 239 | + """Test handle_VOLUME_CREATED.""" |
| 240 | + a_callback = was_called(self, 'called') |
| 241 | + self.client.set_volume_created_callback(a_callback) |
| 242 | + |
| 243 | + message = build_volume_created() |
| 244 | + set_root_message(message.volume_created) |
| 245 | + self.client.handle_VOLUME_CREATED(message) |
| 246 | + |
| 247 | + self.assertTrue(self.called) |
| 248 | + |
| 249 | + def test_handle_root_created_passes_a_root(self): |
| 250 | + """Test handle_VOLUME_CREATED parameter passing.""" |
| 251 | + self.volume = None |
| 252 | + a_callback = lambda vol: setattr(self, 'volume', vol) |
| 253 | + self.client.set_volume_created_callback(a_callback) |
| 254 | + |
| 255 | + message = build_volume_created() |
| 256 | + set_root_message(message.volume_created) |
| 257 | + root = volumes.RootVolume.from_msg(message.volume_created.root) |
| 258 | + |
| 259 | + self.client.handle_VOLUME_CREATED(message) |
| 260 | + self.assertEquals(root, self.volume) |
| 261 | + |
| 262 | + def test_handle_udf_created_passes_a_udf(self): |
| 263 | + """Test handle_VOLUME_CREATED parameter passing.""" |
| 264 | + self.volume = None |
| 265 | + a_callback = lambda vol: setattr(self, 'volume', vol) |
| 266 | + self.client.set_volume_created_callback(a_callback) |
| 267 | + |
| 268 | + message = build_volume_created() |
| 269 | + set_udf_message(message.volume_created) |
| 270 | + udf = volumes.UDFVolume.from_msg(message.volume_created.udf) |
| 271 | + |
| 272 | + self.client.handle_VOLUME_CREATED(message) |
| 273 | + self.assertEquals(udf, self.volume) |
| 274 | + |
| 275 | + def test_handle_share_created_passes_a_share(self): |
| 276 | + """Test handle_VOLUME_CREATED parameter passing.""" |
| 277 | + self.volume = None |
| 278 | + a_callback = lambda vol: setattr(self, 'volume', vol) |
| 279 | + self.client.set_volume_created_callback(a_callback) |
| 280 | + |
| 281 | + message = build_volume_created() |
| 282 | + set_share_message(message.volume_created) |
| 283 | + share = volumes.ShareVolume.from_msg(message.volume_created.share) |
| 284 | + |
| 285 | + self.client.handle_VOLUME_CREATED(message) |
| 286 | + self.assertEquals(share, self.volume) |
| 287 | + |
| 288 | + def test_handle_volume_created_if_volume_is_buggy(self): |
| 289 | + """Test handle_VOLUME_CREATED if the volume is buggy.""" |
| 290 | + message = build_volume_created() |
| 291 | + message.volume_created.type = -1 # invalid type! |
| 292 | + self.client.set_volume_created_callback(lambda vol: None) |
| 293 | + self.assertRaises(TypeError, self.client.handle_VOLUME_CREATED, |
| 294 | + message) |
| 295 | + |
| 296 | + def test_handle_volume_created_if_callback_is_none(self): |
| 297 | + """Test handle_VOLUME_CREATED if callback is none.""" |
| 298 | + message = build_volume_created() |
| 299 | + self.client.handle_VOLUME_CREATED(message) |
| 300 | + |
| 301 | + def test_handle_volume_deleted(self): |
| 302 | + """Test handle_VOLUME_DELETED.""" |
| 303 | + a_callback = was_called(self, 'called') |
| 304 | + self.client.set_volume_deleted_callback(a_callback) |
| 305 | + |
| 306 | + message = build_volume_deleted() |
| 307 | + message.volume_deleted.volume = str(VOLUME) |
| 308 | + self.client.handle_VOLUME_DELETED(message) |
| 309 | + |
| 310 | + self.assertTrue(self.called) |
| 311 | + |
| 312 | + def test_handle_volume_deleted_passes_the_id(self): |
| 313 | + """Test handle_VOLUME_DELETED.""" |
| 314 | + self.volume = None |
| 315 | + a_callback = lambda vol_id: setattr(self, 'volume', vol_id) |
| 316 | + self.client.set_volume_deleted_callback(a_callback) |
| 317 | + |
| 318 | + message = build_volume_deleted() |
| 319 | + message.volume_deleted.volume = str(VOLUME) |
| 320 | + self.client.handle_VOLUME_DELETED(message) |
| 321 | + |
| 322 | + self.assertEquals(VOLUME, self.volume) |
| 323 | + |
| 324 | + def test_handle_volume_deleted_if_none(self): |
| 325 | + """Test handle_VOLUME_DELETED if callback is none.""" |
| 326 | + message = build_volume_deleted() |
| 327 | + self.client.handle_VOLUME_DELETED(message) |
| 328 | + |
| 329 | + |
| 330 | +class CreateUDFTestCase(unittest.TestCase): |
| 331 | + """Test cases for CreateUDF op.""" |
| 332 | + |
| 333 | + def setUp(self): |
| 334 | + """Initialize testing protocol.""" |
| 335 | + self.protocol = FakedProtocol() |
| 336 | + self.request = CreateUDF(self.protocol, path=PATH, name=NAME) |
| 337 | + self.request.error = faked_error |
| 338 | + self.done_called = False |
| 339 | + self.request.done = was_called(self, 'done_called') |
| 340 | + |
| 341 | + def tearDown(self): |
| 342 | + """Clean up.""" |
| 343 | + self.protocol = None |
| 344 | + self.request = None |
| 345 | + |
| 346 | + def test_init(self): |
| 347 | + """Test request creation.""" |
| 348 | + self.assertEquals(PATH, self.request.path) |
| 349 | + self.assertEquals(NAME, self.request.name) |
| 350 | + self.assertTrue(self.request.volume_id is None) |
| 351 | + self.assertTrue(self.request.node_id is None) |
| 352 | + |
| 353 | + def test_start(self): |
| 354 | + """Test request start.""" |
| 355 | + self.request.start() |
| 356 | + |
| 357 | + self.assertEquals(1, len(self.request.protocol.messages)) |
| 358 | + actual_msg, = self.request.protocol.messages |
| 359 | + self.assertEquals(protocol_pb2.Message.CREATE_UDF, actual_msg.type) |
| 360 | + self.assertEquals(self.request.path, actual_msg.create_udf.path) |
| 361 | + self.assertEquals(self.request.name, actual_msg.create_udf.name) |
| 362 | + |
| 363 | + def test_process_message_error(self): |
| 364 | + """Test request processMessage on error.""" |
| 365 | + message = protocol_pb2.Message() |
| 366 | + self.assertRaises(FakedError, self.request.processMessage, message) |
| 367 | + |
| 368 | + def test_process_message_volume_created(self): |
| 369 | + """Test request processMessage on sucess.""" |
| 370 | + message = protocol_pb2.Message() |
| 371 | + message.type = protocol_pb2.Message.VOLUME_CREATED |
| 372 | + message.volume_created.type = protocol_pb2.Volumes.UDF |
| 373 | + message.volume_created.udf.volume = str(VOLUME) |
| 374 | + message.volume_created.udf.node = str(NODE) |
| 375 | + self.request.processMessage(message) |
| 376 | + |
| 377 | + self.assertEquals(str(VOLUME), self.request.volume_id, 'volume set') |
| 378 | + self.assertEquals(str(NODE), self.request.node_id, 'node set') |
| 379 | + self.assertTrue(self.done_called, 'done() was called') |
| 380 | + |
| 381 | + |
| 382 | +class ListVolumesTestCase(unittest.TestCase): |
| 383 | + """Test cases for ListVolumes op.""" |
| 384 | + |
| 385 | + def setUp(self): |
| 386 | + """Initialize testing protocol.""" |
| 387 | + self.protocol = FakedProtocol() |
| 388 | + self.request = ListVolumes(self.protocol) |
| 389 | + self.request.error = faked_error |
| 390 | + self.done_called = False |
| 391 | + self.request.done = was_called(self, 'done_called') |
| 392 | + |
| 393 | + def tearDown(self): |
| 394 | + """Clean up.""" |
| 395 | + self.protocol = None |
| 396 | + self.request = None |
| 397 | + |
| 398 | + def test_init(self): |
| 399 | + """Test request creation.""" |
| 400 | + self.assertEquals([], self.request.volumes) |
| 401 | + |
| 402 | + def test_start(self): |
| 403 | + """Test request start.""" |
| 404 | + self.request.start() |
| 405 | + |
| 406 | + self.assertEquals(1, len(self.request.protocol.messages)) |
| 407 | + actual_msg, = self.request.protocol.messages |
| 408 | + self.assertEquals(protocol_pb2.Message.LIST_VOLUMES, actual_msg.type) |
| 409 | + |
| 410 | + def test_process_message_error(self): |
| 411 | + """Test request processMessage on error.""" |
| 412 | + message = protocol_pb2.Message() |
| 413 | + self.assertRaises(FakedError, self.request.processMessage, message) |
| 414 | + |
| 415 | + def test_process_message_error_when_incorrect_volume(self): |
| 416 | + """Test error condition when incorrect volume type.""" |
| 417 | + message = build_list_volumes() |
| 418 | + message.list_volumes.type = -1 |
| 419 | + self.assertRaises(FakedError, self.request.processMessage, message) |
| 420 | + |
| 421 | + def test_process_message_volume_created(self): |
| 422 | + """Test request processMessage on sucess.""" |
| 423 | + message = build_list_volumes() |
| 424 | + set_udf_message(message.list_volumes) |
| 425 | + udf = volumes.UDFVolume.from_msg(message.list_volumes.udf) |
| 426 | + self.request.processMessage(message) |
| 427 | + |
| 428 | + message = build_list_volumes() |
| 429 | + set_share_message(message.list_volumes) |
| 430 | + share = volumes.ShareVolume.from_msg(message.list_volumes.share) |
| 431 | + self.request.processMessage(message) |
| 432 | + |
| 433 | + message = build_list_volumes() |
| 434 | + set_root_message(message.list_volumes) |
| 435 | + root = volumes.RootVolume.from_msg(message.list_volumes.root) |
| 436 | + self.request.processMessage(message) |
| 437 | + |
| 438 | + self.assertEquals(3, len(self.request.volumes), |
| 439 | + '3 volumes stored') |
| 440 | + self.assertEquals([udf, share, root], self.request.volumes, |
| 441 | + 'volumes stored') |
| 442 | + |
| 443 | + message = protocol_pb2.Message() |
| 444 | + message.type = protocol_pb2.Message.VOLUMES_END |
| 445 | + self.request.processMessage(message) |
| 446 | + |
| 447 | + self.assertTrue(self.done_called, 'done() was called') |
| 448 | + |
| 449 | + def test_start_cleanups_volumes(self): |
| 450 | + """Test start() is idempotent.""" |
| 451 | + self.request.start() |
| 452 | + |
| 453 | + message = build_list_volumes() |
| 454 | + set_udf_message(message.list_volumes) |
| 455 | + self.request.processMessage(message) |
| 456 | + |
| 457 | + message = protocol_pb2.Message() |
| 458 | + message.type = protocol_pb2.Message.VOLUMES_END |
| 459 | + self.request.processMessage(message) |
| 460 | + |
| 461 | + self.request.start() |
| 462 | + self.assertEquals([], self.request.volumes) |
| 463 | + |
| 464 | + |
| 465 | +class DeleteVolumeTestCase(unittest.TestCase): |
| 466 | + """Test cases for DeleteVolume op.""" |
| 467 | + |
| 468 | + def setUp(self): |
| 469 | + """Initialize testing protocol.""" |
| 470 | + self.protocol = FakedProtocol() |
| 471 | + self.request = DeleteVolume(self.protocol, volume_id=VOLUME) |
| 472 | + self.request.error = faked_error |
| 473 | + self.done_called = False |
| 474 | + self.request.done = was_called(self, 'done_called') |
| 475 | + |
| 476 | + def tearDown(self): |
| 477 | + """Clean up.""" |
| 478 | + self.protocol = None |
| 479 | + self.request = None |
| 480 | + |
| 481 | + def test_init(self): |
| 482 | + """Test request creation.""" |
| 483 | + self.assertEquals(str(VOLUME), self.request.volume_id) |
| 484 | + |
| 485 | + def test_start(self): |
| 486 | + """Test request start.""" |
| 487 | + self.request.start() |
| 488 | + |
| 489 | + self.assertEquals(1, len(self.request.protocol.messages)) |
| 490 | + actual_msg, = self.request.protocol.messages |
| 491 | + self.assertEquals(protocol_pb2.Message.DELETE_VOLUME, actual_msg.type) |
| 492 | + self.assertEquals(self.request.volume_id, |
| 493 | + actual_msg.delete_volume.volume) |
| 494 | + |
| 495 | + def test_process_message_error(self): |
| 496 | + """Test request processMessage on error.""" |
| 497 | + message = protocol_pb2.Message() |
| 498 | + self.assertRaises(FakedError, self.request.processMessage, message) |
| 499 | + |
| 500 | + def test_process_message_ok(self): |
| 501 | + """Test request processMessage on sucess.""" |
| 502 | + message = protocol_pb2.Message() |
| 503 | + message.type = protocol_pb2.Message.OK |
| 504 | + self.request.processMessage(message) |
| 505 | + |
| 506 | + self.assertTrue(self.done_called, 'done() was called') |
| 507 | + |
| 508 | + |
| 509 | +if __name__ == '__main__': |
| 510 | + unittest.main() |
| 511 | |
| 512 | === modified file 'tests/test_dircontent.py' |
| 513 | --- tests/test_dircontent.py 2009-08-11 16:00:00 +0000 |
| 514 | +++ tests/test_dircontent.py 2010-02-17 23:29:10 +0000 |
| 515 | @@ -41,17 +41,21 @@ |
| 516 | self.assertRaises(InvalidFilename, normalize_filename, "..") |
| 517 | self.assertRaises(InvalidFilename, validate_filename, "..") |
| 518 | |
| 519 | + def test_valid_characters(self): |
| 520 | + """Tests that all weird but valid characters are accepted.""" |
| 521 | + for n in range(1, 32): |
| 522 | + filename = u"xy" + unichr(n) + u"zzy" |
| 523 | + normalize_filename(filename) |
| 524 | + validate_filename(filename) |
| 525 | + for c in [u':', u';', u'*', u'?', u'\\', u'\x7f']: |
| 526 | + filename = u"xy" + c + u"zzy" |
| 527 | + normalize_filename(filename) |
| 528 | + validate_filename(filename) |
| 529 | + |
| 530 | def test_excluded_character(self): |
| 531 | """Tests that all excluded characters are banned.""" |
| 532 | - for n in range(0, 32): |
| 533 | - name = u"xyz" + unicode(chr(n)) |
| 534 | - try: |
| 535 | - self.assertRaises(InvalidFilename, normalize_filename, name) |
| 536 | - self.assertRaises(InvalidFilename, validate_filename, name) |
| 537 | - except AssertionError, e: |
| 538 | - raise AssertionError(u"%s for %s" % (unicode(e), name)) |
| 539 | - for c in [u':', u';', u'*', u'?', u'\\', u'/', u'\x7f']: |
| 540 | - name = u"xyz" + c |
| 541 | + for c in [u'/', unichr(0)]: |
| 542 | + name = u"xy" + c + u"zzy" |
| 543 | try: |
| 544 | self.assertRaises(InvalidFilename, normalize_filename, name) |
| 545 | self.assertRaises(InvalidFilename, validate_filename, name) |
| 546 | |
| 547 | === modified file 'tests/test_throttling.py' |
| 548 | --- tests/test_throttling.py 2009-12-07 17:00:00 +0000 |
| 549 | +++ tests/test_throttling.py 2010-02-17 23:29:10 +0000 |
| 550 | @@ -20,7 +20,7 @@ |
| 551 | |
| 552 | from __future__ import with_statement |
| 553 | |
| 554 | -from twisted.internet import defer, reactor |
| 555 | +from twisted.internet import task |
| 556 | from twisted.trial.unittest import TestCase as TwistedTestCase |
| 557 | |
| 558 | from ubuntuone.storageprotocol import client |
| 559 | @@ -48,168 +48,106 @@ |
| 560 | self.events.append("unthW") |
| 561 | |
| 562 | |
| 563 | -class TestProducingState(TwistedTestCase): |
| 564 | +class BaseThrottlingTestCase(TwistedTestCase): |
| 565 | + """Base test case for ThrottlingStorageClientFactory.""" |
| 566 | + |
| 567 | + def setUp(self): |
| 568 | + self.client = FakeClient() |
| 569 | + self.factories = [] |
| 570 | + self.clock = task.Clock() |
| 571 | + # use task.Clock instead of the reactor for the callLater |
| 572 | + self.old_callLater = client.ThrottlingStorageClientFactory.callLater |
| 573 | + client.ThrottlingStorageClientFactory.callLater = self.clock.callLater |
| 574 | + |
| 575 | + def tearDown(self): |
| 576 | + for f in self.factories: |
| 577 | + f.unregisterProtocol(None) |
| 578 | + client.ThrottlingStorageClientFactory.callLater = self.old_callLater |
| 579 | + |
| 580 | + def create_factory(self, read_limit, write_limit): |
| 581 | + """Create a ThrottlingStorageClientFactory with the specified args.""" |
| 582 | + tscf = client.ThrottlingStorageClientFactory(read_limit, write_limit) |
| 583 | + tscf.client = self.client |
| 584 | + self.factories.append(tscf) |
| 585 | + return tscf |
| 586 | + |
| 587 | + |
| 588 | +class TestProducingState(BaseThrottlingTestCase): |
| 589 | """Test for filename validation and normalization.""" |
| 590 | |
| 591 | timeout = 5 |
| 592 | |
| 593 | def setUp(self): |
| 594 | - self.client = FakeClient() |
| 595 | - self.tscf = client.ThrottlingStorageClientFactory(3, 3) |
| 596 | - self.tscf.client = self.client |
| 597 | - |
| 598 | - def tearDown(self): |
| 599 | - self.tscf.unregisterProtocol(None) |
| 600 | + BaseThrottlingTestCase.setUp(self) |
| 601 | + self.tscf = self.create_factory(3, 3) |
| 602 | |
| 603 | def test_under_write_limit(self): |
| 604 | """Don't pas the write limit, no event.""" |
| 605 | - d = defer.Deferred() |
| 606 | self.tscf.registerWritten(2) |
| 607 | - |
| 608 | - def check(): |
| 609 | - """Check for the correct events.""" |
| 610 | - self.assertEqual(self.client.events, []) |
| 611 | - d.callback(True) |
| 612 | - |
| 613 | - reactor.callLater(.1, check) |
| 614 | - return d |
| 615 | + self.clock.advance(.1) |
| 616 | + self.assertEqual(self.client.events, []) |
| 617 | |
| 618 | def test_under_read_limit(self): |
| 619 | """Don't pas the read limit, no event.""" |
| 620 | - d = defer.Deferred() |
| 621 | self.tscf.registerRead(2) |
| 622 | - |
| 623 | - def check(): |
| 624 | - """Check for the correct events.""" |
| 625 | - self.assertEqual(self.client.events, []) |
| 626 | - d.callback(True) |
| 627 | - |
| 628 | - reactor.callLater(.1, check) |
| 629 | - return d |
| 630 | + self.clock.advance(.1) |
| 631 | + self.assertEqual(self.client.events, []) |
| 632 | |
| 633 | def test_above_write_throttles(self): |
| 634 | """Above the write limit, throttles.""" |
| 635 | - d = defer.Deferred() |
| 636 | self.tscf.registerWritten(4) |
| 637 | - |
| 638 | - def check(): |
| 639 | - """Check for the correct events.""" |
| 640 | - self.assertEqual(self.client.events, ["thW"]) |
| 641 | - d.callback(True) |
| 642 | - |
| 643 | - reactor.callLater(.1, check) |
| 644 | - return d |
| 645 | + self.clock.advance(.1) |
| 646 | + self.assertEqual(self.client.events, ["thW"]) |
| 647 | |
| 648 | def test_above_read_throttles(self): |
| 649 | """Above the read limit, throttles.""" |
| 650 | - d = defer.Deferred() |
| 651 | self.tscf.registerRead(4) |
| 652 | - |
| 653 | - def check(): |
| 654 | - """Check for the correct events.""" |
| 655 | - self.assertEqual(self.client.events, ["thR"]) |
| 656 | - d.callback(True) |
| 657 | - |
| 658 | - reactor.callLater(.1, check) |
| 659 | - return d |
| 660 | + self.clock.advance(.1) |
| 661 | + self.assertEqual(self.client.events, ["thR"]) |
| 662 | |
| 663 | def test_above_write_throttles_unthrottles(self): |
| 664 | """Above the write limit, throttles and unthrottles after 1s.""" |
| 665 | - d = defer.Deferred() |
| 666 | self.tscf.registerWritten(4) |
| 667 | - |
| 668 | - def check(): |
| 669 | - """Check for the correct events.""" |
| 670 | - self.assertEqual(self.client.events, ["thW", "unthW"]) |
| 671 | - d.callback(True) |
| 672 | - |
| 673 | - reactor.callLater(1.1, check) |
| 674 | - return d |
| 675 | + self.clock.advance(1.1) |
| 676 | + self.assertEqual(self.client.events, ["thW", "unthW"]) |
| 677 | |
| 678 | def test_above_read_throttles_unthrottles(self): |
| 679 | """Above the read limit, throttles and unthrottles after 1s.""" |
| 680 | - d = defer.Deferred() |
| 681 | self.tscf.registerRead(4) |
| 682 | - |
| 683 | - def check(): |
| 684 | - """Check for the correct events.""" |
| 685 | - self.assertEqual(self.client.events, ["thR", "unthR"]) |
| 686 | - d.callback(True) |
| 687 | - |
| 688 | - reactor.callLater(1.1, check) |
| 689 | - return d |
| 690 | + self.clock.advance(1.1) |
| 691 | + self.assertEqual(self.client.events, ["thR", "unthR"]) |
| 692 | |
| 693 | def test_very_above_write_throttles_unthrottles(self): |
| 694 | """A lot above the write limit, throttles and unthrottles.""" |
| 695 | - d = defer.Deferred() |
| 696 | self.tscf.registerWritten(8) |
| 697 | - |
| 698 | - def check1(): |
| 699 | - """Check for the correct events.""" |
| 700 | - self.assertEqual(self.client.events, ["thW"]) |
| 701 | - reactor.callLater(1, check2) |
| 702 | - |
| 703 | - def check2(): |
| 704 | - """Check for the correct events.""" |
| 705 | - self.assertEqual(self.client.events, ["thW", "unthW"]) |
| 706 | - d.callback(True) |
| 707 | - |
| 708 | - reactor.callLater(1.1, check1) |
| 709 | - return d |
| 710 | + self.clock.advance(1.1) |
| 711 | + self.assertEqual(self.client.events, ["thW"]) |
| 712 | + self.clock.advance(1) |
| 713 | + self.assertEqual(self.client.events, ["thW", "unthW"]) |
| 714 | |
| 715 | def test_very_above_read_throttles_unthrottles(self): |
| 716 | """A lot above the read limit, throttles and unthrottles.""" |
| 717 | - d = defer.Deferred() |
| 718 | self.tscf.registerRead(8) |
| 719 | - |
| 720 | - def check1(): |
| 721 | - """Check for the correct events.""" |
| 722 | - self.assertEqual(self.client.events, ["thR"]) |
| 723 | - reactor.callLater(1, check2) |
| 724 | - |
| 725 | - def check2(): |
| 726 | - """Check for the correct events.""" |
| 727 | - self.assertEqual(self.client.events, ["thR", "unthR"]) |
| 728 | - d.callback(True) |
| 729 | - |
| 730 | - reactor.callLater(1.1, check1) |
| 731 | - return d |
| 732 | + self.clock.advance(1.1) |
| 733 | + self.assertEqual(self.client.events, ["thR"]) |
| 734 | + self.clock.advance(1) |
| 735 | + self.assertEqual(self.client.events, ["thR", "unthR"]) |
| 736 | |
| 737 | def test_double_write(self): |
| 738 | """Two writes on a row while throttling.""" |
| 739 | - d = defer.Deferred() |
| 740 | self.tscf.registerWritten(4) |
| 741 | - |
| 742 | - def check1(): |
| 743 | - """Check for the correct events.""" |
| 744 | - self.assertEqual(self.client.events, ["thW"]) |
| 745 | - self.tscf.registerWritten(1) |
| 746 | - reactor.callLater(2, check2) |
| 747 | - |
| 748 | - def check2(): |
| 749 | - """Check for the correct events.""" |
| 750 | - self.assertEqual(self.client.events, ["thW", "unthW"]) |
| 751 | - d.callback(True) |
| 752 | - |
| 753 | - reactor.callLater(.1, check1) |
| 754 | - return d |
| 755 | + self.clock.advance(.1) |
| 756 | + self.assertEqual(self.client.events, ["thW"]) |
| 757 | + self.tscf.registerWritten(1) |
| 758 | + self.clock.advance(2) |
| 759 | + self.assertEqual(self.client.events, ["thW", "unthW"]) |
| 760 | |
| 761 | def test_double_read(self): |
| 762 | """Two read on a row while throttling.""" |
| 763 | - d = defer.Deferred() |
| 764 | self.tscf.registerRead(4) |
| 765 | - |
| 766 | - def check1(): |
| 767 | - """Check for the correct events.""" |
| 768 | - self.assertEqual(self.client.events, ["thR"]) |
| 769 | - self.tscf.registerWritten(1) |
| 770 | - reactor.callLater(2, check2) |
| 771 | - |
| 772 | - def check2(): |
| 773 | - """Check for the correct events.""" |
| 774 | - self.assertEqual(self.client.events, ["thR", "unthR"]) |
| 775 | - d.callback(True) |
| 776 | - |
| 777 | - reactor.callLater(.1, check1) |
| 778 | - return d |
| 779 | + self.clock.advance(.1) |
| 780 | + self.assertEqual(self.client.events, ["thR"]) |
| 781 | + self.tscf.registerWritten(1) |
| 782 | + self.clock.advance(2) |
| 783 | + self.assertEqual(self.client.events, ["thR", "unthR"]) |
| 784 | |
| 785 | |
| 786 | === added file 'tests/test_volumes.py' |
| 787 | --- tests/test_volumes.py 1970-01-01 00:00:00 +0000 |
| 788 | +++ tests/test_volumes.py 2010-02-17 23:29:10 +0000 |
| 789 | @@ -0,0 +1,164 @@ |
| 790 | +# coding=utf-8 |
| 791 | +# |
| 792 | +# Author: Natalia B. Bidart <natalia.bidart@canonical.com> |
| 793 | +# |
| 794 | +# Copyright (C) 2009 Canonical Ltd. |
| 795 | +# |
| 796 | +# This program is free software: you can redistribute it and/or modify it |
| 797 | +# under the terms of the GNU Affero General Public License version 3, |
| 798 | +# as published by the Free Software Foundation. |
| 799 | +# |
| 800 | +# This program is distributed in the hope that it will be useful, but |
| 801 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 802 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 803 | +# PURPOSE. See the GNU Affero General Public License for more details. |
| 804 | +# |
| 805 | +# You should have received a copy of the GNU Affero General Public License |
| 806 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 807 | +"""Tests for volume data type.""" |
| 808 | + |
| 809 | +import unittest |
| 810 | +import uuid |
| 811 | + |
| 812 | +from copy import copy |
| 813 | + |
| 814 | +from ubuntuone.storageprotocol import protocol_pb2, volumes |
| 815 | + |
| 816 | +PATH = u'~/Documents/pdfs/moño/' |
| 817 | +NAME = u'What a beatiful volume' |
| 818 | +VOLUME = uuid.UUID('12345678-1234-1234-1234-123456789abc') |
| 819 | +NODE = uuid.UUID('FEDCBA98-7654-3211-2345-6789ABCDEF12') |
| 820 | +USER = u'dude' |
| 821 | + |
| 822 | +class VolumeTestCase(unittest.TestCase): |
| 823 | + """Check Volume data type.""" |
| 824 | + |
| 825 | + volume_class = volumes.Volume |
| 826 | + kwargs = dict(volume_id=VOLUME, node_id=NODE) |
| 827 | + |
| 828 | + def setUp(self): |
| 829 | + """Initialize testing volume.""" |
| 830 | + self.volume = self.volume_class(**self.kwargs) |
| 831 | + |
| 832 | + def tearDown(self): |
| 833 | + """Clean up.""" |
| 834 | + self.volume = None |
| 835 | + |
| 836 | + def assert_correct_attributes(self): |
| 837 | + """Assert over attribute correctness.""" |
| 838 | + self.assertEquals(VOLUME, self.volume.volume_id) |
| 839 | + self.assertEquals(NODE, self.volume.node_id) |
| 840 | + |
| 841 | + def test_creation(self): |
| 842 | + """Test creation.""" |
| 843 | + self.assert_correct_attributes() |
| 844 | + |
| 845 | + def test_is_a_volume(self): |
| 846 | + """Test class inheritance.""" |
| 847 | + self.assertTrue(isinstance(self.volume, volumes.Volume)) |
| 848 | + |
| 849 | + |
| 850 | + def test_from_params(self): |
| 851 | + """Test creation using from_params.""" |
| 852 | + self.volume = self.volume_class.from_params(**self.kwargs) |
| 853 | + self.assert_correct_attributes() |
| 854 | + |
| 855 | + def test_from_msg(self): |
| 856 | + """Test creation using from_msg.""" |
| 857 | + self.assertRaises(NotImplementedError, self.volume_class.from_msg, None) |
| 858 | + |
| 859 | + def test_is_equal(self): |
| 860 | + """Test object equality.""" |
| 861 | + other = copy(self.volume) |
| 862 | + self.assertEquals(other, self.volume) |
| 863 | + |
| 864 | + for attr, value in self.kwargs.iteritems(): |
| 865 | + setattr(other, attr, None) |
| 866 | + self.assertNotEquals(other, self.volume, |
| 867 | + 'not equal when %s differ' % attr) |
| 868 | + setattr(other, attr, value) |
| 869 | + |
| 870 | + self.assertEquals(other, self.volume) |
| 871 | + |
| 872 | + |
| 873 | +class ShareTestCase(VolumeTestCase): |
| 874 | + """Check Share data type.""" |
| 875 | + |
| 876 | + # pylint: disable-msg=W0212 |
| 877 | + to_me = volumes._direction_prot2nice[protocol_pb2.Shares.TO_ME] |
| 878 | + only_view = volumes._access_prot2nice[protocol_pb2.Shares.VIEW] |
| 879 | + |
| 880 | + volume_class = volumes.ShareVolume |
| 881 | + kwargs = dict(volume_id=VOLUME, node_id=NODE, |
| 882 | + direction=to_me, |
| 883 | + share_name=NAME, other_username=USER, |
| 884 | + other_visible_name=USER, accepted=False, |
| 885 | + access_level=only_view) |
| 886 | + |
| 887 | + def assert_correct_attributes(self): |
| 888 | + """Assert over attribute correctness.""" |
| 889 | + super(ShareTestCase, self).assert_correct_attributes() |
| 890 | + self.assertEquals(self.to_me, self.volume.direction) |
| 891 | + self.assertEquals(NAME, self.volume.share_name) |
| 892 | + self.assertEquals(USER, self.volume.other_username) |
| 893 | + self.assertEquals(USER, self.volume.other_visible_name) |
| 894 | + self.assertEquals(False, self.volume.accepted) |
| 895 | + self.assertEquals(self.only_view, self.volume.access_level) |
| 896 | + |
| 897 | + def test_from_msg(self): |
| 898 | + """Test creation using from_msg.""" |
| 899 | + message = protocol_pb2.Shares() |
| 900 | + # pylint: disable-msg=W0201 |
| 901 | + message.share_id = str(VOLUME) |
| 902 | + message.subtree = str(NODE) |
| 903 | + message.share_name = NAME |
| 904 | + message.other_username = USER |
| 905 | + message.other_visible_name = USER |
| 906 | + self.volume = self.volume_class.from_msg(message) |
| 907 | + self.assert_correct_attributes() |
| 908 | + |
| 909 | + |
| 910 | +class UDFTestCase(VolumeTestCase): |
| 911 | + """Check UDF data type.""" |
| 912 | + |
| 913 | + volume_class = volumes.UDFVolume |
| 914 | + kwargs = dict(volume_id=VOLUME, node_id=NODE, suggested_path=PATH) |
| 915 | + |
| 916 | + def assert_correct_attributes(self): |
| 917 | + """Assert over attribute correctness.""" |
| 918 | + super(UDFTestCase, self).assert_correct_attributes() |
| 919 | + self.assertEquals(PATH, self.volume.suggested_path) |
| 920 | + |
| 921 | + def test_from_msg(self): |
| 922 | + """Test creation using from_msg.""" |
| 923 | + message = protocol_pb2.UDFs() |
| 924 | + # pylint: disable-msg=W0201 |
| 925 | + message.volume = str(VOLUME) |
| 926 | + message.node = str(NODE) |
| 927 | + message.suggested_path = PATH |
| 928 | + self.volume = self.volume_class.from_msg(message) |
| 929 | + self.assert_correct_attributes() |
| 930 | + |
| 931 | + |
| 932 | +class RootTestCase(VolumeTestCase): |
| 933 | + """Check Root data type.""" |
| 934 | + |
| 935 | + volume_class = volumes.RootVolume |
| 936 | + kwargs = dict(node_id=NODE) |
| 937 | + |
| 938 | + def assert_correct_attributes(self): |
| 939 | + """Assert over attribute correctness.""" |
| 940 | + self.assertEquals(None, self.volume.volume_id) |
| 941 | + self.assertEquals(NODE, self.volume.node_id) |
| 942 | + |
| 943 | + def test_from_msg(self): |
| 944 | + """Test creation using from_msg.""" |
| 945 | + message = protocol_pb2.Root() |
| 946 | + # pylint: disable-msg=W0201 |
| 947 | + message.node = str(NODE) |
| 948 | + self.volume = self.volume_class.from_msg(message) |
| 949 | + self.assert_correct_attributes() |
| 950 | + |
| 951 | + |
| 952 | +if __name__ == '__main__': |
| 953 | + unittest.main() |
| 954 | |
| 955 | === modified file 'ubuntuone/storageprotocol/client.py' |
| 956 | --- ubuntuone/storageprotocol/client.py 2009-12-07 17:00:00 +0000 |
| 957 | +++ ubuntuone/storageprotocol/client.py 2010-02-17 23:29:10 +0000 |
| 958 | @@ -1,6 +1,7 @@ |
| 959 | # ubuntuone.storageprotocol.client - the storage protocol client |
| 960 | # |
| 961 | # Author: Lucio Torre <lucio.torre@canonical.com> |
| 962 | +# Author: Natalia B. Bidart <natalia.bidart@canonical.com> |
| 963 | # |
| 964 | # Copyright 2009 Canonical Ltd. |
| 965 | # |
| 966 | @@ -15,28 +16,27 @@ |
| 967 | # |
| 968 | # You should have received a copy of the GNU Affero General Public License |
| 969 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 970 | -""" |
| 971 | -The storage protocol client. |
| 972 | - |
| 973 | -""" |
| 974 | -from twisted.internet.protocol import ClientFactory |
| 975 | -from twisted.internet import reactor, defer |
| 976 | -from twisted.python import log |
| 977 | - |
| 978 | +"""The storage protocol client.""" |
| 979 | + |
| 980 | +import logging |
| 981 | import uuid |
| 982 | + |
| 983 | from functools import partial |
| 984 | from itertools import chain |
| 985 | -import logging |
| 986 | from oauth import oauth |
| 987 | -from ubuntuone.storageprotocol import protocol_pb2 |
| 988 | -from ubuntuone.storageprotocol import request |
| 989 | -from ubuntuone.storageprotocol import sharersp |
| 990 | - |
| 991 | + |
| 992 | +from twisted.internet.protocol import ClientFactory |
| 993 | +from twisted.internet import reactor, defer |
| 994 | +from twisted.python import log |
| 995 | + |
| 996 | +from ubuntuone.storageprotocol import ( |
| 997 | + protocol_pb2, request, sharersp, volumes |
| 998 | +) |
| 999 | |
| 1000 | log_debug = partial(log.msg, loglevel=logging.DEBUG) |
| 1001 | |
| 1002 | class StorageClient(request.RequestHandler): |
| 1003 | - """ A Basic Storage Protocol client.""" |
| 1004 | + """A Basic Storage Protocol client.""" |
| 1005 | |
| 1006 | # we are a client, we do odd requests |
| 1007 | REQUEST_ID_START = 1 |
| 1008 | @@ -46,28 +46,34 @@ |
| 1009 | request.RequestHandler.__init__(self) |
| 1010 | self.root_id = None |
| 1011 | self.root_id_defers = [] |
| 1012 | + |
| 1013 | self._node_state_callback = None |
| 1014 | self._share_change_callback = None |
| 1015 | self._share_answer_callback = None |
| 1016 | self._free_space_callback = None |
| 1017 | self._account_info_callback = None |
| 1018 | + self._volume_created_callback = None |
| 1019 | + self._volume_deleted_callback = None |
| 1020 | + |
| 1021 | self.line_mode = True |
| 1022 | |
| 1023 | def protocol_version(self): |
| 1024 | - """ask for the protocol version |
| 1025 | + """Ask for the protocol version |
| 1026 | |
| 1027 | will return a deferred that will get called with |
| 1028 | - the request object when completed |
| 1029 | + the request object when completed. |
| 1030 | + |
| 1031 | """ |
| 1032 | p = ProtocolVersion(self) |
| 1033 | p.start() |
| 1034 | return p.deferred |
| 1035 | |
| 1036 | def dataReceived(self, data): |
| 1037 | - """extends dataReceived. |
| 1038 | - |
| 1039 | - this method first reads the protocol hello line then switches back to |
| 1040 | - len+data.""" |
| 1041 | + """Extend dataReceived. |
| 1042 | + |
| 1043 | + First reads the protocol hello line then switch back to len+data. |
| 1044 | + |
| 1045 | + """ |
| 1046 | if self.line_mode: |
| 1047 | # first read the hello line, then back to binary. |
| 1048 | try: |
| 1049 | @@ -82,8 +88,9 @@ |
| 1050 | def dummy_authenticate(self, credentials): |
| 1051 | """Authenticate to a server using the 'dummy auth' provider. |
| 1052 | |
| 1053 | - Returns a deferred that will get called with the request |
| 1054 | + Return a deferred that will get called with the request |
| 1055 | object when completed. |
| 1056 | + |
| 1057 | """ |
| 1058 | p = Authenticate(self, {'dummy_token': credentials}) |
| 1059 | p.start() |
| 1060 | @@ -97,8 +104,9 @@ |
| 1061 | @param token: a previously acquired OAuth access token. |
| 1062 | @type consumer: `oauth.OAuthToken` |
| 1063 | |
| 1064 | - Returns a deferred that will get called with the request |
| 1065 | + Return a deferred that will get called with the request |
| 1066 | object when completed. |
| 1067 | + |
| 1068 | """ |
| 1069 | request = oauth.OAuthRequest.from_consumer_and_token( |
| 1070 | oauth_consumer=consumer, |
| 1071 | @@ -116,9 +124,10 @@ |
| 1072 | return p.deferred |
| 1073 | |
| 1074 | def handle_ROOT(self, message): |
| 1075 | - """handle incoming ROOT message |
| 1076 | - |
| 1077 | - will notify if someone is waiting for this information |
| 1078 | + """Handle incoming ROOT message. |
| 1079 | + |
| 1080 | + Will notify if someone is waiting for this information. |
| 1081 | + |
| 1082 | """ |
| 1083 | self.root_id = message.root.node |
| 1084 | if self.root_id_defers: |
| 1085 | @@ -127,40 +136,66 @@ |
| 1086 | self.root_id_defers = [] |
| 1087 | |
| 1088 | def handle_NODE_STATE(self, message): |
| 1089 | - """handle incoming NODE_STATE""" |
| 1090 | + """Handle incoming NODE_STATE.""" |
| 1091 | self.notify_node_state(message.node_state) |
| 1092 | |
| 1093 | def handle_NOTIFY_SHARE(self, message): |
| 1094 | - """handle incoming NOTIFY_SHARE""" |
| 1095 | + """Handle incoming NOTIFY_SHARE.""" |
| 1096 | self.notify_share_change(message) |
| 1097 | |
| 1098 | def handle_SHARE_DELETED(self, message): |
| 1099 | - """handle incoming SHARE_DELETED""" |
| 1100 | + """Handle incoming SHARE_DELETED.""" |
| 1101 | self.notify_share_change(message) |
| 1102 | |
| 1103 | def handle_SHARE_ACCEPTED(self, message): |
| 1104 | - """handle incoming SHARE_ACCEPTED""" |
| 1105 | + """Handle incoming SHARE_ACCEPTED.""" |
| 1106 | self.notify_share_answer(message.share_accepted) |
| 1107 | |
| 1108 | + def handle_VOLUME_CREATED(self, message): |
| 1109 | + """Handle incoming VOLUME_CREATED""" |
| 1110 | + assert message.type == protocol_pb2.Message.VOLUME_CREATED |
| 1111 | + msg = message.volume_created |
| 1112 | + vol = None |
| 1113 | + if self._volume_created_callback is not None: |
| 1114 | + if msg.type == protocol_pb2.Volumes.ROOT: |
| 1115 | + vol = volumes.RootVolume.from_msg(msg.root) |
| 1116 | + elif msg.type == protocol_pb2.Volumes.SHARE: |
| 1117 | + vol = volumes.ShareVolume.from_msg(msg.share) |
| 1118 | + elif msg.type == protocol_pb2.Volumes.UDF: |
| 1119 | + vol = volumes.UDFVolume.from_msg(msg.udf) |
| 1120 | + else: |
| 1121 | + raise TypeError("Message.volume_created's type is not valid: %s" % |
| 1122 | + message.volume_created.type) |
| 1123 | + |
| 1124 | + self._volume_created_callback(vol) |
| 1125 | + |
| 1126 | + def handle_VOLUME_DELETED(self, message): |
| 1127 | + """Handle incoming VOLUME_DELETED.""" |
| 1128 | + assert message.type == protocol_pb2.Message.VOLUME_DELETED |
| 1129 | + if self._volume_deleted_callback is not None: |
| 1130 | + vol_id = uuid.UUID(message.volume_deleted.volume) |
| 1131 | + self._volume_deleted_callback(vol_id) |
| 1132 | + |
| 1133 | def handle_BEGIN_CONTENT(self, message): |
| 1134 | - """Accepts and discards a misplaced BEGIN_CONTENT. |
| 1135 | + """Accept and discard a misplaced BEGIN_CONTENT. |
| 1136 | |
| 1137 | It can happen that while the server receives a PUT_CONTENT request |
| 1138 | and that it tells us to BEGIN_CONTENT, we cancelled the request, |
| 1139 | received the OK, and this side's request is gone, so receive this |
| 1140 | message here. |
| 1141 | + |
| 1142 | """ |
| 1143 | |
| 1144 | def handle_FREE_SPACE_INFO(self, message): |
| 1145 | - """handle unsolicited FREE_SPACE_INFO""" |
| 1146 | + """Handle unsolicited FREE_SPACE_INFO.""" |
| 1147 | self.notify_free_space(message.free_space_info) |
| 1148 | |
| 1149 | def handle_ACCOUNT_INFO(self, message): |
| 1150 | - """handle unsolicited ACCOUNT_INFO""" |
| 1151 | + """Handle unsolicited ACCOUNT_INFO.""" |
| 1152 | self.notify_account_info(message.account_info) |
| 1153 | |
| 1154 | def get_root(self): |
| 1155 | - """get the root id through a deferred""" |
| 1156 | + """Get the root id through a deferred.""" |
| 1157 | if self.root_id is not None: |
| 1158 | return defer.succeed(self.root_id) |
| 1159 | else: |
| 1160 | @@ -169,43 +204,44 @@ |
| 1161 | return d |
| 1162 | |
| 1163 | def make_dir(self, share, parent, name): |
| 1164 | - """ create a directory named name on the node parent |
| 1165 | - |
| 1166 | - the new node id will be on request.new_dir_id |
| 1167 | + """Create a directory named name on the node parent |
| 1168 | + |
| 1169 | + the new node id will be on request.new_dir_id. |
| 1170 | + |
| 1171 | """ |
| 1172 | p = MakeDir(self, share, parent, name) |
| 1173 | p.start() |
| 1174 | return p.deferred |
| 1175 | |
| 1176 | def make_file(self, share, parent, name): |
| 1177 | - """ create a file named name on the node parent |
| 1178 | - |
| 1179 | - the new node id will be on request.new_file_id |
| 1180 | + """Create a file named name on the node parent |
| 1181 | + |
| 1182 | + the new node id will be on request.new_file_id. |
| 1183 | + |
| 1184 | """ |
| 1185 | p = MakeFile(self, share, parent, name) |
| 1186 | p.start() |
| 1187 | return p.deferred |
| 1188 | |
| 1189 | def move(self, share, node, new_parent, new_name): |
| 1190 | - """ move a node |
| 1191 | - """ |
| 1192 | + """Move a node.""" |
| 1193 | p = Move(self, share, node, new_parent, new_name) |
| 1194 | p.start() |
| 1195 | return p.deferred |
| 1196 | |
| 1197 | def unlink(self, share, node): |
| 1198 | - """ unlink a node |
| 1199 | - """ |
| 1200 | + """Unlink a node.""" |
| 1201 | p = Unlink(self, share, node) |
| 1202 | p.start() |
| 1203 | return p.deferred |
| 1204 | |
| 1205 | def get_content(self, share, node, hash, offset=0, |
| 1206 | callback=None, node_attr_callback=None): |
| 1207 | - """ get the content of node with hash |
| 1208 | + """Get the content of node with hash |
| 1209 | |
| 1210 | the content will be on request.content |
| 1211 | - or callback will be called for every piece that arrives |
| 1212 | + or callback will be called for every piece that arrives. |
| 1213 | + |
| 1214 | """ |
| 1215 | req = self.get_content_request(share, node, hash, offset, |
| 1216 | callback, node_attr_callback) |
| 1217 | @@ -213,10 +249,11 @@ |
| 1218 | |
| 1219 | def get_content_request(self, share, node, hash, offset=0, |
| 1220 | callback=None, node_attr_callback=None): |
| 1221 | - """ get the content of node with hash, returns the request |
| 1222 | - |
| 1223 | - the content will be on request.content |
| 1224 | - or callback will be called for every piece that arrives |
| 1225 | + """Get the content of node with hash, return the request. |
| 1226 | + |
| 1227 | + The content will be on request.content, or callback will be |
| 1228 | + called for every piece that arrives. |
| 1229 | + |
| 1230 | """ |
| 1231 | p = GetContent(self, share, node, hash, offset, |
| 1232 | callback, node_attr_callback) |
| 1233 | @@ -225,33 +262,31 @@ |
| 1234 | |
| 1235 | def put_content(self, share, node, previous_hash, hash, |
| 1236 | crc32, size, deflated_size, fd): |
| 1237 | - """ put the content of fd into file node |
| 1238 | - """ |
| 1239 | + """Put the content of fd into file node.""" |
| 1240 | req = self.put_content_request(share, node, previous_hash, |
| 1241 | hash, crc32, size, deflated_size, fd) |
| 1242 | return req.deferred |
| 1243 | |
| 1244 | def put_content_request(self, share, node, previous_hash, hash, |
| 1245 | crc32, size, deflated_size, fd): |
| 1246 | - """ put the content of fd into file node, return the request |
| 1247 | - """ |
| 1248 | + """Put the content of fd into file node, return the request.""" |
| 1249 | p = PutContent(self, share, node, previous_hash, hash, crc32, size, |
| 1250 | deflated_size, fd) |
| 1251 | p.start() |
| 1252 | return p |
| 1253 | |
| 1254 | def query(self, items): |
| 1255 | - """ get the current hash for items if changed |
| 1256 | - |
| 1257 | - items is a list of (node, hash) tuples |
| 1258 | + """Get the current hash for items if changed |
| 1259 | + |
| 1260 | + items is a list of (node, hash) tuples. |
| 1261 | + |
| 1262 | """ |
| 1263 | r = MultiQuery(self, items) |
| 1264 | r.start() |
| 1265 | return r.deferred |
| 1266 | |
| 1267 | def get_free_space(self, share_id): |
| 1268 | - """Get quota information for the given share (or the user's own |
| 1269 | - space).""" |
| 1270 | + """Get quota info for the given share (or the user's own space).""" |
| 1271 | r = FreeSpaceInquiry(self, share_id) |
| 1272 | r.start() |
| 1273 | return r.deferred |
| 1274 | @@ -263,9 +298,10 @@ |
| 1275 | return r.deferred |
| 1276 | |
| 1277 | def set_node_state_callback(self, callback): |
| 1278 | - """define the function to be called when a node_state message arrives |
| 1279 | - |
| 1280 | - the function will be called with the message as argument |
| 1281 | + """Define the function to be called when a node_state message arrives |
| 1282 | + |
| 1283 | + The function will be called with the message as argument. |
| 1284 | + |
| 1285 | """ |
| 1286 | self._node_state_callback = callback |
| 1287 | |
| 1288 | @@ -281,8 +317,9 @@ |
| 1289 | node_state.hash) |
| 1290 | |
| 1291 | def set_free_space_callback(self, callback): |
| 1292 | - """Sets the quota notification callback, which will be called |
| 1293 | - with the share id and free bytes. |
| 1294 | + """Set the quota notification callback. |
| 1295 | + |
| 1296 | + It will be called with the share id and free bytes. |
| 1297 | |
| 1298 | """ |
| 1299 | self._free_space_callback = callback |
| 1300 | @@ -299,8 +336,10 @@ |
| 1301 | free_space_info.free_bytes) |
| 1302 | |
| 1303 | def set_account_info_callback(self, callback): |
| 1304 | - """Sets the account info notification callback; the callback |
| 1305 | - will be passed a raw AccountInfo structure when it is called.""" |
| 1306 | + """Set the account info notification callback; the callback |
| 1307 | + will be passed a raw AccountInfo structure when it is called. |
| 1308 | + |
| 1309 | + """ |
| 1310 | self._account_info_callback = callback |
| 1311 | |
| 1312 | def notify_account_info(self, account_info): |
| 1313 | @@ -309,9 +348,7 @@ |
| 1314 | self._account_info_callback(account_info) |
| 1315 | |
| 1316 | def set_share_change_callback(self, callback): |
| 1317 | - """Define the function to be called when something changed regarding |
| 1318 | - a share. |
| 1319 | - """ |
| 1320 | + """Set the callback when something changed regarding a share.""" |
| 1321 | self._share_change_callback = callback |
| 1322 | |
| 1323 | def notify_share_change(self, msg): |
| 1324 | @@ -319,6 +356,7 @@ |
| 1325 | notify info. |
| 1326 | |
| 1327 | @param msg: - a (raw) NotifyShare message |
| 1328 | + |
| 1329 | """ |
| 1330 | if not self._share_change_callback: |
| 1331 | return |
| 1332 | @@ -340,6 +378,7 @@ |
| 1333 | """Call the current share answer callback, if any, with the info. |
| 1334 | |
| 1335 | @param msg: - a (raw) ShareAccepted message |
| 1336 | + |
| 1337 | """ |
| 1338 | if self._share_answer_callback: |
| 1339 | if msg.answer == protocol_pb2.ShareAccepted.YES: |
| 1340 | @@ -350,8 +389,22 @@ |
| 1341 | raise ValueError("Not supported ShareAccepted answer") |
| 1342 | self._share_answer_callback(uuid.UUID(msg.share_id), answer) |
| 1343 | |
| 1344 | + def set_volume_created_callback(self, callback): |
| 1345 | + """Set the callback for volume creation notification.""" |
| 1346 | + if callable(callback): |
| 1347 | + self._volume_created_callback = callback |
| 1348 | + else: |
| 1349 | + raise TypeError('callback for volume_created must be callable') |
| 1350 | + |
| 1351 | + def set_volume_deleted_callback(self, callback): |
| 1352 | + """Set the callback for volume deletion notification.""" |
| 1353 | + if callable(callback): |
| 1354 | + self._volume_deleted_callback = callback |
| 1355 | + else: |
| 1356 | + raise TypeError('callback for volume_deleted must be callable') |
| 1357 | + |
| 1358 | def create_share(self, node, share_to, name, access_level): |
| 1359 | - """Creates a share to other user. |
| 1360 | + """Create a share to other user. |
| 1361 | |
| 1362 | node: which node to share. |
| 1363 | share_to: the id of the receiving user. |
| 1364 | @@ -360,25 +413,28 @@ |
| 1365 | |
| 1366 | There's no need to indicate where the node lives, as it only can be |
| 1367 | in own root (there's no re-sharing). |
| 1368 | + |
| 1369 | """ |
| 1370 | r = CreateShare(self, node, share_to, name, access_level) |
| 1371 | r.start() |
| 1372 | return r.deferred |
| 1373 | |
| 1374 | def delete_share(self, share_id): |
| 1375 | - """Deletes a share we have offered. |
| 1376 | + """Delete a share we have offered. |
| 1377 | |
| 1378 | @param share_id: the id of the share to delete |
| 1379 | + |
| 1380 | """ |
| 1381 | r = DeleteShare(self, share_id) |
| 1382 | r.start() |
| 1383 | return r.deferred |
| 1384 | |
| 1385 | def accept_share(self, share_id, answer): |
| 1386 | - """Accepts (or not) a share from other user. |
| 1387 | + """Accept (or not) a share from other user. |
| 1388 | |
| 1389 | share_id: the share id |
| 1390 | answer: if it was accepted ("Yes") or not ("No") |
| 1391 | + |
| 1392 | """ |
| 1393 | r = AcceptShare(self, share_id, answer) |
| 1394 | r.start() |
| 1395 | @@ -389,16 +445,52 @@ |
| 1396 | |
| 1397 | This includes the shares the user created, and those that were |
| 1398 | shared to her. |
| 1399 | + |
| 1400 | """ |
| 1401 | p = ListShares(self) |
| 1402 | p.start() |
| 1403 | return p.deferred |
| 1404 | |
| 1405 | + def create_udf(self, path, name): |
| 1406 | + """Create a User Defined Folder. |
| 1407 | + |
| 1408 | + @param path: the path in disk to the UDF. |
| 1409 | + @param name: the name of the UDF. |
| 1410 | + |
| 1411 | + """ |
| 1412 | + p = CreateUDF(self, path, name) |
| 1413 | + p.start() |
| 1414 | + return p.deferred |
| 1415 | + |
| 1416 | + def list_volumes(self): |
| 1417 | + """List all the volumes the user has. |
| 1418 | + |
| 1419 | + This includes the volumes: |
| 1420 | + - all the user's UDFs. |
| 1421 | + - all the shares the user has accepted. |
| 1422 | + - the root-root volume. |
| 1423 | + |
| 1424 | + """ |
| 1425 | + p = ListVolumes(self) |
| 1426 | + p.start() |
| 1427 | + return p.deferred |
| 1428 | + |
| 1429 | + def delete_volume(self, volume_id): |
| 1430 | + """Delete 'volume' on the server, removing the associated tree. |
| 1431 | + |
| 1432 | + @param volume: the id of the volume to delete. |
| 1433 | + |
| 1434 | + """ |
| 1435 | + p = DeleteVolume(self, volume_id) |
| 1436 | + p.start() |
| 1437 | + return p.deferred |
| 1438 | + |
| 1439 | def query_caps(self, caps): |
| 1440 | """Query the server to discover its capabilitis. |
| 1441 | |
| 1442 | The server should answer if it supports or not all the given |
| 1443 | caps. |
| 1444 | + |
| 1445 | """ |
| 1446 | r = QuerySetCaps(self, caps) |
| 1447 | r.start() |
| 1448 | @@ -412,14 +504,15 @@ |
| 1449 | |
| 1450 | |
| 1451 | class GetContent(request.Request): |
| 1452 | - """A Request to get the content of a node id |
| 1453 | + """A Request to get the content of a node id. |
| 1454 | |
| 1455 | @ivar data: the content of the node (available upon success) |
| 1456 | + |
| 1457 | """ |
| 1458 | |
| 1459 | def __init__(self, protocol, share, node_id, hash, |
| 1460 | offset=0, callback=None, node_attr_callback=None): |
| 1461 | - """ request the content of node with hash |
| 1462 | + """Request the content of node with hash. |
| 1463 | |
| 1464 | @param protocol: the request handler |
| 1465 | @param share: the share node or root |
| 1466 | @@ -439,7 +532,7 @@ |
| 1467 | self.parts = [] |
| 1468 | |
| 1469 | def _start(self): |
| 1470 | - "send GET_CONTENT" |
| 1471 | + """Send GET_CONTENT.""" |
| 1472 | message = protocol_pb2.Message() |
| 1473 | message.type = protocol_pb2.Message.GET_CONTENT |
| 1474 | message.get_content.node = str(self.node_id) |
| 1475 | @@ -449,8 +542,7 @@ |
| 1476 | self.sendMessage(message) |
| 1477 | |
| 1478 | def processMessage(self, message): |
| 1479 | - """process messages |
| 1480 | - """ |
| 1481 | + """Process messages.""" |
| 1482 | # pylint: disable-msg=W0201 |
| 1483 | if message.type == protocol_pb2.Message.NODE_ATTR: |
| 1484 | if self.node_attr_callback is not None: |
| 1485 | @@ -486,20 +578,22 @@ |
| 1486 | self.error(request.StorageProtocolProtocolError(message)) |
| 1487 | |
| 1488 | def _cancel(self): |
| 1489 | - """Cancels the current download.""" |
| 1490 | + """Cancel the current download.""" |
| 1491 | message = protocol_pb2.Message() |
| 1492 | message.type = protocol_pb2.Message.CANCEL_REQUEST |
| 1493 | self.sendMessage(message) |
| 1494 | |
| 1495 | + |
| 1496 | class ListShares(request.Request): |
| 1497 | """List all the shares the user is involved. |
| 1498 | |
| 1499 | This includes the shares the user created, and those that were |
| 1500 | shared to her. |
| 1501 | + |
| 1502 | """ |
| 1503 | |
| 1504 | def _start(self): |
| 1505 | - '''Sends the LIST_SHARES message to the server.''' |
| 1506 | + """Send the LIST_SHARES message to the server.""" |
| 1507 | # pylint: disable-msg=W0201 |
| 1508 | message = protocol_pb2.Message() |
| 1509 | message.type = protocol_pb2.Message.LIST_SHARES |
| 1510 | @@ -507,7 +601,7 @@ |
| 1511 | self.shares = [] |
| 1512 | |
| 1513 | def processMessage(self, message): |
| 1514 | - '''Process the answer from the server.''' |
| 1515 | + """Process the answer from the server.""" |
| 1516 | if message.type == protocol_pb2.Message.SHARES_INFO: |
| 1517 | share = sharersp.ShareResponse.load_from_msg(message.shares) |
| 1518 | self.shares.append(share) |
| 1519 | @@ -516,8 +610,9 @@ |
| 1520 | else: |
| 1521 | self.error(request.StorageRequestError(self, message)) |
| 1522 | |
| 1523 | + |
| 1524 | class CreateShare(request.Request): |
| 1525 | - """Creates a share.""" |
| 1526 | + """Create a share.""" |
| 1527 | |
| 1528 | # these are the valid access levels and their translation to the |
| 1529 | # protocol message |
| 1530 | @@ -527,7 +622,7 @@ |
| 1531 | } |
| 1532 | |
| 1533 | def __init__(self, protocol, node_id, share_to, name, access_level): |
| 1534 | - """Creates a share. |
| 1535 | + """Create a share. |
| 1536 | |
| 1537 | @param node_id: which node will be root to share. |
| 1538 | @param share_to: the id of the receiving user. |
| 1539 | @@ -543,7 +638,7 @@ |
| 1540 | self.share_id = None |
| 1541 | |
| 1542 | def _start(self): |
| 1543 | - '''Sends the CREATE_SHARE message to the server.''' |
| 1544 | + """Send the CREATE_SHARE message to the server.""" |
| 1545 | message = protocol_pb2.Message() |
| 1546 | message.type = protocol_pb2.Message.CREATE_SHARE |
| 1547 | message.create_share.node = self.node |
| 1548 | @@ -562,7 +657,7 @@ |
| 1549 | self.sendMessage(message) |
| 1550 | |
| 1551 | def processMessage(self, message): |
| 1552 | - '''Process the answer from the server.''' |
| 1553 | + """Process the answer from the server.""" |
| 1554 | if message.type == protocol_pb2.Message.SHARE_CREATED: |
| 1555 | self.share_id = message.share_created.share_id |
| 1556 | self.done() |
| 1557 | @@ -574,7 +669,7 @@ |
| 1558 | |
| 1559 | |
| 1560 | class AcceptShare(request.Request): |
| 1561 | - """Acceptss a share (or not).""" |
| 1562 | + """Accept a share (or not).""" |
| 1563 | |
| 1564 | # these are the valid answers and their translation to the |
| 1565 | # protocol message |
| 1566 | @@ -584,17 +679,18 @@ |
| 1567 | } |
| 1568 | |
| 1569 | def __init__(self, protocol, share_id, answer): |
| 1570 | - """Accepts (or not) a share from other user. |
| 1571 | + """Accept (or not) a share from other user. |
| 1572 | |
| 1573 | @param share_id: the share id |
| 1574 | @param answer: if it was accepted ("Yes") or not ("No") |
| 1575 | + |
| 1576 | """ |
| 1577 | request.Request.__init__(self, protocol) |
| 1578 | self.share_id = share_id |
| 1579 | self.answer = answer |
| 1580 | |
| 1581 | def _start(self): |
| 1582 | - '''Sends the SHARE_ACCEPTED message to the server.''' |
| 1583 | + """Send the SHARE_ACCEPTED message to the server.""" |
| 1584 | message = protocol_pb2.Message() |
| 1585 | message.type = protocol_pb2.Message.SHARE_ACCEPTED |
| 1586 | message.share_accepted.share_id = str(self.share_id) |
| 1587 | @@ -610,7 +706,7 @@ |
| 1588 | self.sendMessage(message) |
| 1589 | |
| 1590 | def processMessage(self, message): |
| 1591 | - '''Process the answer from the server.''' |
| 1592 | + """Process the answer from the server.""" |
| 1593 | if message.type == protocol_pb2.Message.OK: |
| 1594 | self.done() |
| 1595 | else: |
| 1596 | @@ -618,18 +714,19 @@ |
| 1597 | |
| 1598 | |
| 1599 | class DeleteShare(request.Request): |
| 1600 | - """Deletes a share.""" |
| 1601 | + """Delete a share.""" |
| 1602 | |
| 1603 | def __init__(self, protocol, share_id): |
| 1604 | - """Deletes a share we had offered to someone else. |
| 1605 | + """Delete a share we had offered to someone else. |
| 1606 | |
| 1607 | @param share_id: the share id |
| 1608 | + |
| 1609 | """ |
| 1610 | request.Request.__init__(self, protocol) |
| 1611 | self.share_id = share_id |
| 1612 | |
| 1613 | def _start(self): |
| 1614 | - """Sends the DELETE_SHARE message to the server.""" |
| 1615 | + """Send the DELETE_SHARE message to the server.""" |
| 1616 | message = protocol_pb2.Message() |
| 1617 | message.type = protocol_pb2.Message.DELETE_SHARE |
| 1618 | message.delete_share.share_id = str(self.share_id) |
| 1619 | @@ -644,13 +741,117 @@ |
| 1620 | self.error(request.StorageRequestError(self, message)) |
| 1621 | |
| 1622 | |
| 1623 | +class CreateUDF(request.Request): |
| 1624 | + """Create a UDF.""" |
| 1625 | + |
| 1626 | + def __init__(self, protocol, path, name): |
| 1627 | + """Create a UDF. |
| 1628 | + |
| 1629 | + @param path: which node will be root to be UDF. |
| 1630 | + @param name: the name of the UDF |
| 1631 | + |
| 1632 | + """ |
| 1633 | + request.Request.__init__(self, protocol) |
| 1634 | + self.path = path |
| 1635 | + self.name = name |
| 1636 | + self.volume_id = None |
| 1637 | + self.node_id = None |
| 1638 | + |
| 1639 | + def _start(self): |
| 1640 | + """Send the CREATE_UDF message to the server.""" |
| 1641 | + message = protocol_pb2.Message() |
| 1642 | + message.type = protocol_pb2.Message.CREATE_UDF |
| 1643 | + message.create_udf.path = self.path |
| 1644 | + message.create_udf.name = self.name |
| 1645 | + self.sendMessage(message) |
| 1646 | + |
| 1647 | + def processMessage(self, message): |
| 1648 | + """Process the answer from the server.""" |
| 1649 | + if (message.type == protocol_pb2.Message.VOLUME_CREATED and |
| 1650 | + message.volume_created.type == protocol_pb2.Volumes.UDF): |
| 1651 | + self.volume_id = message.volume_created.udf.volume |
| 1652 | + self.node_id = message.volume_created.udf.node |
| 1653 | + self.done() |
| 1654 | + else: |
| 1655 | + self.error(request.StorageRequestError(self, message)) |
| 1656 | + |
| 1657 | + |
| 1658 | +class ListVolumes(request.Request): |
| 1659 | + """List all the volumes the user has. |
| 1660 | + |
| 1661 | + Including: |
| 1662 | + - the UDFs the user created. |
| 1663 | + - the shares the user has accepted. |
| 1664 | + - the user's root-root. |
| 1665 | + |
| 1666 | + """ |
| 1667 | + |
| 1668 | + def __init__(self, protocol): |
| 1669 | + """List volumes.""" |
| 1670 | + request.Request.__init__(self, protocol) |
| 1671 | + self.volumes = [] |
| 1672 | + |
| 1673 | + def _start(self): |
| 1674 | + """Send the LIST_VOLUMES message to the server.""" |
| 1675 | + self.volumes = [] |
| 1676 | + message = protocol_pb2.Message() |
| 1677 | + message.type = protocol_pb2.Message.LIST_VOLUMES |
| 1678 | + self.sendMessage(message) |
| 1679 | + |
| 1680 | + def processMessage(self, message): |
| 1681 | + """Process the answer from the server.""" |
| 1682 | + if message.type == protocol_pb2.Message.VOLUMES_INFO: |
| 1683 | + if message.list_volumes.type == protocol_pb2.Volumes.SHARE: |
| 1684 | + vol = volumes.ShareVolume.from_msg(message.list_volumes.share) |
| 1685 | + self.volumes.append(vol) |
| 1686 | + elif message.list_volumes.type == protocol_pb2.Volumes.UDF: |
| 1687 | + vol = volumes.UDFVolume.from_msg(message.list_volumes.udf) |
| 1688 | + self.volumes.append(vol) |
| 1689 | + elif message.list_volumes.type == protocol_pb2.Volumes.ROOT: |
| 1690 | + vol = volumes.RootVolume.from_msg(message.list_volumes.root) |
| 1691 | + self.volumes.append(vol) |
| 1692 | + else: |
| 1693 | + self.error(request.StorageRequestError(self, message)) |
| 1694 | + elif message.type == protocol_pb2.Message.VOLUMES_END: |
| 1695 | + self.done() |
| 1696 | + else: |
| 1697 | + self.error(request.StorageRequestError(self, message)) |
| 1698 | + |
| 1699 | + |
| 1700 | +class DeleteVolume(request.Request): |
| 1701 | + """Delete a volume.""" |
| 1702 | + |
| 1703 | + def __init__(self, protocol, volume_id): |
| 1704 | + """Delete a volume. |
| 1705 | + |
| 1706 | + @param volume_id: the volume id |
| 1707 | + |
| 1708 | + """ |
| 1709 | + request.Request.__init__(self, protocol) |
| 1710 | + self.volume_id = str(volume_id) |
| 1711 | + |
| 1712 | + def _start(self): |
| 1713 | + """Send the DELETE_VOLUME message to the server.""" |
| 1714 | + message = protocol_pb2.Message() |
| 1715 | + message.type = protocol_pb2.Message.DELETE_VOLUME |
| 1716 | + message.delete_volume.volume = self.volume_id |
| 1717 | + |
| 1718 | + self.sendMessage(message) |
| 1719 | + |
| 1720 | + def processMessage(self, message): |
| 1721 | + """Process the answer from the server.""" |
| 1722 | + if message.type == protocol_pb2.Message.OK: |
| 1723 | + self.done() |
| 1724 | + else: |
| 1725 | + self.error(request.StorageRequestError(self, message)) |
| 1726 | + |
| 1727 | + |
| 1728 | class Unlink(request.Request): |
| 1729 | - """ unlink a node |
| 1730 | - """ |
| 1731 | + """Unlink a node.""" |
| 1732 | # pylint: disable-msg=C0111 |
| 1733 | |
| 1734 | def __init__(self, protocol, share, node_id): |
| 1735 | - """ request that node_id be unlinked |
| 1736 | + """Request that node_id be unlinked |
| 1737 | |
| 1738 | @param protocol: the request handler |
| 1739 | @param share: the share node or root |
| 1740 | @@ -677,10 +878,10 @@ |
| 1741 | |
| 1742 | |
| 1743 | class Move(request.Request): |
| 1744 | - """ move a node |
| 1745 | - """ |
| 1746 | + """Move a node.""" |
| 1747 | + |
| 1748 | def __init__(self, protocol, share, node_id, new_parent_id, new_name): |
| 1749 | - """create the move request |
| 1750 | + """Create the move request |
| 1751 | |
| 1752 | @param protocol: the request handler |
| 1753 | @param share: the share node or root |
| 1754 | @@ -697,7 +898,7 @@ |
| 1755 | self.new_name = new_name |
| 1756 | |
| 1757 | def _start(self): |
| 1758 | - """send MOVE""" |
| 1759 | + """Send MOVE.""" |
| 1760 | message = protocol_pb2.Message() |
| 1761 | message.type = protocol_pb2.Message.MOVE |
| 1762 | message.move.share = self.share |
| 1763 | @@ -708,7 +909,7 @@ |
| 1764 | self.sendMessage(message) |
| 1765 | |
| 1766 | def processMessage(self, message): |
| 1767 | - """process messages""" |
| 1768 | + """Process messages.""" |
| 1769 | if message.type == protocol_pb2.Message.OK: |
| 1770 | self.done() |
| 1771 | else: |
| 1772 | @@ -718,16 +919,19 @@ |
| 1773 | self.error(request.StorageRequestError(self, message)) |
| 1774 | |
| 1775 | class MultiQuery(object): |
| 1776 | - """Creates a Request-like object that encapsulates many Query requests |
| 1777 | - |
| 1778 | - we may need to split this request into many Query rests if the list of items |
| 1779 | - to query is to big to fit in one message |
| 1780 | + """Create a Request-like object that encapsulates many Query requests |
| 1781 | + |
| 1782 | + We may need to split this request into many Query rests if the list of |
| 1783 | + items to query is to big to fit in one message. |
| 1784 | + |
| 1785 | """ |
| 1786 | + |
| 1787 | def __init__(self, protocol, items): |
| 1788 | - """ create a multiquery |
| 1789 | + """Create a multiquery. |
| 1790 | |
| 1791 | @param protocol: the request handler |
| 1792 | @param items: a list of (node, hash) tuples |
| 1793 | + |
| 1794 | """ |
| 1795 | items = iter(items) |
| 1796 | defers = [] |
| 1797 | @@ -745,27 +949,28 @@ |
| 1798 | self.deferred = defer.DeferredList(defers, consumeErrors=True) |
| 1799 | |
| 1800 | def start(self): |
| 1801 | - """start the queries""" |
| 1802 | + """Start the queries.""" |
| 1803 | for q in self.queries: |
| 1804 | q.start() |
| 1805 | |
| 1806 | class Query(request.Request): |
| 1807 | - """query about the hash of a node_id |
| 1808 | + """Query about the hash of a node_id. |
| 1809 | |
| 1810 | @ivar remains: the items that could not fit in the query |
| 1811 | @ivar response: the node state messages that were received |
| 1812 | + |
| 1813 | """ |
| 1814 | |
| 1815 | def __init__(self, protocol, items): |
| 1816 | - """ generates a query message to send to the server |
| 1817 | + """Generate a query message to send to the server. |
| 1818 | |
| 1819 | - puts as much items as it can inside the message |
| 1820 | - whats left is left in self.remainder |
| 1821 | + Put as much items as it can inside the message whats left is |
| 1822 | + left in self.remainder. |
| 1823 | |
| 1824 | @param protocol: the request handler |
| 1825 | @param items: a list of (node, hash, share) tuples |
| 1826 | + |
| 1827 | """ |
| 1828 | - |
| 1829 | request.Request.__init__(self, protocol) |
| 1830 | self.query_message = qm = protocol_pb2.Message() |
| 1831 | qm.id = 0 # just to have something in the field when calculating size |
| 1832 | @@ -775,7 +980,7 @@ |
| 1833 | items_that_fit = [] |
| 1834 | |
| 1835 | def add_items(msg, *args): |
| 1836 | - """add items to query""" |
| 1837 | + """Add items to query.""" |
| 1838 | for share, node, hash in args: |
| 1839 | qi = msg.query.add() |
| 1840 | qi.share = share |
| 1841 | @@ -794,11 +999,11 @@ |
| 1842 | add_items(qm, *items_that_fit) |
| 1843 | |
| 1844 | def _start(self): |
| 1845 | - """send QUERY""" |
| 1846 | + """Send QUERY.""" |
| 1847 | self.sendMessage(self.query_message) |
| 1848 | |
| 1849 | def processMessage(self, message): |
| 1850 | - """handle messages""" |
| 1851 | + """Handle messages.""" |
| 1852 | if message.type == protocol_pb2.Message.NODE_STATE: |
| 1853 | self.response.append(message.node_state) |
| 1854 | self.protocol.notify_node_state(message.node_state) |
| 1855 | @@ -838,8 +1043,9 @@ |
| 1856 | def go(self): |
| 1857 | """While producing, generates data. |
| 1858 | |
| 1859 | - Reads a little from the file, generates a BYTES message, and pass the |
| 1860 | - control to the reactor. If no more data, it finishes with EOF. |
| 1861 | + Read a little from the file, generates a BYTES message, and pass the |
| 1862 | + control to the reactor. If no more data, finish with EOF. |
| 1863 | + |
| 1864 | """ |
| 1865 | if not self.producing or self.request.cancelled or self.finished: |
| 1866 | return |
| 1867 | @@ -864,11 +1070,12 @@ |
| 1868 | |
| 1869 | |
| 1870 | class PutContent(request.Request): |
| 1871 | - """PUT content request""" |
| 1872 | + """Put content request.""" |
| 1873 | + |
| 1874 | def __init__(self, protocol, share, node_id, |
| 1875 | previous_hash, hash, crc32, size, |
| 1876 | deflated_size, fd): |
| 1877 | - """ put content into a node |
| 1878 | + """Put content into a node. |
| 1879 | |
| 1880 | @param protocol: the request handler |
| 1881 | @param share: the share node or root |
| 1882 | @@ -891,7 +1098,7 @@ |
| 1883 | self.fd = fd |
| 1884 | |
| 1885 | def _start(self): |
| 1886 | - """send PUT_CONTENT""" |
| 1887 | + """Send PUT_CONTENT.""" |
| 1888 | message = protocol_pb2.Message() |
| 1889 | message.type = protocol_pb2.Message.PUT_CONTENT |
| 1890 | message.put_content.share = self.share |
| 1891 | @@ -904,7 +1111,7 @@ |
| 1892 | self.sendMessage(message) |
| 1893 | |
| 1894 | def processMessage(self, message): |
| 1895 | - """handle messages""" |
| 1896 | + """Handle messages.""" |
| 1897 | if message.type == protocol_pb2.Message.BEGIN_CONTENT: |
| 1898 | message_producer = BytesMessageProducer( |
| 1899 | self, self.fd, message.begin_content.offset) |
| 1900 | @@ -917,7 +1124,7 @@ |
| 1901 | self.error(request.StorageRequestError(self, message)) |
| 1902 | |
| 1903 | def _cancel(self): |
| 1904 | - """Cancels the current upload.""" |
| 1905 | + """Cancel the current upload.""" |
| 1906 | if self.producer is not None: |
| 1907 | self.producer.stopProducing() |
| 1908 | message = protocol_pb2.Message() |
| 1909 | @@ -926,10 +1133,10 @@ |
| 1910 | |
| 1911 | |
| 1912 | class MakeObject(request.Request): |
| 1913 | - """ Handles the creation of new objects |
| 1914 | + """Handle the creation of new objects. |
| 1915 | |
| 1916 | - on completion it will have the attribute 'new_id' with the |
| 1917 | - node id of the created object |
| 1918 | + On completion it will have the attribute 'new_id' with the |
| 1919 | + node id of the created object. |
| 1920 | |
| 1921 | @cvar create_message: must be overridden with the correct creation message |
| 1922 | to send |
| 1923 | @@ -939,10 +1146,11 @@ |
| 1924 | @ivar new_id: the id of the node that was created (available upon success) |
| 1925 | @ivar new_parent_id: the parent id the node now exists under |
| 1926 | @ivar new_name: the name the node now exists under |
| 1927 | + |
| 1928 | """ |
| 1929 | |
| 1930 | def __init__(self, protocol, share, parent_id, name): |
| 1931 | - """ create a node |
| 1932 | + """Create a node. |
| 1933 | |
| 1934 | @param protocol: the request handler |
| 1935 | @param share: the share node or root |
| 1936 | @@ -956,7 +1164,7 @@ |
| 1937 | self.name = name |
| 1938 | |
| 1939 | def _start(self): |
| 1940 | - """send $MAKE message""" |
| 1941 | + """Send MAKE message.""" |
| 1942 | message = protocol_pb2.Message() |
| 1943 | message.type = self.create_message |
| 1944 | |
| 1945 | @@ -966,7 +1174,7 @@ |
| 1946 | self.sendMessage(message) |
| 1947 | |
| 1948 | def processMessage(self, message): |
| 1949 | - """handle messages""" |
| 1950 | + """Handle messages.""" |
| 1951 | # pylint: disable-msg=W0201 |
| 1952 | if message.type == self.create_response: |
| 1953 | self.new_id = message.new.node |
| 1954 | @@ -977,36 +1185,39 @@ |
| 1955 | self.error(request.StorageRequestError(self, message)) |
| 1956 | |
| 1957 | class MakeDir(MakeObject): |
| 1958 | - """Extends MakeObject to make directories""" |
| 1959 | + """Extend MakeObject to make directories.""" |
| 1960 | + |
| 1961 | create_message = protocol_pb2.Message.MAKE_DIR |
| 1962 | create_response = protocol_pb2.Message.NEW_DIR |
| 1963 | |
| 1964 | |
| 1965 | class MakeFile(MakeObject): |
| 1966 | - """Extends MakeObject to make files""" |
| 1967 | + """Extend MakeObject to make files.""" |
| 1968 | + |
| 1969 | create_message = protocol_pb2.Message.MAKE_FILE |
| 1970 | create_response = protocol_pb2.Message.NEW_FILE |
| 1971 | |
| 1972 | |
| 1973 | class ProtocolVersion(request.Request): |
| 1974 | - """ Handles the protocol version query |
| 1975 | + """Handle the protocol version query. |
| 1976 | |
| 1977 | when completed will contain the servers protocol version |
| 1978 | on `other_protocol_version` |
| 1979 | |
| 1980 | @ivar other_protocol_version: the other peer's protocol version (available |
| 1981 | upon success) |
| 1982 | + |
| 1983 | """ |
| 1984 | |
| 1985 | def _start(self): |
| 1986 | - """send PROTOCOL_VERSION""" |
| 1987 | + """Send PROTOCOL_VERSION.""" |
| 1988 | message = protocol_pb2.Message() |
| 1989 | message.type = protocol_pb2.Message.PROTOCOL_VERSION |
| 1990 | message.protocol.version = self.protocol.PROTOCOL_VERSION |
| 1991 | self.sendMessage(message) |
| 1992 | |
| 1993 | def processMessage(self, message): |
| 1994 | - """handle messages""" |
| 1995 | + """Handle messages.""" |
| 1996 | # pylint: disable-msg=W0201 |
| 1997 | if message.type == protocol_pb2.Message.PROTOCOL_VERSION: |
| 1998 | self.other_protocol_version = message.protocol.version |
| 1999 | @@ -1015,20 +1226,20 @@ |
| 2000 | self.error(request.StorageRequestError(self, message)) |
| 2001 | |
| 2002 | class Authenticate(request.Request): |
| 2003 | - """ Request to authenticate the user |
| 2004 | - """ |
| 2005 | + """Request to authenticate the user.""" |
| 2006 | |
| 2007 | def __init__(self, protocol, auth_parameters): |
| 2008 | - """create an authentication request |
| 2009 | + """Create an authentication request. |
| 2010 | |
| 2011 | @param protocol: the request handler |
| 2012 | @param auth_parameters: a dictionary of authentication parameters. |
| 2013 | + |
| 2014 | """ |
| 2015 | request.Request.__init__(self, protocol) |
| 2016 | self.auth_parameters = auth_parameters |
| 2017 | |
| 2018 | def _start(self): |
| 2019 | - """send AUTH_REQUEST""" |
| 2020 | + """Send AUTH_REQUEST.""" |
| 2021 | message = protocol_pb2.Message() |
| 2022 | message.type = protocol_pb2.Message.AUTH_REQUEST |
| 2023 | for key, value in self.auth_parameters.items(): |
| 2024 | @@ -1038,7 +1249,7 @@ |
| 2025 | self.sendMessage(message) |
| 2026 | |
| 2027 | def processMessage(self, message): |
| 2028 | - """handle messages""" |
| 2029 | + """Handle messages.""" |
| 2030 | if message.type == protocol_pb2.Message.AUTH_AUTHENTICATED: |
| 2031 | self.done() |
| 2032 | elif message.type == protocol_pb2.Message.ERROR: |
| 2033 | @@ -1050,13 +1261,14 @@ |
| 2034 | |
| 2035 | |
| 2036 | class QuerySetCaps(request.Request): |
| 2037 | - """Queries or Sets the server to use capabilities.""" |
| 2038 | + """Query or Set the server to use capabilities.""" |
| 2039 | |
| 2040 | def __init__(self, protocol, caps, set_mode=False): |
| 2041 | - """Generates a query_caps or set_caps message to send to the server. |
| 2042 | + """Generate a query_caps or set_caps message to send to the server. |
| 2043 | |
| 2044 | @param protocol: the request handler |
| 2045 | @param caps: a list of capabilities to ask for or to set |
| 2046 | + |
| 2047 | """ |
| 2048 | request.Request.__init__(self, protocol) |
| 2049 | self.caps = caps |
| 2050 | @@ -1067,7 +1279,7 @@ |
| 2051 | self.set_mode = set_mode |
| 2052 | |
| 2053 | def _start(self): |
| 2054 | - """Send QUERY_CAPS or SET_CAPS""" |
| 2055 | + """Send QUERY_CAPS or SET_CAPS.""" |
| 2056 | message = protocol_pb2.Message() |
| 2057 | if self.set_mode: |
| 2058 | message.type = protocol_pb2.Message.SET_CAPS |
| 2059 | @@ -1083,7 +1295,7 @@ |
| 2060 | self.sendMessage(message) |
| 2061 | |
| 2062 | def processMessage(self, message): |
| 2063 | - """Handle the message""" |
| 2064 | + """Handle the message.""" |
| 2065 | if message.type == protocol_pb2.Message.ACCEPT_CAPS: |
| 2066 | self.accepted = message.accept_caps.accepted |
| 2067 | self.redirect_hostname = message.accept_caps.redirect_hostname |
| 2068 | @@ -1098,12 +1310,12 @@ |
| 2069 | """Query available space.""" |
| 2070 | |
| 2071 | def __init__(self, protocol, share_id): |
| 2072 | - '''Initializes the request.''' |
| 2073 | + """Initialize the request.""" |
| 2074 | request.Request.__init__(self, protocol) |
| 2075 | self.share_id = share_id |
| 2076 | |
| 2077 | def _start(self): |
| 2078 | - '''Sends the FREE_SPACE_INQUIRY message to the server.''' |
| 2079 | + """Send the FREE_SPACE_INQUIRY message to the server.""" |
| 2080 | # pylint: disable-msg=W0201 |
| 2081 | message = protocol_pb2.Message() |
| 2082 | message.type = protocol_pb2.Message.FREE_SPACE_INQUIRY |
| 2083 | @@ -1112,7 +1324,7 @@ |
| 2084 | self.free_bytes = None |
| 2085 | |
| 2086 | def processMessage(self, message): |
| 2087 | - '''Process the answer from the server.''' |
| 2088 | + """Process the answer from the server.""" |
| 2089 | if message.type == protocol_pb2.Message.FREE_SPACE_INFO: |
| 2090 | self.free_bytes = message.free_space_info.free_bytes |
| 2091 | self.done() |
| 2092 | @@ -1124,7 +1336,7 @@ |
| 2093 | """Query account information.""" |
| 2094 | |
| 2095 | def _start(self): |
| 2096 | - '''Sends the FREE_SPACE_INQUIRY message to the server.''' |
| 2097 | + """Send the FREE_SPACE_INQUIRY message to the server.""" |
| 2098 | # pylint: disable-msg=W0201 |
| 2099 | message = protocol_pb2.Message() |
| 2100 | message.type = protocol_pb2.Message.ACCOUNT_INQUIRY |
| 2101 | @@ -1132,7 +1344,7 @@ |
| 2102 | self.purchased_bytes = None |
| 2103 | |
| 2104 | def processMessage(self, message): |
| 2105 | - '''Process the answer from the server.''' |
| 2106 | + """Process the answer from the server.""" |
| 2107 | if message.type == protocol_pb2.Message.ACCOUNT_INFO: |
| 2108 | self.purchased_bytes = message.account_info.purchased_bytes |
| 2109 | self.done() |
| 2110 | @@ -1141,19 +1353,18 @@ |
| 2111 | |
| 2112 | |
| 2113 | class ThrottlingStorageClient(StorageClient): |
| 2114 | - """ |
| 2115 | - This is the throttling version of the StorageClient protocol. |
| 2116 | - """ |
| 2117 | + """The throttling version of the StorageClient protocol.""" |
| 2118 | + |
| 2119 | factory = None |
| 2120 | |
| 2121 | def connectionMade(self): |
| 2122 | - """Handle connection Made.""" |
| 2123 | + """Handle connectionMade.""" |
| 2124 | if self.factory.client is None: |
| 2125 | self.factory.client = self |
| 2126 | StorageClient.connectionMade(self) |
| 2127 | |
| 2128 | def connectionLost(self, reason=None): |
| 2129 | - """Handle connection lost.""" |
| 2130 | + """Handle connectionLost.""" |
| 2131 | if self.factory.client is self: |
| 2132 | self.factory.unregisterProtocol(self) |
| 2133 | StorageClient.connectionLost(self, reason=reason) |
| 2134 | @@ -1194,20 +1405,19 @@ |
| 2135 | |
| 2136 | |
| 2137 | class StorageClientFactory(ClientFactory): |
| 2138 | - """StorageClient factory""" |
| 2139 | + """StorageClient factory.""" |
| 2140 | # pylint: disable-msg=W0232 |
| 2141 | protocol = StorageClient |
| 2142 | |
| 2143 | |
| 2144 | class ThrottlingStorageClientFactory(StorageClientFactory): |
| 2145 | - """ |
| 2146 | - This is the throttling version of StorageClientFactory. |
| 2147 | - """ |
| 2148 | + """The throttling version of StorageClientFactory.""" |
| 2149 | |
| 2150 | protocol = ThrottlingStorageClient |
| 2151 | + client = None |
| 2152 | |
| 2153 | def __init__(self, read_limit=None, write_limit=None): |
| 2154 | - """creates the instance""" |
| 2155 | + """Create the instance.""" |
| 2156 | self.readLimit = read_limit # max bytes we should read per second |
| 2157 | self.writeLimit = write_limit # max bytes we should write per second |
| 2158 | self.readThisSecond = 0 |
| 2159 | @@ -1219,14 +1429,13 @@ |
| 2160 | self.stopped = True |
| 2161 | |
| 2162 | def callLater(self, period, func, *args, **kwargs): |
| 2163 | - """ |
| 2164 | - Wrapper around L{reactor.callLater} for test purpose. |
| 2165 | - """ |
| 2166 | + """Wrapper around L{reactor.callLater} for test purpose.""" |
| 2167 | return reactor.callLater(period, func, *args, **kwargs) |
| 2168 | |
| 2169 | def maybeCallLater(self, id, period, func): |
| 2170 | - """do a callLater only if we don't have a DelayedCall with the |
| 2171 | + """Do a callLater only if we don't have a DelayedCall with the |
| 2172 | specified id already running. |
| 2173 | + |
| 2174 | """ |
| 2175 | delayed_call = getattr(self, id) |
| 2176 | # check if we already have a DelayedCall running |
| 2177 | @@ -1236,21 +1445,17 @@ |
| 2178 | return delayed_call |
| 2179 | |
| 2180 | def registerWritten(self, length): |
| 2181 | - """ |
| 2182 | - Called by protocol to tell us more bytes were written. |
| 2183 | - """ |
| 2184 | + """Called by protocol to tell us more bytes were written.""" |
| 2185 | self.writtenThisSecond += length |
| 2186 | self.checkWriteBandwidth() |
| 2187 | |
| 2188 | def registerRead(self, length): |
| 2189 | - """ |
| 2190 | - Called by protocol to tell us more bytes were read. |
| 2191 | - """ |
| 2192 | + """Called by protocol to tell us more bytes were read.""" |
| 2193 | self.readThisSecond += length |
| 2194 | self.checkReadBandwidth() |
| 2195 | |
| 2196 | def checkReadBandwidth(self): |
| 2197 | - """Checks if we've passed bandwidth limits.""" |
| 2198 | + """Check if we've passed bandwidth limits.""" |
| 2199 | if self.readLimit is not None and \ |
| 2200 | self.readThisSecond > self.readLimit and \ |
| 2201 | self.unthrottleReadsID is None: |
| 2202 | @@ -1262,7 +1467,7 @@ |
| 2203 | self.unthrottleReads) |
| 2204 | |
| 2205 | def checkWriteBandwidth(self): |
| 2206 | - """Checks if we've passed bandwidth limits.""" |
| 2207 | + """Check if we've passed bandwidth limits.""" |
| 2208 | if self.writeLimit is not None and \ |
| 2209 | self.writtenThisSecond > self.writeLimit and \ |
| 2210 | self.unthrottleWritesID is None: |
| 2211 | @@ -1275,14 +1480,14 @@ |
| 2212 | self.unthrottleWrites) |
| 2213 | |
| 2214 | def _resetReadThisSecond(self): |
| 2215 | - """reset the counter named with 'name' every 1 second""" |
| 2216 | + """Reset the counter named with 'name' every 1 second.""" |
| 2217 | # check the bandwidth limits |
| 2218 | self.readThisSecond = 0 |
| 2219 | self.resetReadThisSecondID = self.callLater(1, |
| 2220 | self._resetReadThisSecond) |
| 2221 | |
| 2222 | def _resetWrittenThisSecond (self): |
| 2223 | - """reset the counter named with 'name' every 1 second""" |
| 2224 | + """Reset the counter named with 'name' every 1 second.""" |
| 2225 | self.writtenThisSecond = 0 |
| 2226 | self.resetWriteThisSecondID = self.callLater(1, |
| 2227 | self._resetWrittenThisSecond) |
| 2228 | @@ -1310,7 +1515,7 @@ |
| 2229 | self.client.unthrottleWrites() |
| 2230 | |
| 2231 | def buildProtocol(self, addr): |
| 2232 | - """build the protocol and start the counters reset loops""" |
| 2233 | + """Build the protocol and start the counters reset loops.""" |
| 2234 | if self.readLimit is not None: |
| 2235 | self._resetReadThisSecond() |
| 2236 | if self.writeLimit is not None: |
| 2237 | @@ -1319,7 +1524,7 @@ |
| 2238 | return StorageClientFactory.buildProtocol(self, addr) |
| 2239 | |
| 2240 | def unregisterProtocol(self, protocol): |
| 2241 | - """Stop all DelayedCall we have around""" |
| 2242 | + """Stop all DelayedCall we have around.""" |
| 2243 | for delayed in [self.unthrottleReadsID, self.resetReadThisSecondID, |
| 2244 | self.unthrottleWritesID, self.resetWriteThisSecondID]: |
| 2245 | self._cancel_delayed_call(delayed) |
| 2246 | |
| 2247 | === modified file 'ubuntuone/storageprotocol/dircontent.proto' |
| 2248 | --- ubuntuone/storageprotocol/dircontent.proto 2009-06-30 12:00:00 +0000 |
| 2249 | +++ ubuntuone/storageprotocol/dircontent.proto 2010-02-17 23:29:10 +0000 |
| 2250 | @@ -17,6 +17,9 @@ |
| 2251 | */ |
| 2252 | package ubuntuone.storageprotocol; |
| 2253 | |
| 2254 | +option java_package = "com.ubuntuone.storageprotocol"; |
| 2255 | +option java_outer_classname = "DirectoryContentProtocol"; |
| 2256 | + |
| 2257 | enum NodeType { |
| 2258 | DIRECTORY = 0; |
| 2259 | FILE = 1; |
| 2260 | |
| 2261 | === modified file 'ubuntuone/storageprotocol/dircontent.py' |
| 2262 | --- ubuntuone/storageprotocol/dircontent.py 2009-08-11 16:00:00 +0000 |
| 2263 | +++ ubuntuone/storageprotocol/dircontent.py 2010-02-17 23:29:10 +0000 |
| 2264 | @@ -27,7 +27,7 @@ |
| 2265 | DirectoryContent, DIRECTORY, FILE, SYMLINK |
| 2266 | |
| 2267 | ILLEGAL_FILENAMES = [u".", u".."] |
| 2268 | -ILLEGAL_FILENAME_CHARS_RE_SOURCE = r'[\000-\037:;*?\\/\177]' |
| 2269 | +ILLEGAL_FILENAME_CHARS_RE_SOURCE = r'[\000/]' |
| 2270 | ILLEGAL_FILENAME_CHARS_RE = re.compile(ILLEGAL_FILENAME_CHARS_RE_SOURCE) |
| 2271 | |
| 2272 | class InvalidFilename(Exception): |
| 2273 | |
| 2274 | === added file 'ubuntuone/storageprotocol/dircontent_pb2.py' |
| 2275 | --- ubuntuone/storageprotocol/dircontent_pb2.py 1970-01-01 00:00:00 +0000 |
| 2276 | +++ ubuntuone/storageprotocol/dircontent_pb2.py 2010-02-17 23:29:10 +0000 |
| 2277 | @@ -0,0 +1,105 @@ |
| 2278 | +# Generated by the protocol buffer compiler. DO NOT EDIT! |
| 2279 | + |
| 2280 | +from google.protobuf import descriptor |
| 2281 | +from google.protobuf import message |
| 2282 | +from google.protobuf import reflection |
| 2283 | +from google.protobuf import service |
| 2284 | +from google.protobuf import service_reflection |
| 2285 | +from google.protobuf import descriptor_pb2 |
| 2286 | +_NODETYPE = descriptor.EnumDescriptor( |
| 2287 | + name='NodeType', |
| 2288 | + full_name='ubuntuone.storageprotocol.NodeType', |
| 2289 | + filename='NodeType', |
| 2290 | + values=[ |
| 2291 | + descriptor.EnumValueDescriptor( |
| 2292 | + name='DIRECTORY', index=0, number=0, |
| 2293 | + options=None, |
| 2294 | + type=None), |
| 2295 | + descriptor.EnumValueDescriptor( |
| 2296 | + name='FILE', index=1, number=1, |
| 2297 | + options=None, |
| 2298 | + type=None), |
| 2299 | + descriptor.EnumValueDescriptor( |
| 2300 | + name='SYMLINK', index=2, number=2, |
| 2301 | + options=None, |
| 2302 | + type=None), |
| 2303 | + ], |
| 2304 | + options=None, |
| 2305 | +) |
| 2306 | + |
| 2307 | + |
| 2308 | +DIRECTORY = 0 |
| 2309 | +FILE = 1 |
| 2310 | +SYMLINK = 2 |
| 2311 | + |
| 2312 | + |
| 2313 | + |
| 2314 | +_DIRECTORYENTRY = descriptor.Descriptor( |
| 2315 | + name='DirectoryEntry', |
| 2316 | + full_name='ubuntuone.storageprotocol.DirectoryEntry', |
| 2317 | + filename='ubuntuone/storageprotocol/dircontent.proto', |
| 2318 | + containing_type=None, |
| 2319 | + fields=[ |
| 2320 | + descriptor.FieldDescriptor( |
| 2321 | + name='name', full_name='ubuntuone.storageprotocol.DirectoryEntry.name', index=0, |
| 2322 | + number=1, type=9, cpp_type=9, label=1, |
| 2323 | + default_value=unicode("", "utf-8"), |
| 2324 | + message_type=None, enum_type=None, containing_type=None, |
| 2325 | + is_extension=False, extension_scope=None, |
| 2326 | + options=None), |
| 2327 | + descriptor.FieldDescriptor( |
| 2328 | + name='node', full_name='ubuntuone.storageprotocol.DirectoryEntry.node', index=1, |
| 2329 | + number=2, type=12, cpp_type=9, label=1, |
| 2330 | + default_value="", |
| 2331 | + message_type=None, enum_type=None, containing_type=None, |
| 2332 | + is_extension=False, extension_scope=None, |
| 2333 | + options=None), |
| 2334 | + descriptor.FieldDescriptor( |
| 2335 | + name='node_type', full_name='ubuntuone.storageprotocol.DirectoryEntry.node_type', index=2, |
| 2336 | + number=3, type=14, cpp_type=8, label=1, |
| 2337 | + default_value=0, |
| 2338 | + message_type=None, enum_type=None, containing_type=None, |
| 2339 | + is_extension=False, extension_scope=None, |
| 2340 | + options=None), |
| 2341 | + ], |
| 2342 | + extensions=[ |
| 2343 | + ], |
| 2344 | + nested_types=[], # TODO(robinson): Implement. |
| 2345 | + enum_types=[ |
| 2346 | + ], |
| 2347 | + options=None) |
| 2348 | + |
| 2349 | + |
| 2350 | +_DIRECTORYCONTENT = descriptor.Descriptor( |
| 2351 | + name='DirectoryContent', |
| 2352 | + full_name='ubuntuone.storageprotocol.DirectoryContent', |
| 2353 | + filename='ubuntuone/storageprotocol/dircontent.proto', |
| 2354 | + containing_type=None, |
| 2355 | + fields=[ |
| 2356 | + descriptor.FieldDescriptor( |
| 2357 | + name='entries', full_name='ubuntuone.storageprotocol.DirectoryContent.entries', index=0, |
| 2358 | + number=1, type=11, cpp_type=10, label=3, |
| 2359 | + default_value=[], |
| 2360 | + message_type=None, enum_type=None, containing_type=None, |
| 2361 | + is_extension=False, extension_scope=None, |
| 2362 | + options=None), |
| 2363 | + ], |
| 2364 | + extensions=[ |
| 2365 | + ], |
| 2366 | + nested_types=[], # TODO(robinson): Implement. |
| 2367 | + enum_types=[ |
| 2368 | + ], |
| 2369 | + options=None) |
| 2370 | + |
| 2371 | + |
| 2372 | +_DIRECTORYENTRY.fields_by_name['node_type'].enum_type = _NODETYPE |
| 2373 | +_DIRECTORYCONTENT.fields_by_name['entries'].message_type = _DIRECTORYENTRY |
| 2374 | + |
| 2375 | +class DirectoryEntry(message.Message): |
| 2376 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 2377 | + DESCRIPTOR = _DIRECTORYENTRY |
| 2378 | + |
| 2379 | +class DirectoryContent(message.Message): |
| 2380 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 2381 | + DESCRIPTOR = _DIRECTORYCONTENT |
| 2382 | + |
| 2383 | |
| 2384 | === modified file 'ubuntuone/storageprotocol/protocol.proto' |
| 2385 | --- ubuntuone/storageprotocol/protocol.proto 2009-08-26 12:00:00 +0000 |
| 2386 | +++ ubuntuone/storageprotocol/protocol.proto 2010-02-17 23:29:10 +0000 |
| 2387 | @@ -17,9 +17,12 @@ |
| 2388 | */ |
| 2389 | package ubuntuone.storageprotocol; |
| 2390 | |
| 2391 | +option java_package = "com.ubuntuone.storageprotocol"; |
| 2392 | +option java_outer_classname = "StorageProtocol"; |
| 2393 | + |
| 2394 | message Message { |
| 2395 | required int32 id = 1; // A session-unique number identifying the |
| 2396 | - // request that started this exchange |
| 2397 | + // request that started this exchange |
| 2398 | |
| 2399 | enum MessageType { |
| 2400 | NOOP = 0; |
| 2401 | @@ -35,8 +38,8 @@ |
| 2402 | ROOT = 10; |
| 2403 | MAKE_DIR = 11; |
| 2404 | MAKE_FILE = 12; |
| 2405 | - NEW_DIR = 13; // answer to MAKE_DIR |
| 2406 | - NEW_FILE = 14; // answer to MAKE_FILE |
| 2407 | + NEW_DIR = 13; // answer to MAKE_DIR |
| 2408 | + NEW_FILE = 14; // answer to MAKE_FILE |
| 2409 | QUERY = 15; |
| 2410 | NODE_STATE = 16; |
| 2411 | QUERY_END = 17; |
| 2412 | @@ -47,24 +50,34 @@ |
| 2413 | EOF = 22; |
| 2414 | MOVE = 23; |
| 2415 | UNLINK = 24; |
| 2416 | - CREATE_SHARE = 25; |
| 2417 | - LIST_SHARES = 26; |
| 2418 | - SHARES_INFO = 27; // answer to LIST_SHARES, one message per share |
| 2419 | - SHARES_END = 28; // no more SHARES_INFO |
| 2420 | - NOTIFY_SHARE = 29; |
| 2421 | - SHARE_ACCEPTED = 30; |
| 2422 | - SHARE_DELETED = 31; |
| 2423 | + |
| 2424 | + CREATE_SHARE = 25; // enable the sharing for a given node |
| 2425 | + LIST_SHARES = 26; // list all the shares |
| 2426 | + SHARES_INFO = 27; // answer to LIST_SHARES, one message per share |
| 2427 | + SHARES_END = 28; // no more SHARES_INFO |
| 2428 | + NOTIFY_SHARE = 29; // notifies the presence of a new share |
| 2429 | + SHARE_ACCEPTED = 30; // notifies whether a share was accepted or not |
| 2430 | + SHARE_DELETED = 31; // answer to DELETE_SHARE (the share was disabled) |
| 2431 | + SHARE_CREATED = 34; // answer to CREATE_SHARE, returns share id |
| 2432 | + DELETE_SHARE = 36; // disable the sharing for a given node |
| 2433 | + |
| 2434 | + CREATE_UDF = 44; // register a new UDF against the server |
| 2435 | + LIST_VOLUMES = 45; // list all volumes (UDFs plus accepted shares) |
| 2436 | + VOLUMES_INFO = 46; // answer to LIST_VOLUMES, one message per volume |
| 2437 | + VOLUMES_END = 47; // no more VOLUMES_INFO |
| 2438 | + VOLUME_DELETED = 48; // answer to DELETE_VOLUME (the volume was deleted) |
| 2439 | + VOLUME_CREATED = 49; // answer to CREATE_UDF or a share was accepted |
| 2440 | + DELETE_VOLUME = 50; // removes the UDF and its files from the server |
| 2441 | + |
| 2442 | CANCEL_REQUEST = 32; |
| 2443 | NODE_ATTR = 33; |
| 2444 | - SHARE_CREATED = 34; |
| 2445 | CANCELLED = 35; |
| 2446 | - DELETE_SHARE = 36; |
| 2447 | - QUERY_CAPS = 37; // client2server, no commitment |
| 2448 | - SET_CAPS = 38; // client2server, commitment from the server |
| 2449 | - ACCEPT_CAPS = 39; // server2client, the answer for previous two |
| 2450 | - FREE_SPACE_INFO = 40; // answer to FREE_SPACE_INQUIRY |
| 2451 | + QUERY_CAPS = 37; // client2server, no commitment |
| 2452 | + SET_CAPS = 38; // client2server, commitment from the server |
| 2453 | + ACCEPT_CAPS = 39; // server2client, the answer for previous two |
| 2454 | + FREE_SPACE_INFO = 40; // answer to FREE_SPACE_INQUIRY |
| 2455 | FREE_SPACE_INQUIRY = 41; |
| 2456 | - ACCOUNT_INFO = 42; // answer to ACCOUNT_INQUIRY |
| 2457 | + ACCOUNT_INFO = 42; // answer to ACCOUNT_INQUIRY |
| 2458 | ACCOUNT_INQUIRY = 43; |
| 2459 | } |
| 2460 | |
| 2461 | @@ -91,7 +104,7 @@ |
| 2462 | optional CancelRequest cancel_request = 17; |
| 2463 | optional NodeAttr node_attr = 18; |
| 2464 | |
| 2465 | - // share management |
| 2466 | + // share, UDf and volume management |
| 2467 | optional CreateShare create_share = 19; |
| 2468 | optional Shares shares = 20; |
| 2469 | optional NotifyShare notify_share = 21; |
| 2470 | @@ -100,6 +113,12 @@ |
| 2471 | optional ShareCreated share_created = 24; |
| 2472 | optional DeleteShare delete_share = 25; |
| 2473 | |
| 2474 | + optional CreateUDF create_udf = 33; |
| 2475 | + optional Volumes list_volumes = 34; |
| 2476 | + optional VolumeDeleted volume_deleted = 35; |
| 2477 | + optional Volumes volume_created = 36; |
| 2478 | + optional DeleteVolume delete_volume = 37; |
| 2479 | + |
| 2480 | // caps |
| 2481 | repeated QueryCaps query_caps = 26; |
| 2482 | repeated SetCaps set_caps = 27; |
| 2483 | @@ -149,7 +168,7 @@ |
| 2484 | } |
| 2485 | |
| 2486 | message Make { |
| 2487 | - optional bytes share = 1; |
| 2488 | + optional bytes share = 1; // share is actually a volume id |
| 2489 | optional bytes parent_node = 2; |
| 2490 | optional string name = 3; |
| 2491 | } |
| 2492 | @@ -303,6 +322,47 @@ |
| 2493 | optional string share_id = 1; |
| 2494 | } |
| 2495 | |
| 2496 | +message CreateUDF { |
| 2497 | + // path and name should be encoded with utf8 |
| 2498 | + optional string path = 1; |
| 2499 | + optional string name = 2; |
| 2500 | +} |
| 2501 | + |
| 2502 | +message UDFs { |
| 2503 | + optional bytes volume = 1; |
| 2504 | + optional bytes node = 2; |
| 2505 | + // suggested path should be encoded with utf8 |
| 2506 | + optional string suggested_path = 3; |
| 2507 | +} |
| 2508 | + |
| 2509 | +message VolumeDeleted { |
| 2510 | + optional bytes volume = 1; |
| 2511 | +} |
| 2512 | + |
| 2513 | +message DeleteVolume { |
| 2514 | + optional bytes volume = 1; |
| 2515 | +} |
| 2516 | + |
| 2517 | +message Volumes { |
| 2518 | + |
| 2519 | + enum VolumeType { |
| 2520 | + ROOT = 1; |
| 2521 | + SHARE = 2; |
| 2522 | + UDF = 3; |
| 2523 | + } |
| 2524 | + |
| 2525 | + optional VolumeType type = 1; |
| 2526 | + |
| 2527 | + // specific for a Root |
| 2528 | + optional Root root = 3; |
| 2529 | + |
| 2530 | + // specific for a UDF |
| 2531 | + optional UDFs udf = 4; |
| 2532 | + |
| 2533 | + // specific for share with direction "to me" and already accepted |
| 2534 | + optional Shares share = 5; |
| 2535 | +} |
| 2536 | + |
| 2537 | message QueryCaps { |
| 2538 | optional string capability = 1; |
| 2539 | } |
| 2540 | |
| 2541 | === added file 'ubuntuone/storageprotocol/protocol_pb2.py' |
| 2542 | --- ubuntuone/storageprotocol/protocol_pb2.py 1970-01-01 00:00:00 +0000 |
| 2543 | +++ ubuntuone/storageprotocol/protocol_pb2.py 2010-02-17 23:29:10 +0000 |
| 2544 | @@ -0,0 +1,2018 @@ |
| 2545 | +# Generated by the protocol buffer compiler. DO NOT EDIT! |
| 2546 | + |
| 2547 | +from google.protobuf import descriptor |
| 2548 | +from google.protobuf import message |
| 2549 | +from google.protobuf import reflection |
| 2550 | +from google.protobuf import service |
| 2551 | +from google.protobuf import service_reflection |
| 2552 | +from google.protobuf import descriptor_pb2 |
| 2553 | + |
| 2554 | + |
| 2555 | +_MESSAGE_MESSAGETYPE = descriptor.EnumDescriptor( |
| 2556 | + name='MessageType', |
| 2557 | + full_name='ubuntuone.storageprotocol.Message.MessageType', |
| 2558 | + filename='MessageType', |
| 2559 | + values=[ |
| 2560 | + descriptor.EnumValueDescriptor( |
| 2561 | + name='NOOP', index=0, number=0, |
| 2562 | + options=None, |
| 2563 | + type=None), |
| 2564 | + descriptor.EnumValueDescriptor( |
| 2565 | + name='ERROR', index=1, number=1, |
| 2566 | + options=None, |
| 2567 | + type=None), |
| 2568 | + descriptor.EnumValueDescriptor( |
| 2569 | + name='OK', index=2, number=2, |
| 2570 | + options=None, |
| 2571 | + type=None), |
| 2572 | + descriptor.EnumValueDescriptor( |
| 2573 | + name='PING', index=3, number=3, |
| 2574 | + options=None, |
| 2575 | + type=None), |
| 2576 | + descriptor.EnumValueDescriptor( |
| 2577 | + name='PONG', index=4, number=4, |
| 2578 | + options=None, |
| 2579 | + type=None), |
| 2580 | + descriptor.EnumValueDescriptor( |
| 2581 | + name='PROTOCOL_VERSION', index=5, number=5, |
| 2582 | + options=None, |
| 2583 | + type=None), |
| 2584 | + descriptor.EnumValueDescriptor( |
| 2585 | + name='AUTH_REQUEST', index=6, number=6, |
| 2586 | + options=None, |
| 2587 | + type=None), |
| 2588 | + descriptor.EnumValueDescriptor( |
| 2589 | + name='AUTH_REQUEST_TOKEN', index=7, number=7, |
| 2590 | + options=None, |
| 2591 | + type=None), |
| 2592 | + descriptor.EnumValueDescriptor( |
| 2593 | + name='AUTH_REQUEST_TOKEN_READY', index=8, number=8, |
| 2594 | + options=None, |
| 2595 | + type=None), |
| 2596 | + descriptor.EnumValueDescriptor( |
| 2597 | + name='AUTH_AUTHENTICATED', index=9, number=9, |
| 2598 | + options=None, |
| 2599 | + type=None), |
| 2600 | + descriptor.EnumValueDescriptor( |
| 2601 | + name='ROOT', index=10, number=10, |
| 2602 | + options=None, |
| 2603 | + type=None), |
| 2604 | + descriptor.EnumValueDescriptor( |
| 2605 | + name='MAKE_DIR', index=11, number=11, |
| 2606 | + options=None, |
| 2607 | + type=None), |
| 2608 | + descriptor.EnumValueDescriptor( |
| 2609 | + name='MAKE_FILE', index=12, number=12, |
| 2610 | + options=None, |
| 2611 | + type=None), |
| 2612 | + descriptor.EnumValueDescriptor( |
| 2613 | + name='NEW_DIR', index=13, number=13, |
| 2614 | + options=None, |
| 2615 | + type=None), |
| 2616 | + descriptor.EnumValueDescriptor( |
| 2617 | + name='NEW_FILE', index=14, number=14, |
| 2618 | + options=None, |
| 2619 | + type=None), |
| 2620 | + descriptor.EnumValueDescriptor( |
| 2621 | + name='QUERY', index=15, number=15, |
| 2622 | + options=None, |
| 2623 | + type=None), |
| 2624 | + descriptor.EnumValueDescriptor( |
| 2625 | + name='NODE_STATE', index=16, number=16, |
| 2626 | + options=None, |
| 2627 | + type=None), |
| 2628 | + descriptor.EnumValueDescriptor( |
| 2629 | + name='QUERY_END', index=17, number=17, |
| 2630 | + options=None, |
| 2631 | + type=None), |
| 2632 | + descriptor.EnumValueDescriptor( |
| 2633 | + name='GET_CONTENT', index=18, number=18, |
| 2634 | + options=None, |
| 2635 | + type=None), |
| 2636 | + descriptor.EnumValueDescriptor( |
| 2637 | + name='PUT_CONTENT', index=19, number=19, |
| 2638 | + options=None, |
| 2639 | + type=None), |
| 2640 | + descriptor.EnumValueDescriptor( |
| 2641 | + name='BEGIN_CONTENT', index=20, number=20, |
| 2642 | + options=None, |
| 2643 | + type=None), |
| 2644 | + descriptor.EnumValueDescriptor( |
| 2645 | + name='BYTES', index=21, number=21, |
| 2646 | + options=None, |
| 2647 | + type=None), |
| 2648 | + descriptor.EnumValueDescriptor( |
| 2649 | + name='EOF', index=22, number=22, |
| 2650 | + options=None, |
| 2651 | + type=None), |
| 2652 | + descriptor.EnumValueDescriptor( |
| 2653 | + name='MOVE', index=23, number=23, |
| 2654 | + options=None, |
| 2655 | + type=None), |
| 2656 | + descriptor.EnumValueDescriptor( |
| 2657 | + name='UNLINK', index=24, number=24, |
| 2658 | + options=None, |
| 2659 | + type=None), |
| 2660 | + descriptor.EnumValueDescriptor( |
| 2661 | + name='CREATE_SHARE', index=25, number=25, |
| 2662 | + options=None, |
| 2663 | + type=None), |
| 2664 | + descriptor.EnumValueDescriptor( |
| 2665 | + name='LIST_SHARES', index=26, number=26, |
| 2666 | + options=None, |
| 2667 | + type=None), |
| 2668 | + descriptor.EnumValueDescriptor( |
| 2669 | + name='SHARES_INFO', index=27, number=27, |
| 2670 | + options=None, |
| 2671 | + type=None), |
| 2672 | + descriptor.EnumValueDescriptor( |
| 2673 | + name='SHARES_END', index=28, number=28, |
| 2674 | + options=None, |
| 2675 | + type=None), |
| 2676 | + descriptor.EnumValueDescriptor( |
| 2677 | + name='NOTIFY_SHARE', index=29, number=29, |
| 2678 | + options=None, |
| 2679 | + type=None), |
| 2680 | + descriptor.EnumValueDescriptor( |
| 2681 | + name='SHARE_ACCEPTED', index=30, number=30, |
| 2682 | + options=None, |
| 2683 | + type=None), |
| 2684 | + descriptor.EnumValueDescriptor( |
| 2685 | + name='SHARE_DELETED', index=31, number=31, |
| 2686 | + options=None, |
| 2687 | + type=None), |
| 2688 | + descriptor.EnumValueDescriptor( |
| 2689 | + name='SHARE_CREATED', index=32, number=34, |
| 2690 | + options=None, |
| 2691 | + type=None), |
| 2692 | + descriptor.EnumValueDescriptor( |
| 2693 | + name='DELETE_SHARE', index=33, number=36, |
| 2694 | + options=None, |
| 2695 | + type=None), |
| 2696 | + descriptor.EnumValueDescriptor( |
| 2697 | + name='CREATE_UDF', index=34, number=44, |
| 2698 | + options=None, |
| 2699 | + type=None), |
| 2700 | + descriptor.EnumValueDescriptor( |
| 2701 | + name='LIST_VOLUMES', index=35, number=45, |
| 2702 | + options=None, |
| 2703 | + type=None), |
| 2704 | + descriptor.EnumValueDescriptor( |
| 2705 | + name='VOLUMES_INFO', index=36, number=46, |
| 2706 | + options=None, |
| 2707 | + type=None), |
| 2708 | + descriptor.EnumValueDescriptor( |
| 2709 | + name='VOLUMES_END', index=37, number=47, |
| 2710 | + options=None, |
| 2711 | + type=None), |
| 2712 | + descriptor.EnumValueDescriptor( |
| 2713 | + name='VOLUME_DELETED', index=38, number=48, |
| 2714 | + options=None, |
| 2715 | + type=None), |
| 2716 | + descriptor.EnumValueDescriptor( |
| 2717 | + name='VOLUME_CREATED', index=39, number=49, |
| 2718 | + options=None, |
| 2719 | + type=None), |
| 2720 | + descriptor.EnumValueDescriptor( |
| 2721 | + name='DELETE_VOLUME', index=40, number=50, |
| 2722 | + options=None, |
| 2723 | + type=None), |
| 2724 | + descriptor.EnumValueDescriptor( |
| 2725 | + name='CANCEL_REQUEST', index=41, number=32, |
| 2726 | + options=None, |
| 2727 | + type=None), |
| 2728 | + descriptor.EnumValueDescriptor( |
| 2729 | + name='NODE_ATTR', index=42, number=33, |
| 2730 | + options=None, |
| 2731 | + type=None), |
| 2732 | + descriptor.EnumValueDescriptor( |
| 2733 | + name='CANCELLED', index=43, number=35, |
| 2734 | + options=None, |
| 2735 | + type=None), |
| 2736 | + descriptor.EnumValueDescriptor( |
| 2737 | + name='QUERY_CAPS', index=44, number=37, |
| 2738 | + options=None, |
| 2739 | + type=None), |
| 2740 | + descriptor.EnumValueDescriptor( |
| 2741 | + name='SET_CAPS', index=45, number=38, |
| 2742 | + options=None, |
| 2743 | + type=None), |
| 2744 | + descriptor.EnumValueDescriptor( |
| 2745 | + name='ACCEPT_CAPS', index=46, number=39, |
| 2746 | + options=None, |
| 2747 | + type=None), |
| 2748 | + descriptor.EnumValueDescriptor( |
| 2749 | + name='FREE_SPACE_INFO', index=47, number=40, |
| 2750 | + options=None, |
| 2751 | + type=None), |
| 2752 | + descriptor.EnumValueDescriptor( |
| 2753 | + name='FREE_SPACE_INQUIRY', index=48, number=41, |
| 2754 | + options=None, |
| 2755 | + type=None), |
| 2756 | + descriptor.EnumValueDescriptor( |
| 2757 | + name='ACCOUNT_INFO', index=49, number=42, |
| 2758 | + options=None, |
| 2759 | + type=None), |
| 2760 | + descriptor.EnumValueDescriptor( |
| 2761 | + name='ACCOUNT_INQUIRY', index=50, number=43, |
| 2762 | + options=None, |
| 2763 | + type=None), |
| 2764 | + ], |
| 2765 | + options=None, |
| 2766 | +) |
| 2767 | + |
| 2768 | +_ERROR_ERRORTYPE = descriptor.EnumDescriptor( |
| 2769 | + name='ErrorType', |
| 2770 | + full_name='ubuntuone.storageprotocol.Error.ErrorType', |
| 2771 | + filename='ErrorType', |
| 2772 | + values=[ |
| 2773 | + descriptor.EnumValueDescriptor( |
| 2774 | + name='UNSUPPORTED_VERSION', index=0, number=0, |
| 2775 | + options=None, |
| 2776 | + type=None), |
| 2777 | + descriptor.EnumValueDescriptor( |
| 2778 | + name='AUTHENTICATION_FAILED', index=1, number=1, |
| 2779 | + options=None, |
| 2780 | + type=None), |
| 2781 | + descriptor.EnumValueDescriptor( |
| 2782 | + name='INTERNAL_ERROR', index=2, number=2, |
| 2783 | + options=None, |
| 2784 | + type=None), |
| 2785 | + descriptor.EnumValueDescriptor( |
| 2786 | + name='AUTHENTICATION_REQUIRED', index=3, number=3, |
| 2787 | + options=None, |
| 2788 | + type=None), |
| 2789 | + descriptor.EnumValueDescriptor( |
| 2790 | + name='NO_PERMISSION', index=4, number=4, |
| 2791 | + options=None, |
| 2792 | + type=None), |
| 2793 | + descriptor.EnumValueDescriptor( |
| 2794 | + name='ALREADY_EXISTS', index=5, number=5, |
| 2795 | + options=None, |
| 2796 | + type=None), |
| 2797 | + descriptor.EnumValueDescriptor( |
| 2798 | + name='DOES_NOT_EXIST', index=6, number=6, |
| 2799 | + options=None, |
| 2800 | + type=None), |
| 2801 | + descriptor.EnumValueDescriptor( |
| 2802 | + name='NOT_A_DIRECTORY', index=7, number=7, |
| 2803 | + options=None, |
| 2804 | + type=None), |
| 2805 | + descriptor.EnumValueDescriptor( |
| 2806 | + name='NOT_EMPTY', index=8, number=8, |
| 2807 | + options=None, |
| 2808 | + type=None), |
| 2809 | + descriptor.EnumValueDescriptor( |
| 2810 | + name='NOT_AVAILABLE', index=9, number=9, |
| 2811 | + options=None, |
| 2812 | + type=None), |
| 2813 | + descriptor.EnumValueDescriptor( |
| 2814 | + name='UPLOAD_IN_PROGRESS', index=10, number=10, |
| 2815 | + options=None, |
| 2816 | + type=None), |
| 2817 | + descriptor.EnumValueDescriptor( |
| 2818 | + name='UPLOAD_CORRUPT', index=11, number=11, |
| 2819 | + options=None, |
| 2820 | + type=None), |
| 2821 | + descriptor.EnumValueDescriptor( |
| 2822 | + name='UPLOAD_CANCELED', index=12, number=12, |
| 2823 | + options=None, |
| 2824 | + type=None), |
| 2825 | + descriptor.EnumValueDescriptor( |
| 2826 | + name='CONFLICT', index=13, number=13, |
| 2827 | + options=None, |
| 2828 | + type=None), |
| 2829 | + descriptor.EnumValueDescriptor( |
| 2830 | + name='TRY_AGAIN', index=14, number=14, |
| 2831 | + options=None, |
| 2832 | + type=None), |
| 2833 | + descriptor.EnumValueDescriptor( |
| 2834 | + name='PROTOCOL_ERROR', index=15, number=15, |
| 2835 | + options=None, |
| 2836 | + type=None), |
| 2837 | + descriptor.EnumValueDescriptor( |
| 2838 | + name='QUOTA_EXCEEDED', index=16, number=16, |
| 2839 | + options=None, |
| 2840 | + type=None), |
| 2841 | + descriptor.EnumValueDescriptor( |
| 2842 | + name='INVALID_FILENAME', index=17, number=17, |
| 2843 | + options=None, |
| 2844 | + type=None), |
| 2845 | + ], |
| 2846 | + options=None, |
| 2847 | +) |
| 2848 | + |
| 2849 | +_CREATESHARE_ACCESSLEVEL = descriptor.EnumDescriptor( |
| 2850 | + name='AccessLevel', |
| 2851 | + full_name='ubuntuone.storageprotocol.CreateShare.AccessLevel', |
| 2852 | + filename='AccessLevel', |
| 2853 | + values=[ |
| 2854 | + descriptor.EnumValueDescriptor( |
| 2855 | + name='VIEW', index=0, number=0, |
| 2856 | + options=None, |
| 2857 | + type=None), |
| 2858 | + descriptor.EnumValueDescriptor( |
| 2859 | + name='MODIFY', index=1, number=1, |
| 2860 | + options=None, |
| 2861 | + type=None), |
| 2862 | + ], |
| 2863 | + options=None, |
| 2864 | +) |
| 2865 | + |
| 2866 | +_SHARES_DIRECTION = descriptor.EnumDescriptor( |
| 2867 | + name='Direction', |
| 2868 | + full_name='ubuntuone.storageprotocol.Shares.Direction', |
| 2869 | + filename='Direction', |
| 2870 | + values=[ |
| 2871 | + descriptor.EnumValueDescriptor( |
| 2872 | + name='TO_ME', index=0, number=0, |
| 2873 | + options=None, |
| 2874 | + type=None), |
| 2875 | + descriptor.EnumValueDescriptor( |
| 2876 | + name='FROM_ME', index=1, number=1, |
| 2877 | + options=None, |
| 2878 | + type=None), |
| 2879 | + ], |
| 2880 | + options=None, |
| 2881 | +) |
| 2882 | + |
| 2883 | +_SHARES_ACCESSLEVEL = descriptor.EnumDescriptor( |
| 2884 | + name='AccessLevel', |
| 2885 | + full_name='ubuntuone.storageprotocol.Shares.AccessLevel', |
| 2886 | + filename='AccessLevel', |
| 2887 | + values=[ |
| 2888 | + descriptor.EnumValueDescriptor( |
| 2889 | + name='VIEW', index=0, number=0, |
| 2890 | + options=None, |
| 2891 | + type=None), |
| 2892 | + descriptor.EnumValueDescriptor( |
| 2893 | + name='MODIFY', index=1, number=1, |
| 2894 | + options=None, |
| 2895 | + type=None), |
| 2896 | + ], |
| 2897 | + options=None, |
| 2898 | +) |
| 2899 | + |
| 2900 | +_NOTIFYSHARE_ACCESSLEVEL = descriptor.EnumDescriptor( |
| 2901 | + name='AccessLevel', |
| 2902 | + full_name='ubuntuone.storageprotocol.NotifyShare.AccessLevel', |
| 2903 | + filename='AccessLevel', |
| 2904 | + values=[ |
| 2905 | + descriptor.EnumValueDescriptor( |
| 2906 | + name='VIEW', index=0, number=0, |
| 2907 | + options=None, |
| 2908 | + type=None), |
| 2909 | + descriptor.EnumValueDescriptor( |
| 2910 | + name='MODIFY', index=1, number=1, |
| 2911 | + options=None, |
| 2912 | + type=None), |
| 2913 | + ], |
| 2914 | + options=None, |
| 2915 | +) |
| 2916 | + |
| 2917 | +_SHAREACCEPTED_ANSWER = descriptor.EnumDescriptor( |
| 2918 | + name='Answer', |
| 2919 | + full_name='ubuntuone.storageprotocol.ShareAccepted.Answer', |
| 2920 | + filename='Answer', |
| 2921 | + values=[ |
| 2922 | + descriptor.EnumValueDescriptor( |
| 2923 | + name='YES', index=0, number=0, |
| 2924 | + options=None, |
| 2925 | + type=None), |
| 2926 | + descriptor.EnumValueDescriptor( |
| 2927 | + name='NO', index=1, number=1, |
| 2928 | + options=None, |
| 2929 | + type=None), |
| 2930 | + ], |
| 2931 | + options=None, |
| 2932 | +) |
| 2933 | + |
| 2934 | +_VOLUMES_VOLUMETYPE = descriptor.EnumDescriptor( |
| 2935 | + name='VolumeType', |
| 2936 | + full_name='ubuntuone.storageprotocol.Volumes.VolumeType', |
| 2937 | + filename='VolumeType', |
| 2938 | + values=[ |
| 2939 | + descriptor.EnumValueDescriptor( |
| 2940 | + name='ROOT', index=0, number=1, |
| 2941 | + options=None, |
| 2942 | + type=None), |
| 2943 | + descriptor.EnumValueDescriptor( |
| 2944 | + name='SHARE', index=1, number=2, |
| 2945 | + options=None, |
| 2946 | + type=None), |
| 2947 | + descriptor.EnumValueDescriptor( |
| 2948 | + name='UDF', index=2, number=3, |
| 2949 | + options=None, |
| 2950 | + type=None), |
| 2951 | + ], |
| 2952 | + options=None, |
| 2953 | +) |
| 2954 | + |
| 2955 | + |
| 2956 | +_MESSAGE = descriptor.Descriptor( |
| 2957 | + name='Message', |
| 2958 | + full_name='ubuntuone.storageprotocol.Message', |
| 2959 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 2960 | + containing_type=None, |
| 2961 | + fields=[ |
| 2962 | + descriptor.FieldDescriptor( |
| 2963 | + name='id', full_name='ubuntuone.storageprotocol.Message.id', index=0, |
| 2964 | + number=1, type=5, cpp_type=1, label=2, |
| 2965 | + default_value=0, |
| 2966 | + message_type=None, enum_type=None, containing_type=None, |
| 2967 | + is_extension=False, extension_scope=None, |
| 2968 | + options=None), |
| 2969 | + descriptor.FieldDescriptor( |
| 2970 | + name='type', full_name='ubuntuone.storageprotocol.Message.type', index=1, |
| 2971 | + number=2, type=14, cpp_type=8, label=2, |
| 2972 | + default_value=0, |
| 2973 | + message_type=None, enum_type=None, containing_type=None, |
| 2974 | + is_extension=False, extension_scope=None, |
| 2975 | + options=None), |
| 2976 | + descriptor.FieldDescriptor( |
| 2977 | + name='error', full_name='ubuntuone.storageprotocol.Message.error', index=2, |
| 2978 | + number=3, type=11, cpp_type=10, label=1, |
| 2979 | + default_value=None, |
| 2980 | + message_type=None, enum_type=None, containing_type=None, |
| 2981 | + is_extension=False, extension_scope=None, |
| 2982 | + options=None), |
| 2983 | + descriptor.FieldDescriptor( |
| 2984 | + name='protocol', full_name='ubuntuone.storageprotocol.Message.protocol', index=3, |
| 2985 | + number=4, type=11, cpp_type=10, label=1, |
| 2986 | + default_value=None, |
| 2987 | + message_type=None, enum_type=None, containing_type=None, |
| 2988 | + is_extension=False, extension_scope=None, |
| 2989 | + options=None), |
| 2990 | + descriptor.FieldDescriptor( |
| 2991 | + name='auth_parameters', full_name='ubuntuone.storageprotocol.Message.auth_parameters', index=4, |
| 2992 | + number=5, type=11, cpp_type=10, label=3, |
| 2993 | + default_value=[], |
| 2994 | + message_type=None, enum_type=None, containing_type=None, |
| 2995 | + is_extension=False, extension_scope=None, |
| 2996 | + options=None), |
| 2997 | + descriptor.FieldDescriptor( |
| 2998 | + name='root', full_name='ubuntuone.storageprotocol.Message.root', index=5, |
| 2999 | + number=6, type=11, cpp_type=10, label=1, |
| 3000 | + default_value=None, |
| 3001 | + message_type=None, enum_type=None, containing_type=None, |
| 3002 | + is_extension=False, extension_scope=None, |
| 3003 | + options=None), |
| 3004 | + descriptor.FieldDescriptor( |
| 3005 | + name='query', full_name='ubuntuone.storageprotocol.Message.query', index=6, |
| 3006 | + number=7, type=11, cpp_type=10, label=3, |
| 3007 | + default_value=[], |
| 3008 | + message_type=None, enum_type=None, containing_type=None, |
| 3009 | + is_extension=False, extension_scope=None, |
| 3010 | + options=None), |
| 3011 | + descriptor.FieldDescriptor( |
| 3012 | + name='node_state', full_name='ubuntuone.storageprotocol.Message.node_state', index=7, |
| 3013 | + number=8, type=11, cpp_type=10, label=1, |
| 3014 | + default_value=None, |
| 3015 | + message_type=None, enum_type=None, containing_type=None, |
| 3016 | + is_extension=False, extension_scope=None, |
| 3017 | + options=None), |
| 3018 | + descriptor.FieldDescriptor( |
| 3019 | + name='make', full_name='ubuntuone.storageprotocol.Message.make', index=8, |
| 3020 | + number=9, type=11, cpp_type=10, label=1, |
| 3021 | + default_value=None, |
| 3022 | + message_type=None, enum_type=None, containing_type=None, |
| 3023 | + is_extension=False, extension_scope=None, |
| 3024 | + options=None), |
| 3025 | + descriptor.FieldDescriptor( |
| 3026 | + name='new', full_name='ubuntuone.storageprotocol.Message.new', index=9, |
| 3027 | + number=10, type=11, cpp_type=10, label=1, |
| 3028 | + default_value=None, |
| 3029 | + message_type=None, enum_type=None, containing_type=None, |
| 3030 | + is_extension=False, extension_scope=None, |
| 3031 | + options=None), |
| 3032 | + descriptor.FieldDescriptor( |
| 3033 | + name='move', full_name='ubuntuone.storageprotocol.Message.move', index=10, |
| 3034 | + number=11, type=11, cpp_type=10, label=1, |
| 3035 | + default_value=None, |
| 3036 | + message_type=None, enum_type=None, containing_type=None, |
| 3037 | + is_extension=False, extension_scope=None, |
| 3038 | + options=None), |
| 3039 | + descriptor.FieldDescriptor( |
| 3040 | + name='get_content', full_name='ubuntuone.storageprotocol.Message.get_content', index=11, |
| 3041 | + number=12, type=11, cpp_type=10, label=1, |
| 3042 | + default_value=None, |
| 3043 | + message_type=None, enum_type=None, containing_type=None, |
| 3044 | + is_extension=False, extension_scope=None, |
| 3045 | + options=None), |
| 3046 | + descriptor.FieldDescriptor( |
| 3047 | + name='put_content', full_name='ubuntuone.storageprotocol.Message.put_content', index=12, |
| 3048 | + number=13, type=11, cpp_type=10, label=1, |
| 3049 | + default_value=None, |
| 3050 | + message_type=None, enum_type=None, containing_type=None, |
| 3051 | + is_extension=False, extension_scope=None, |
| 3052 | + options=None), |
| 3053 | + descriptor.FieldDescriptor( |
| 3054 | + name='upload_in_progress', full_name='ubuntuone.storageprotocol.Message.upload_in_progress', index=13, |
| 3055 | + number=14, type=11, cpp_type=10, label=1, |
| 3056 | + default_value=None, |
| 3057 | + message_type=None, enum_type=None, containing_type=None, |
| 3058 | + is_extension=False, extension_scope=None, |
| 3059 | + options=None), |
| 3060 | + descriptor.FieldDescriptor( |
| 3061 | + name='bytes', full_name='ubuntuone.storageprotocol.Message.bytes', index=14, |
| 3062 | + number=15, type=11, cpp_type=10, label=1, |
| 3063 | + default_value=None, |
| 3064 | + message_type=None, enum_type=None, containing_type=None, |
| 3065 | + is_extension=False, extension_scope=None, |
| 3066 | + options=None), |
| 3067 | + descriptor.FieldDescriptor( |
| 3068 | + name='unlink', full_name='ubuntuone.storageprotocol.Message.unlink', index=15, |
| 3069 | + number=16, type=11, cpp_type=10, label=1, |
| 3070 | + default_value=None, |
| 3071 | + message_type=None, enum_type=None, containing_type=None, |
| 3072 | + is_extension=False, extension_scope=None, |
| 3073 | + options=None), |
| 3074 | + descriptor.FieldDescriptor( |
| 3075 | + name='cancel_request', full_name='ubuntuone.storageprotocol.Message.cancel_request', index=16, |
| 3076 | + number=17, type=11, cpp_type=10, label=1, |
| 3077 | + default_value=None, |
| 3078 | + message_type=None, enum_type=None, containing_type=None, |
| 3079 | + is_extension=False, extension_scope=None, |
| 3080 | + options=None), |
| 3081 | + descriptor.FieldDescriptor( |
| 3082 | + name='node_attr', full_name='ubuntuone.storageprotocol.Message.node_attr', index=17, |
| 3083 | + number=18, type=11, cpp_type=10, label=1, |
| 3084 | + default_value=None, |
| 3085 | + message_type=None, enum_type=None, containing_type=None, |
| 3086 | + is_extension=False, extension_scope=None, |
| 3087 | + options=None), |
| 3088 | + descriptor.FieldDescriptor( |
| 3089 | + name='create_share', full_name='ubuntuone.storageprotocol.Message.create_share', index=18, |
| 3090 | + number=19, type=11, cpp_type=10, label=1, |
| 3091 | + default_value=None, |
| 3092 | + message_type=None, enum_type=None, containing_type=None, |
| 3093 | + is_extension=False, extension_scope=None, |
| 3094 | + options=None), |
| 3095 | + descriptor.FieldDescriptor( |
| 3096 | + name='shares', full_name='ubuntuone.storageprotocol.Message.shares', index=19, |
| 3097 | + number=20, type=11, cpp_type=10, label=1, |
| 3098 | + default_value=None, |
| 3099 | + message_type=None, enum_type=None, containing_type=None, |
| 3100 | + is_extension=False, extension_scope=None, |
| 3101 | + options=None), |
| 3102 | + descriptor.FieldDescriptor( |
| 3103 | + name='notify_share', full_name='ubuntuone.storageprotocol.Message.notify_share', index=20, |
| 3104 | + number=21, type=11, cpp_type=10, label=1, |
| 3105 | + default_value=None, |
| 3106 | + message_type=None, enum_type=None, containing_type=None, |
| 3107 | + is_extension=False, extension_scope=None, |
| 3108 | + options=None), |
| 3109 | + descriptor.FieldDescriptor( |
| 3110 | + name='share_accepted', full_name='ubuntuone.storageprotocol.Message.share_accepted', index=21, |
| 3111 | + number=22, type=11, cpp_type=10, label=1, |
| 3112 | + default_value=None, |
| 3113 | + message_type=None, enum_type=None, containing_type=None, |
| 3114 | + is_extension=False, extension_scope=None, |
| 3115 | + options=None), |
| 3116 | + descriptor.FieldDescriptor( |
| 3117 | + name='share_deleted', full_name='ubuntuone.storageprotocol.Message.share_deleted', index=22, |
| 3118 | + number=23, type=11, cpp_type=10, label=1, |
| 3119 | + default_value=None, |
| 3120 | + message_type=None, enum_type=None, containing_type=None, |
| 3121 | + is_extension=False, extension_scope=None, |
| 3122 | + options=None), |
| 3123 | + descriptor.FieldDescriptor( |
| 3124 | + name='share_created', full_name='ubuntuone.storageprotocol.Message.share_created', index=23, |
| 3125 | + number=24, type=11, cpp_type=10, label=1, |
| 3126 | + default_value=None, |
| 3127 | + message_type=None, enum_type=None, containing_type=None, |
| 3128 | + is_extension=False, extension_scope=None, |
| 3129 | + options=None), |
| 3130 | + descriptor.FieldDescriptor( |
| 3131 | + name='delete_share', full_name='ubuntuone.storageprotocol.Message.delete_share', index=24, |
| 3132 | + number=25, type=11, cpp_type=10, label=1, |
| 3133 | + default_value=None, |
| 3134 | + message_type=None, enum_type=None, containing_type=None, |
| 3135 | + is_extension=False, extension_scope=None, |
| 3136 | + options=None), |
| 3137 | + descriptor.FieldDescriptor( |
| 3138 | + name='create_udf', full_name='ubuntuone.storageprotocol.Message.create_udf', index=25, |
| 3139 | + number=33, type=11, cpp_type=10, label=1, |
| 3140 | + default_value=None, |
| 3141 | + message_type=None, enum_type=None, containing_type=None, |
| 3142 | + is_extension=False, extension_scope=None, |
| 3143 | + options=None), |
| 3144 | + descriptor.FieldDescriptor( |
| 3145 | + name='list_volumes', full_name='ubuntuone.storageprotocol.Message.list_volumes', index=26, |
| 3146 | + number=34, type=11, cpp_type=10, label=1, |
| 3147 | + default_value=None, |
| 3148 | + message_type=None, enum_type=None, containing_type=None, |
| 3149 | + is_extension=False, extension_scope=None, |
| 3150 | + options=None), |
| 3151 | + descriptor.FieldDescriptor( |
| 3152 | + name='volume_deleted', full_name='ubuntuone.storageprotocol.Message.volume_deleted', index=27, |
| 3153 | + number=35, type=11, cpp_type=10, label=1, |
| 3154 | + default_value=None, |
| 3155 | + message_type=None, enum_type=None, containing_type=None, |
| 3156 | + is_extension=False, extension_scope=None, |
| 3157 | + options=None), |
| 3158 | + descriptor.FieldDescriptor( |
| 3159 | + name='volume_created', full_name='ubuntuone.storageprotocol.Message.volume_created', index=28, |
| 3160 | + number=36, type=11, cpp_type=10, label=1, |
| 3161 | + default_value=None, |
| 3162 | + message_type=None, enum_type=None, containing_type=None, |
| 3163 | + is_extension=False, extension_scope=None, |
| 3164 | + options=None), |
| 3165 | + descriptor.FieldDescriptor( |
| 3166 | + name='delete_volume', full_name='ubuntuone.storageprotocol.Message.delete_volume', index=29, |
| 3167 | + number=37, type=11, cpp_type=10, label=1, |
| 3168 | + default_value=None, |
| 3169 | + message_type=None, enum_type=None, containing_type=None, |
| 3170 | + is_extension=False, extension_scope=None, |
| 3171 | + options=None), |
| 3172 | + descriptor.FieldDescriptor( |
| 3173 | + name='query_caps', full_name='ubuntuone.storageprotocol.Message.query_caps', index=30, |
| 3174 | + number=26, type=11, cpp_type=10, label=3, |
| 3175 | + default_value=[], |
| 3176 | + message_type=None, enum_type=None, containing_type=None, |
| 3177 | + is_extension=False, extension_scope=None, |
| 3178 | + options=None), |
| 3179 | + descriptor.FieldDescriptor( |
| 3180 | + name='set_caps', full_name='ubuntuone.storageprotocol.Message.set_caps', index=31, |
| 3181 | + number=27, type=11, cpp_type=10, label=3, |
| 3182 | + default_value=[], |
| 3183 | + message_type=None, enum_type=None, containing_type=None, |
| 3184 | + is_extension=False, extension_scope=None, |
| 3185 | + options=None), |
| 3186 | + descriptor.FieldDescriptor( |
| 3187 | + name='accept_caps', full_name='ubuntuone.storageprotocol.Message.accept_caps', index=32, |
| 3188 | + number=28, type=11, cpp_type=10, label=1, |
| 3189 | + default_value=None, |
| 3190 | + message_type=None, enum_type=None, containing_type=None, |
| 3191 | + is_extension=False, extension_scope=None, |
| 3192 | + options=None), |
| 3193 | + descriptor.FieldDescriptor( |
| 3194 | + name='free_space_info', full_name='ubuntuone.storageprotocol.Message.free_space_info', index=33, |
| 3195 | + number=29, type=11, cpp_type=10, label=1, |
| 3196 | + default_value=None, |
| 3197 | + message_type=None, enum_type=None, containing_type=None, |
| 3198 | + is_extension=False, extension_scope=None, |
| 3199 | + options=None), |
| 3200 | + descriptor.FieldDescriptor( |
| 3201 | + name='free_space_inquiry', full_name='ubuntuone.storageprotocol.Message.free_space_inquiry', index=34, |
| 3202 | + number=30, type=11, cpp_type=10, label=1, |
| 3203 | + default_value=None, |
| 3204 | + message_type=None, enum_type=None, containing_type=None, |
| 3205 | + is_extension=False, extension_scope=None, |
| 3206 | + options=None), |
| 3207 | + descriptor.FieldDescriptor( |
| 3208 | + name='account_info', full_name='ubuntuone.storageprotocol.Message.account_info', index=35, |
| 3209 | + number=31, type=11, cpp_type=10, label=1, |
| 3210 | + default_value=None, |
| 3211 | + message_type=None, enum_type=None, containing_type=None, |
| 3212 | + is_extension=False, extension_scope=None, |
| 3213 | + options=None), |
| 3214 | + descriptor.FieldDescriptor( |
| 3215 | + name='begin_content', full_name='ubuntuone.storageprotocol.Message.begin_content', index=36, |
| 3216 | + number=32, type=11, cpp_type=10, label=1, |
| 3217 | + default_value=None, |
| 3218 | + message_type=None, enum_type=None, containing_type=None, |
| 3219 | + is_extension=False, extension_scope=None, |
| 3220 | + options=None), |
| 3221 | + ], |
| 3222 | + extensions=[ |
| 3223 | + ], |
| 3224 | + nested_types=[], # TODO(robinson): Implement. |
| 3225 | + enum_types=[ |
| 3226 | + _MESSAGE_MESSAGETYPE, |
| 3227 | + ], |
| 3228 | + options=None) |
| 3229 | + |
| 3230 | + |
| 3231 | +_ERROR = descriptor.Descriptor( |
| 3232 | + name='Error', |
| 3233 | + full_name='ubuntuone.storageprotocol.Error', |
| 3234 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3235 | + containing_type=None, |
| 3236 | + fields=[ |
| 3237 | + descriptor.FieldDescriptor( |
| 3238 | + name='type', full_name='ubuntuone.storageprotocol.Error.type', index=0, |
| 3239 | + number=1, type=14, cpp_type=8, label=2, |
| 3240 | + default_value=0, |
| 3241 | + message_type=None, enum_type=None, containing_type=None, |
| 3242 | + is_extension=False, extension_scope=None, |
| 3243 | + options=None), |
| 3244 | + descriptor.FieldDescriptor( |
| 3245 | + name='comment', full_name='ubuntuone.storageprotocol.Error.comment', index=1, |
| 3246 | + number=2, type=9, cpp_type=9, label=1, |
| 3247 | + default_value=unicode("", "utf-8"), |
| 3248 | + message_type=None, enum_type=None, containing_type=None, |
| 3249 | + is_extension=False, extension_scope=None, |
| 3250 | + options=None), |
| 3251 | + ], |
| 3252 | + extensions=[ |
| 3253 | + ], |
| 3254 | + nested_types=[], # TODO(robinson): Implement. |
| 3255 | + enum_types=[ |
| 3256 | + _ERROR_ERRORTYPE, |
| 3257 | + ], |
| 3258 | + options=None) |
| 3259 | + |
| 3260 | + |
| 3261 | +_PROTOCOL = descriptor.Descriptor( |
| 3262 | + name='Protocol', |
| 3263 | + full_name='ubuntuone.storageprotocol.Protocol', |
| 3264 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3265 | + containing_type=None, |
| 3266 | + fields=[ |
| 3267 | + descriptor.FieldDescriptor( |
| 3268 | + name='version', full_name='ubuntuone.storageprotocol.Protocol.version', index=0, |
| 3269 | + number=1, type=5, cpp_type=1, label=2, |
| 3270 | + default_value=0, |
| 3271 | + message_type=None, enum_type=None, containing_type=None, |
| 3272 | + is_extension=False, extension_scope=None, |
| 3273 | + options=None), |
| 3274 | + ], |
| 3275 | + extensions=[ |
| 3276 | + ], |
| 3277 | + nested_types=[], # TODO(robinson): Implement. |
| 3278 | + enum_types=[ |
| 3279 | + ], |
| 3280 | + options=None) |
| 3281 | + |
| 3282 | + |
| 3283 | +_AUTHPARAMETER = descriptor.Descriptor( |
| 3284 | + name='AuthParameter', |
| 3285 | + full_name='ubuntuone.storageprotocol.AuthParameter', |
| 3286 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3287 | + containing_type=None, |
| 3288 | + fields=[ |
| 3289 | + descriptor.FieldDescriptor( |
| 3290 | + name='name', full_name='ubuntuone.storageprotocol.AuthParameter.name', index=0, |
| 3291 | + number=1, type=9, cpp_type=9, label=2, |
| 3292 | + default_value=unicode("", "utf-8"), |
| 3293 | + message_type=None, enum_type=None, containing_type=None, |
| 3294 | + is_extension=False, extension_scope=None, |
| 3295 | + options=None), |
| 3296 | + descriptor.FieldDescriptor( |
| 3297 | + name='value', full_name='ubuntuone.storageprotocol.AuthParameter.value', index=1, |
| 3298 | + number=2, type=9, cpp_type=9, label=2, |
| 3299 | + default_value=unicode("", "utf-8"), |
| 3300 | + message_type=None, enum_type=None, containing_type=None, |
| 3301 | + is_extension=False, extension_scope=None, |
| 3302 | + options=None), |
| 3303 | + ], |
| 3304 | + extensions=[ |
| 3305 | + ], |
| 3306 | + nested_types=[], # TODO(robinson): Implement. |
| 3307 | + enum_types=[ |
| 3308 | + ], |
| 3309 | + options=None) |
| 3310 | + |
| 3311 | + |
| 3312 | +_MAKE = descriptor.Descriptor( |
| 3313 | + name='Make', |
| 3314 | + full_name='ubuntuone.storageprotocol.Make', |
| 3315 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3316 | + containing_type=None, |
| 3317 | + fields=[ |
| 3318 | + descriptor.FieldDescriptor( |
| 3319 | + name='share', full_name='ubuntuone.storageprotocol.Make.share', index=0, |
| 3320 | + number=1, type=12, cpp_type=9, label=1, |
| 3321 | + default_value="", |
| 3322 | + message_type=None, enum_type=None, containing_type=None, |
| 3323 | + is_extension=False, extension_scope=None, |
| 3324 | + options=None), |
| 3325 | + descriptor.FieldDescriptor( |
| 3326 | + name='parent_node', full_name='ubuntuone.storageprotocol.Make.parent_node', index=1, |
| 3327 | + number=2, type=12, cpp_type=9, label=1, |
| 3328 | + default_value="", |
| 3329 | + message_type=None, enum_type=None, containing_type=None, |
| 3330 | + is_extension=False, extension_scope=None, |
| 3331 | + options=None), |
| 3332 | + descriptor.FieldDescriptor( |
| 3333 | + name='name', full_name='ubuntuone.storageprotocol.Make.name', index=2, |
| 3334 | + number=3, type=9, cpp_type=9, label=1, |
| 3335 | + default_value=unicode("", "utf-8"), |
| 3336 | + message_type=None, enum_type=None, containing_type=None, |
| 3337 | + is_extension=False, extension_scope=None, |
| 3338 | + options=None), |
| 3339 | + ], |
| 3340 | + extensions=[ |
| 3341 | + ], |
| 3342 | + nested_types=[], # TODO(robinson): Implement. |
| 3343 | + enum_types=[ |
| 3344 | + ], |
| 3345 | + options=None) |
| 3346 | + |
| 3347 | + |
| 3348 | +_NEW = descriptor.Descriptor( |
| 3349 | + name='New', |
| 3350 | + full_name='ubuntuone.storageprotocol.New', |
| 3351 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3352 | + containing_type=None, |
| 3353 | + fields=[ |
| 3354 | + descriptor.FieldDescriptor( |
| 3355 | + name='node', full_name='ubuntuone.storageprotocol.New.node', index=0, |
| 3356 | + number=1, type=12, cpp_type=9, label=1, |
| 3357 | + default_value="", |
| 3358 | + message_type=None, enum_type=None, containing_type=None, |
| 3359 | + is_extension=False, extension_scope=None, |
| 3360 | + options=None), |
| 3361 | + descriptor.FieldDescriptor( |
| 3362 | + name='parent_node', full_name='ubuntuone.storageprotocol.New.parent_node', index=1, |
| 3363 | + number=2, type=12, cpp_type=9, label=1, |
| 3364 | + default_value="", |
| 3365 | + message_type=None, enum_type=None, containing_type=None, |
| 3366 | + is_extension=False, extension_scope=None, |
| 3367 | + options=None), |
| 3368 | + descriptor.FieldDescriptor( |
| 3369 | + name='name', full_name='ubuntuone.storageprotocol.New.name', index=2, |
| 3370 | + number=3, type=9, cpp_type=9, label=1, |
| 3371 | + default_value=unicode("", "utf-8"), |
| 3372 | + message_type=None, enum_type=None, containing_type=None, |
| 3373 | + is_extension=False, extension_scope=None, |
| 3374 | + options=None), |
| 3375 | + ], |
| 3376 | + extensions=[ |
| 3377 | + ], |
| 3378 | + nested_types=[], # TODO(robinson): Implement. |
| 3379 | + enum_types=[ |
| 3380 | + ], |
| 3381 | + options=None) |
| 3382 | + |
| 3383 | + |
| 3384 | +_ROOT = descriptor.Descriptor( |
| 3385 | + name='Root', |
| 3386 | + full_name='ubuntuone.storageprotocol.Root', |
| 3387 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3388 | + containing_type=None, |
| 3389 | + fields=[ |
| 3390 | + descriptor.FieldDescriptor( |
| 3391 | + name='node', full_name='ubuntuone.storageprotocol.Root.node', index=0, |
| 3392 | + number=1, type=12, cpp_type=9, label=1, |
| 3393 | + default_value="", |
| 3394 | + message_type=None, enum_type=None, containing_type=None, |
| 3395 | + is_extension=False, extension_scope=None, |
| 3396 | + options=None), |
| 3397 | + ], |
| 3398 | + extensions=[ |
| 3399 | + ], |
| 3400 | + nested_types=[], # TODO(robinson): Implement. |
| 3401 | + enum_types=[ |
| 3402 | + ], |
| 3403 | + options=None) |
| 3404 | + |
| 3405 | + |
| 3406 | +_QUERY = descriptor.Descriptor( |
| 3407 | + name='Query', |
| 3408 | + full_name='ubuntuone.storageprotocol.Query', |
| 3409 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3410 | + containing_type=None, |
| 3411 | + fields=[ |
| 3412 | + descriptor.FieldDescriptor( |
| 3413 | + name='share', full_name='ubuntuone.storageprotocol.Query.share', index=0, |
| 3414 | + number=1, type=12, cpp_type=9, label=1, |
| 3415 | + default_value="", |
| 3416 | + message_type=None, enum_type=None, containing_type=None, |
| 3417 | + is_extension=False, extension_scope=None, |
| 3418 | + options=None), |
| 3419 | + descriptor.FieldDescriptor( |
| 3420 | + name='node', full_name='ubuntuone.storageprotocol.Query.node', index=1, |
| 3421 | + number=2, type=12, cpp_type=9, label=1, |
| 3422 | + default_value="", |
| 3423 | + message_type=None, enum_type=None, containing_type=None, |
| 3424 | + is_extension=False, extension_scope=None, |
| 3425 | + options=None), |
| 3426 | + descriptor.FieldDescriptor( |
| 3427 | + name='hash', full_name='ubuntuone.storageprotocol.Query.hash', index=2, |
| 3428 | + number=3, type=12, cpp_type=9, label=1, |
| 3429 | + default_value="", |
| 3430 | + message_type=None, enum_type=None, containing_type=None, |
| 3431 | + is_extension=False, extension_scope=None, |
| 3432 | + options=None), |
| 3433 | + ], |
| 3434 | + extensions=[ |
| 3435 | + ], |
| 3436 | + nested_types=[], # TODO(robinson): Implement. |
| 3437 | + enum_types=[ |
| 3438 | + ], |
| 3439 | + options=None) |
| 3440 | + |
| 3441 | + |
| 3442 | +_NODESTATE = descriptor.Descriptor( |
| 3443 | + name='NodeState', |
| 3444 | + full_name='ubuntuone.storageprotocol.NodeState', |
| 3445 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3446 | + containing_type=None, |
| 3447 | + fields=[ |
| 3448 | + descriptor.FieldDescriptor( |
| 3449 | + name='share', full_name='ubuntuone.storageprotocol.NodeState.share', index=0, |
| 3450 | + number=1, type=12, cpp_type=9, label=1, |
| 3451 | + default_value="", |
| 3452 | + message_type=None, enum_type=None, containing_type=None, |
| 3453 | + is_extension=False, extension_scope=None, |
| 3454 | + options=None), |
| 3455 | + descriptor.FieldDescriptor( |
| 3456 | + name='node', full_name='ubuntuone.storageprotocol.NodeState.node', index=1, |
| 3457 | + number=2, type=12, cpp_type=9, label=1, |
| 3458 | + default_value="", |
| 3459 | + message_type=None, enum_type=None, containing_type=None, |
| 3460 | + is_extension=False, extension_scope=None, |
| 3461 | + options=None), |
| 3462 | + descriptor.FieldDescriptor( |
| 3463 | + name='hash', full_name='ubuntuone.storageprotocol.NodeState.hash', index=2, |
| 3464 | + number=3, type=12, cpp_type=9, label=1, |
| 3465 | + default_value="", |
| 3466 | + message_type=None, enum_type=None, containing_type=None, |
| 3467 | + is_extension=False, extension_scope=None, |
| 3468 | + options=None), |
| 3469 | + ], |
| 3470 | + extensions=[ |
| 3471 | + ], |
| 3472 | + nested_types=[], # TODO(robinson): Implement. |
| 3473 | + enum_types=[ |
| 3474 | + ], |
| 3475 | + options=None) |
| 3476 | + |
| 3477 | + |
| 3478 | +_GETCONTENT = descriptor.Descriptor( |
| 3479 | + name='GetContent', |
| 3480 | + full_name='ubuntuone.storageprotocol.GetContent', |
| 3481 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3482 | + containing_type=None, |
| 3483 | + fields=[ |
| 3484 | + descriptor.FieldDescriptor( |
| 3485 | + name='share', full_name='ubuntuone.storageprotocol.GetContent.share', index=0, |
| 3486 | + number=1, type=12, cpp_type=9, label=1, |
| 3487 | + default_value="", |
| 3488 | + message_type=None, enum_type=None, containing_type=None, |
| 3489 | + is_extension=False, extension_scope=None, |
| 3490 | + options=None), |
| 3491 | + descriptor.FieldDescriptor( |
| 3492 | + name='node', full_name='ubuntuone.storageprotocol.GetContent.node', index=1, |
| 3493 | + number=2, type=12, cpp_type=9, label=1, |
| 3494 | + default_value="", |
| 3495 | + message_type=None, enum_type=None, containing_type=None, |
| 3496 | + is_extension=False, extension_scope=None, |
| 3497 | + options=None), |
| 3498 | + descriptor.FieldDescriptor( |
| 3499 | + name='hash', full_name='ubuntuone.storageprotocol.GetContent.hash', index=2, |
| 3500 | + number=3, type=12, cpp_type=9, label=1, |
| 3501 | + default_value="", |
| 3502 | + message_type=None, enum_type=None, containing_type=None, |
| 3503 | + is_extension=False, extension_scope=None, |
| 3504 | + options=None), |
| 3505 | + descriptor.FieldDescriptor( |
| 3506 | + name='offset', full_name='ubuntuone.storageprotocol.GetContent.offset', index=3, |
| 3507 | + number=4, type=3, cpp_type=2, label=1, |
| 3508 | + default_value=0, |
| 3509 | + message_type=None, enum_type=None, containing_type=None, |
| 3510 | + is_extension=False, extension_scope=None, |
| 3511 | + options=None), |
| 3512 | + ], |
| 3513 | + extensions=[ |
| 3514 | + ], |
| 3515 | + nested_types=[], # TODO(robinson): Implement. |
| 3516 | + enum_types=[ |
| 3517 | + ], |
| 3518 | + options=None) |
| 3519 | + |
| 3520 | + |
| 3521 | +_CANCELREQUEST = descriptor.Descriptor( |
| 3522 | + name='CancelRequest', |
| 3523 | + full_name='ubuntuone.storageprotocol.CancelRequest', |
| 3524 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3525 | + containing_type=None, |
| 3526 | + fields=[ |
| 3527 | + ], |
| 3528 | + extensions=[ |
| 3529 | + ], |
| 3530 | + nested_types=[], # TODO(robinson): Implement. |
| 3531 | + enum_types=[ |
| 3532 | + ], |
| 3533 | + options=None) |
| 3534 | + |
| 3535 | + |
| 3536 | +_NODEATTR = descriptor.Descriptor( |
| 3537 | + name='NodeAttr', |
| 3538 | + full_name='ubuntuone.storageprotocol.NodeAttr', |
| 3539 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3540 | + containing_type=None, |
| 3541 | + fields=[ |
| 3542 | + descriptor.FieldDescriptor( |
| 3543 | + name='deflated_size', full_name='ubuntuone.storageprotocol.NodeAttr.deflated_size', index=0, |
| 3544 | + number=1, type=4, cpp_type=4, label=1, |
| 3545 | + default_value=0, |
| 3546 | + message_type=None, enum_type=None, containing_type=None, |
| 3547 | + is_extension=False, extension_scope=None, |
| 3548 | + options=None), |
| 3549 | + descriptor.FieldDescriptor( |
| 3550 | + name='size', full_name='ubuntuone.storageprotocol.NodeAttr.size', index=1, |
| 3551 | + number=2, type=4, cpp_type=4, label=1, |
| 3552 | + default_value=0, |
| 3553 | + message_type=None, enum_type=None, containing_type=None, |
| 3554 | + is_extension=False, extension_scope=None, |
| 3555 | + options=None), |
| 3556 | + descriptor.FieldDescriptor( |
| 3557 | + name='hash', full_name='ubuntuone.storageprotocol.NodeAttr.hash', index=2, |
| 3558 | + number=3, type=12, cpp_type=9, label=1, |
| 3559 | + default_value="", |
| 3560 | + message_type=None, enum_type=None, containing_type=None, |
| 3561 | + is_extension=False, extension_scope=None, |
| 3562 | + options=None), |
| 3563 | + descriptor.FieldDescriptor( |
| 3564 | + name='crc32', full_name='ubuntuone.storageprotocol.NodeAttr.crc32', index=3, |
| 3565 | + number=4, type=13, cpp_type=3, label=1, |
| 3566 | + default_value=0, |
| 3567 | + message_type=None, enum_type=None, containing_type=None, |
| 3568 | + is_extension=False, extension_scope=None, |
| 3569 | + options=None), |
| 3570 | + ], |
| 3571 | + extensions=[ |
| 3572 | + ], |
| 3573 | + nested_types=[], # TODO(robinson): Implement. |
| 3574 | + enum_types=[ |
| 3575 | + ], |
| 3576 | + options=None) |
| 3577 | + |
| 3578 | + |
| 3579 | +_BYTES = descriptor.Descriptor( |
| 3580 | + name='Bytes', |
| 3581 | + full_name='ubuntuone.storageprotocol.Bytes', |
| 3582 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3583 | + containing_type=None, |
| 3584 | + fields=[ |
| 3585 | + descriptor.FieldDescriptor( |
| 3586 | + name='bytes', full_name='ubuntuone.storageprotocol.Bytes.bytes', index=0, |
| 3587 | + number=1, type=12, cpp_type=9, label=1, |
| 3588 | + default_value="", |
| 3589 | + message_type=None, enum_type=None, containing_type=None, |
| 3590 | + is_extension=False, extension_scope=None, |
| 3591 | + options=None), |
| 3592 | + ], |
| 3593 | + extensions=[ |
| 3594 | + ], |
| 3595 | + nested_types=[], # TODO(robinson): Implement. |
| 3596 | + enum_types=[ |
| 3597 | + ], |
| 3598 | + options=None) |
| 3599 | + |
| 3600 | + |
| 3601 | +_PUTCONTENT = descriptor.Descriptor( |
| 3602 | + name='PutContent', |
| 3603 | + full_name='ubuntuone.storageprotocol.PutContent', |
| 3604 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3605 | + containing_type=None, |
| 3606 | + fields=[ |
| 3607 | + descriptor.FieldDescriptor( |
| 3608 | + name='share', full_name='ubuntuone.storageprotocol.PutContent.share', index=0, |
| 3609 | + number=1, type=12, cpp_type=9, label=1, |
| 3610 | + default_value="", |
| 3611 | + message_type=None, enum_type=None, containing_type=None, |
| 3612 | + is_extension=False, extension_scope=None, |
| 3613 | + options=None), |
| 3614 | + descriptor.FieldDescriptor( |
| 3615 | + name='node', full_name='ubuntuone.storageprotocol.PutContent.node', index=1, |
| 3616 | + number=2, type=12, cpp_type=9, label=1, |
| 3617 | + default_value="", |
| 3618 | + message_type=None, enum_type=None, containing_type=None, |
| 3619 | + is_extension=False, extension_scope=None, |
| 3620 | + options=None), |
| 3621 | + descriptor.FieldDescriptor( |
| 3622 | + name='previous_hash', full_name='ubuntuone.storageprotocol.PutContent.previous_hash', index=2, |
| 3623 | + number=3, type=12, cpp_type=9, label=1, |
| 3624 | + default_value="", |
| 3625 | + message_type=None, enum_type=None, containing_type=None, |
| 3626 | + is_extension=False, extension_scope=None, |
| 3627 | + options=None), |
| 3628 | + descriptor.FieldDescriptor( |
| 3629 | + name='hash', full_name='ubuntuone.storageprotocol.PutContent.hash', index=3, |
| 3630 | + number=4, type=12, cpp_type=9, label=1, |
| 3631 | + default_value="", |
| 3632 | + message_type=None, enum_type=None, containing_type=None, |
| 3633 | + is_extension=False, extension_scope=None, |
| 3634 | + options=None), |
| 3635 | + descriptor.FieldDescriptor( |
| 3636 | + name='crc32', full_name='ubuntuone.storageprotocol.PutContent.crc32', index=4, |
| 3637 | + number=5, type=13, cpp_type=3, label=1, |
| 3638 | + default_value=0, |
| 3639 | + message_type=None, enum_type=None, containing_type=None, |
| 3640 | + is_extension=False, extension_scope=None, |
| 3641 | + options=None), |
| 3642 | + descriptor.FieldDescriptor( |
| 3643 | + name='size', full_name='ubuntuone.storageprotocol.PutContent.size', index=5, |
| 3644 | + number=6, type=4, cpp_type=4, label=1, |
| 3645 | + default_value=0, |
| 3646 | + message_type=None, enum_type=None, containing_type=None, |
| 3647 | + is_extension=False, extension_scope=None, |
| 3648 | + options=None), |
| 3649 | + descriptor.FieldDescriptor( |
| 3650 | + name='deflated_size', full_name='ubuntuone.storageprotocol.PutContent.deflated_size', index=6, |
| 3651 | + number=7, type=4, cpp_type=4, label=1, |
| 3652 | + default_value=0, |
| 3653 | + message_type=None, enum_type=None, containing_type=None, |
| 3654 | + is_extension=False, extension_scope=None, |
| 3655 | + options=None), |
| 3656 | + ], |
| 3657 | + extensions=[ |
| 3658 | + ], |
| 3659 | + nested_types=[], # TODO(robinson): Implement. |
| 3660 | + enum_types=[ |
| 3661 | + ], |
| 3662 | + options=None) |
| 3663 | + |
| 3664 | + |
| 3665 | +_BEGINCONTENT = descriptor.Descriptor( |
| 3666 | + name='BeginContent', |
| 3667 | + full_name='ubuntuone.storageprotocol.BeginContent', |
| 3668 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3669 | + containing_type=None, |
| 3670 | + fields=[ |
| 3671 | + descriptor.FieldDescriptor( |
| 3672 | + name='offset', full_name='ubuntuone.storageprotocol.BeginContent.offset', index=0, |
| 3673 | + number=2, type=4, cpp_type=4, label=1, |
| 3674 | + default_value=0, |
| 3675 | + message_type=None, enum_type=None, containing_type=None, |
| 3676 | + is_extension=False, extension_scope=None, |
| 3677 | + options=None), |
| 3678 | + ], |
| 3679 | + extensions=[ |
| 3680 | + ], |
| 3681 | + nested_types=[], # TODO(robinson): Implement. |
| 3682 | + enum_types=[ |
| 3683 | + ], |
| 3684 | + options=None) |
| 3685 | + |
| 3686 | + |
| 3687 | +_UPLOADINPROGRESS = descriptor.Descriptor( |
| 3688 | + name='UploadInProgress', |
| 3689 | + full_name='ubuntuone.storageprotocol.UploadInProgress', |
| 3690 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3691 | + containing_type=None, |
| 3692 | + fields=[ |
| 3693 | + descriptor.FieldDescriptor( |
| 3694 | + name='upload', full_name='ubuntuone.storageprotocol.UploadInProgress.upload', index=0, |
| 3695 | + number=1, type=12, cpp_type=9, label=1, |
| 3696 | + default_value="", |
| 3697 | + message_type=None, enum_type=None, containing_type=None, |
| 3698 | + is_extension=False, extension_scope=None, |
| 3699 | + options=None), |
| 3700 | + descriptor.FieldDescriptor( |
| 3701 | + name='timestamp', full_name='ubuntuone.storageprotocol.UploadInProgress.timestamp', index=1, |
| 3702 | + number=2, type=5, cpp_type=1, label=1, |
| 3703 | + default_value=0, |
| 3704 | + message_type=None, enum_type=None, containing_type=None, |
| 3705 | + is_extension=False, extension_scope=None, |
| 3706 | + options=None), |
| 3707 | + ], |
| 3708 | + extensions=[ |
| 3709 | + ], |
| 3710 | + nested_types=[], # TODO(robinson): Implement. |
| 3711 | + enum_types=[ |
| 3712 | + ], |
| 3713 | + options=None) |
| 3714 | + |
| 3715 | + |
| 3716 | +_MOVE = descriptor.Descriptor( |
| 3717 | + name='Move', |
| 3718 | + full_name='ubuntuone.storageprotocol.Move', |
| 3719 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3720 | + containing_type=None, |
| 3721 | + fields=[ |
| 3722 | + descriptor.FieldDescriptor( |
| 3723 | + name='share', full_name='ubuntuone.storageprotocol.Move.share', index=0, |
| 3724 | + number=1, type=12, cpp_type=9, label=1, |
| 3725 | + default_value="", |
| 3726 | + message_type=None, enum_type=None, containing_type=None, |
| 3727 | + is_extension=False, extension_scope=None, |
| 3728 | + options=None), |
| 3729 | + descriptor.FieldDescriptor( |
| 3730 | + name='node', full_name='ubuntuone.storageprotocol.Move.node', index=1, |
| 3731 | + number=2, type=12, cpp_type=9, label=1, |
| 3732 | + default_value="", |
| 3733 | + message_type=None, enum_type=None, containing_type=None, |
| 3734 | + is_extension=False, extension_scope=None, |
| 3735 | + options=None), |
| 3736 | + descriptor.FieldDescriptor( |
| 3737 | + name='new_parent_node', full_name='ubuntuone.storageprotocol.Move.new_parent_node', index=2, |
| 3738 | + number=3, type=12, cpp_type=9, label=1, |
| 3739 | + default_value="", |
| 3740 | + message_type=None, enum_type=None, containing_type=None, |
| 3741 | + is_extension=False, extension_scope=None, |
| 3742 | + options=None), |
| 3743 | + descriptor.FieldDescriptor( |
| 3744 | + name='new_name', full_name='ubuntuone.storageprotocol.Move.new_name', index=3, |
| 3745 | + number=4, type=9, cpp_type=9, label=1, |
| 3746 | + default_value=unicode("", "utf-8"), |
| 3747 | + message_type=None, enum_type=None, containing_type=None, |
| 3748 | + is_extension=False, extension_scope=None, |
| 3749 | + options=None), |
| 3750 | + ], |
| 3751 | + extensions=[ |
| 3752 | + ], |
| 3753 | + nested_types=[], # TODO(robinson): Implement. |
| 3754 | + enum_types=[ |
| 3755 | + ], |
| 3756 | + options=None) |
| 3757 | + |
| 3758 | + |
| 3759 | +_UNLINK = descriptor.Descriptor( |
| 3760 | + name='Unlink', |
| 3761 | + full_name='ubuntuone.storageprotocol.Unlink', |
| 3762 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3763 | + containing_type=None, |
| 3764 | + fields=[ |
| 3765 | + descriptor.FieldDescriptor( |
| 3766 | + name='share', full_name='ubuntuone.storageprotocol.Unlink.share', index=0, |
| 3767 | + number=1, type=12, cpp_type=9, label=1, |
| 3768 | + default_value="", |
| 3769 | + message_type=None, enum_type=None, containing_type=None, |
| 3770 | + is_extension=False, extension_scope=None, |
| 3771 | + options=None), |
| 3772 | + descriptor.FieldDescriptor( |
| 3773 | + name='node', full_name='ubuntuone.storageprotocol.Unlink.node', index=1, |
| 3774 | + number=2, type=12, cpp_type=9, label=1, |
| 3775 | + default_value="", |
| 3776 | + message_type=None, enum_type=None, containing_type=None, |
| 3777 | + is_extension=False, extension_scope=None, |
| 3778 | + options=None), |
| 3779 | + ], |
| 3780 | + extensions=[ |
| 3781 | + ], |
| 3782 | + nested_types=[], # TODO(robinson): Implement. |
| 3783 | + enum_types=[ |
| 3784 | + ], |
| 3785 | + options=None) |
| 3786 | + |
| 3787 | + |
| 3788 | +_CREATESHARE = descriptor.Descriptor( |
| 3789 | + name='CreateShare', |
| 3790 | + full_name='ubuntuone.storageprotocol.CreateShare', |
| 3791 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3792 | + containing_type=None, |
| 3793 | + fields=[ |
| 3794 | + descriptor.FieldDescriptor( |
| 3795 | + name='node', full_name='ubuntuone.storageprotocol.CreateShare.node', index=0, |
| 3796 | + number=1, type=12, cpp_type=9, label=1, |
| 3797 | + default_value="", |
| 3798 | + message_type=None, enum_type=None, containing_type=None, |
| 3799 | + is_extension=False, extension_scope=None, |
| 3800 | + options=None), |
| 3801 | + descriptor.FieldDescriptor( |
| 3802 | + name='share_to', full_name='ubuntuone.storageprotocol.CreateShare.share_to', index=1, |
| 3803 | + number=2, type=9, cpp_type=9, label=1, |
| 3804 | + default_value=unicode("", "utf-8"), |
| 3805 | + message_type=None, enum_type=None, containing_type=None, |
| 3806 | + is_extension=False, extension_scope=None, |
| 3807 | + options=None), |
| 3808 | + descriptor.FieldDescriptor( |
| 3809 | + name='name', full_name='ubuntuone.storageprotocol.CreateShare.name', index=2, |
| 3810 | + number=3, type=9, cpp_type=9, label=1, |
| 3811 | + default_value=unicode("", "utf-8"), |
| 3812 | + message_type=None, enum_type=None, containing_type=None, |
| 3813 | + is_extension=False, extension_scope=None, |
| 3814 | + options=None), |
| 3815 | + descriptor.FieldDescriptor( |
| 3816 | + name='access_level', full_name='ubuntuone.storageprotocol.CreateShare.access_level', index=3, |
| 3817 | + number=4, type=14, cpp_type=8, label=1, |
| 3818 | + default_value=0, |
| 3819 | + message_type=None, enum_type=None, containing_type=None, |
| 3820 | + is_extension=False, extension_scope=None, |
| 3821 | + options=None), |
| 3822 | + ], |
| 3823 | + extensions=[ |
| 3824 | + ], |
| 3825 | + nested_types=[], # TODO(robinson): Implement. |
| 3826 | + enum_types=[ |
| 3827 | + _CREATESHARE_ACCESSLEVEL, |
| 3828 | + ], |
| 3829 | + options=None) |
| 3830 | + |
| 3831 | + |
| 3832 | +_SHARES = descriptor.Descriptor( |
| 3833 | + name='Shares', |
| 3834 | + full_name='ubuntuone.storageprotocol.Shares', |
| 3835 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3836 | + containing_type=None, |
| 3837 | + fields=[ |
| 3838 | + descriptor.FieldDescriptor( |
| 3839 | + name='share_id', full_name='ubuntuone.storageprotocol.Shares.share_id', index=0, |
| 3840 | + number=1, type=12, cpp_type=9, label=1, |
| 3841 | + default_value="", |
| 3842 | + message_type=None, enum_type=None, containing_type=None, |
| 3843 | + is_extension=False, extension_scope=None, |
| 3844 | + options=None), |
| 3845 | + descriptor.FieldDescriptor( |
| 3846 | + name='direction', full_name='ubuntuone.storageprotocol.Shares.direction', index=1, |
| 3847 | + number=2, type=14, cpp_type=8, label=1, |
| 3848 | + default_value=0, |
| 3849 | + message_type=None, enum_type=None, containing_type=None, |
| 3850 | + is_extension=False, extension_scope=None, |
| 3851 | + options=None), |
| 3852 | + descriptor.FieldDescriptor( |
| 3853 | + name='subtree', full_name='ubuntuone.storageprotocol.Shares.subtree', index=2, |
| 3854 | + number=3, type=12, cpp_type=9, label=1, |
| 3855 | + default_value="", |
| 3856 | + message_type=None, enum_type=None, containing_type=None, |
| 3857 | + is_extension=False, extension_scope=None, |
| 3858 | + options=None), |
| 3859 | + descriptor.FieldDescriptor( |
| 3860 | + name='share_name', full_name='ubuntuone.storageprotocol.Shares.share_name', index=3, |
| 3861 | + number=4, type=9, cpp_type=9, label=1, |
| 3862 | + default_value=unicode("", "utf-8"), |
| 3863 | + message_type=None, enum_type=None, containing_type=None, |
| 3864 | + is_extension=False, extension_scope=None, |
| 3865 | + options=None), |
| 3866 | + descriptor.FieldDescriptor( |
| 3867 | + name='other_username', full_name='ubuntuone.storageprotocol.Shares.other_username', index=4, |
| 3868 | + number=5, type=9, cpp_type=9, label=1, |
| 3869 | + default_value=unicode("", "utf-8"), |
| 3870 | + message_type=None, enum_type=None, containing_type=None, |
| 3871 | + is_extension=False, extension_scope=None, |
| 3872 | + options=None), |
| 3873 | + descriptor.FieldDescriptor( |
| 3874 | + name='other_visible_name', full_name='ubuntuone.storageprotocol.Shares.other_visible_name', index=5, |
| 3875 | + number=6, type=9, cpp_type=9, label=1, |
| 3876 | + default_value=unicode("", "utf-8"), |
| 3877 | + message_type=None, enum_type=None, containing_type=None, |
| 3878 | + is_extension=False, extension_scope=None, |
| 3879 | + options=None), |
| 3880 | + descriptor.FieldDescriptor( |
| 3881 | + name='accepted', full_name='ubuntuone.storageprotocol.Shares.accepted', index=6, |
| 3882 | + number=7, type=8, cpp_type=7, label=1, |
| 3883 | + default_value=False, |
| 3884 | + message_type=None, enum_type=None, containing_type=None, |
| 3885 | + is_extension=False, extension_scope=None, |
| 3886 | + options=None), |
| 3887 | + descriptor.FieldDescriptor( |
| 3888 | + name='access_level', full_name='ubuntuone.storageprotocol.Shares.access_level', index=7, |
| 3889 | + number=8, type=14, cpp_type=8, label=1, |
| 3890 | + default_value=0, |
| 3891 | + message_type=None, enum_type=None, containing_type=None, |
| 3892 | + is_extension=False, extension_scope=None, |
| 3893 | + options=None), |
| 3894 | + ], |
| 3895 | + extensions=[ |
| 3896 | + ], |
| 3897 | + nested_types=[], # TODO(robinson): Implement. |
| 3898 | + enum_types=[ |
| 3899 | + _SHARES_DIRECTION, |
| 3900 | + _SHARES_ACCESSLEVEL, |
| 3901 | + ], |
| 3902 | + options=None) |
| 3903 | + |
| 3904 | + |
| 3905 | +_NOTIFYSHARE = descriptor.Descriptor( |
| 3906 | + name='NotifyShare', |
| 3907 | + full_name='ubuntuone.storageprotocol.NotifyShare', |
| 3908 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3909 | + containing_type=None, |
| 3910 | + fields=[ |
| 3911 | + descriptor.FieldDescriptor( |
| 3912 | + name='share_id', full_name='ubuntuone.storageprotocol.NotifyShare.share_id', index=0, |
| 3913 | + number=1, type=9, cpp_type=9, label=1, |
| 3914 | + default_value=unicode("", "utf-8"), |
| 3915 | + message_type=None, enum_type=None, containing_type=None, |
| 3916 | + is_extension=False, extension_scope=None, |
| 3917 | + options=None), |
| 3918 | + descriptor.FieldDescriptor( |
| 3919 | + name='subtree', full_name='ubuntuone.storageprotocol.NotifyShare.subtree', index=1, |
| 3920 | + number=2, type=9, cpp_type=9, label=1, |
| 3921 | + default_value=unicode("", "utf-8"), |
| 3922 | + message_type=None, enum_type=None, containing_type=None, |
| 3923 | + is_extension=False, extension_scope=None, |
| 3924 | + options=None), |
| 3925 | + descriptor.FieldDescriptor( |
| 3926 | + name='share_name', full_name='ubuntuone.storageprotocol.NotifyShare.share_name', index=2, |
| 3927 | + number=3, type=9, cpp_type=9, label=1, |
| 3928 | + default_value=unicode("", "utf-8"), |
| 3929 | + message_type=None, enum_type=None, containing_type=None, |
| 3930 | + is_extension=False, extension_scope=None, |
| 3931 | + options=None), |
| 3932 | + descriptor.FieldDescriptor( |
| 3933 | + name='from_username', full_name='ubuntuone.storageprotocol.NotifyShare.from_username', index=3, |
| 3934 | + number=4, type=9, cpp_type=9, label=1, |
| 3935 | + default_value=unicode("", "utf-8"), |
| 3936 | + message_type=None, enum_type=None, containing_type=None, |
| 3937 | + is_extension=False, extension_scope=None, |
| 3938 | + options=None), |
| 3939 | + descriptor.FieldDescriptor( |
| 3940 | + name='from_visible_name', full_name='ubuntuone.storageprotocol.NotifyShare.from_visible_name', index=4, |
| 3941 | + number=5, type=9, cpp_type=9, label=1, |
| 3942 | + default_value=unicode("", "utf-8"), |
| 3943 | + message_type=None, enum_type=None, containing_type=None, |
| 3944 | + is_extension=False, extension_scope=None, |
| 3945 | + options=None), |
| 3946 | + descriptor.FieldDescriptor( |
| 3947 | + name='access_level', full_name='ubuntuone.storageprotocol.NotifyShare.access_level', index=5, |
| 3948 | + number=6, type=14, cpp_type=8, label=1, |
| 3949 | + default_value=0, |
| 3950 | + message_type=None, enum_type=None, containing_type=None, |
| 3951 | + is_extension=False, extension_scope=None, |
| 3952 | + options=None), |
| 3953 | + ], |
| 3954 | + extensions=[ |
| 3955 | + ], |
| 3956 | + nested_types=[], # TODO(robinson): Implement. |
| 3957 | + enum_types=[ |
| 3958 | + _NOTIFYSHARE_ACCESSLEVEL, |
| 3959 | + ], |
| 3960 | + options=None) |
| 3961 | + |
| 3962 | + |
| 3963 | +_SHAREACCEPTED = descriptor.Descriptor( |
| 3964 | + name='ShareAccepted', |
| 3965 | + full_name='ubuntuone.storageprotocol.ShareAccepted', |
| 3966 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3967 | + containing_type=None, |
| 3968 | + fields=[ |
| 3969 | + descriptor.FieldDescriptor( |
| 3970 | + name='share_id', full_name='ubuntuone.storageprotocol.ShareAccepted.share_id', index=0, |
| 3971 | + number=1, type=9, cpp_type=9, label=1, |
| 3972 | + default_value=unicode("", "utf-8"), |
| 3973 | + message_type=None, enum_type=None, containing_type=None, |
| 3974 | + is_extension=False, extension_scope=None, |
| 3975 | + options=None), |
| 3976 | + descriptor.FieldDescriptor( |
| 3977 | + name='answer', full_name='ubuntuone.storageprotocol.ShareAccepted.answer', index=1, |
| 3978 | + number=2, type=14, cpp_type=8, label=1, |
| 3979 | + default_value=0, |
| 3980 | + message_type=None, enum_type=None, containing_type=None, |
| 3981 | + is_extension=False, extension_scope=None, |
| 3982 | + options=None), |
| 3983 | + ], |
| 3984 | + extensions=[ |
| 3985 | + ], |
| 3986 | + nested_types=[], # TODO(robinson): Implement. |
| 3987 | + enum_types=[ |
| 3988 | + _SHAREACCEPTED_ANSWER, |
| 3989 | + ], |
| 3990 | + options=None) |
| 3991 | + |
| 3992 | + |
| 3993 | +_SHAREDELETED = descriptor.Descriptor( |
| 3994 | + name='ShareDeleted', |
| 3995 | + full_name='ubuntuone.storageprotocol.ShareDeleted', |
| 3996 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 3997 | + containing_type=None, |
| 3998 | + fields=[ |
| 3999 | + descriptor.FieldDescriptor( |
| 4000 | + name='share_id', full_name='ubuntuone.storageprotocol.ShareDeleted.share_id', index=0, |
| 4001 | + number=1, type=9, cpp_type=9, label=1, |
| 4002 | + default_value=unicode("", "utf-8"), |
| 4003 | + message_type=None, enum_type=None, containing_type=None, |
| 4004 | + is_extension=False, extension_scope=None, |
| 4005 | + options=None), |
| 4006 | + ], |
| 4007 | + extensions=[ |
| 4008 | + ], |
| 4009 | + nested_types=[], # TODO(robinson): Implement. |
| 4010 | + enum_types=[ |
| 4011 | + ], |
| 4012 | + options=None) |
| 4013 | + |
| 4014 | + |
| 4015 | +_SHARECREATED = descriptor.Descriptor( |
| 4016 | + name='ShareCreated', |
| 4017 | + full_name='ubuntuone.storageprotocol.ShareCreated', |
| 4018 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4019 | + containing_type=None, |
| 4020 | + fields=[ |
| 4021 | + descriptor.FieldDescriptor( |
| 4022 | + name='share_id', full_name='ubuntuone.storageprotocol.ShareCreated.share_id', index=0, |
| 4023 | + number=1, type=9, cpp_type=9, label=1, |
| 4024 | + default_value=unicode("", "utf-8"), |
| 4025 | + message_type=None, enum_type=None, containing_type=None, |
| 4026 | + is_extension=False, extension_scope=None, |
| 4027 | + options=None), |
| 4028 | + ], |
| 4029 | + extensions=[ |
| 4030 | + ], |
| 4031 | + nested_types=[], # TODO(robinson): Implement. |
| 4032 | + enum_types=[ |
| 4033 | + ], |
| 4034 | + options=None) |
| 4035 | + |
| 4036 | + |
| 4037 | +_DELETESHARE = descriptor.Descriptor( |
| 4038 | + name='DeleteShare', |
| 4039 | + full_name='ubuntuone.storageprotocol.DeleteShare', |
| 4040 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4041 | + containing_type=None, |
| 4042 | + fields=[ |
| 4043 | + descriptor.FieldDescriptor( |
| 4044 | + name='share_id', full_name='ubuntuone.storageprotocol.DeleteShare.share_id', index=0, |
| 4045 | + number=1, type=9, cpp_type=9, label=1, |
| 4046 | + default_value=unicode("", "utf-8"), |
| 4047 | + message_type=None, enum_type=None, containing_type=None, |
| 4048 | + is_extension=False, extension_scope=None, |
| 4049 | + options=None), |
| 4050 | + ], |
| 4051 | + extensions=[ |
| 4052 | + ], |
| 4053 | + nested_types=[], # TODO(robinson): Implement. |
| 4054 | + enum_types=[ |
| 4055 | + ], |
| 4056 | + options=None) |
| 4057 | + |
| 4058 | + |
| 4059 | +_CREATEUDF = descriptor.Descriptor( |
| 4060 | + name='CreateUDF', |
| 4061 | + full_name='ubuntuone.storageprotocol.CreateUDF', |
| 4062 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4063 | + containing_type=None, |
| 4064 | + fields=[ |
| 4065 | + descriptor.FieldDescriptor( |
| 4066 | + name='path', full_name='ubuntuone.storageprotocol.CreateUDF.path', index=0, |
| 4067 | + number=1, type=9, cpp_type=9, label=1, |
| 4068 | + default_value=unicode("", "utf-8"), |
| 4069 | + message_type=None, enum_type=None, containing_type=None, |
| 4070 | + is_extension=False, extension_scope=None, |
| 4071 | + options=None), |
| 4072 | + descriptor.FieldDescriptor( |
| 4073 | + name='name', full_name='ubuntuone.storageprotocol.CreateUDF.name', index=1, |
| 4074 | + number=2, type=9, cpp_type=9, label=1, |
| 4075 | + default_value=unicode("", "utf-8"), |
| 4076 | + message_type=None, enum_type=None, containing_type=None, |
| 4077 | + is_extension=False, extension_scope=None, |
| 4078 | + options=None), |
| 4079 | + ], |
| 4080 | + extensions=[ |
| 4081 | + ], |
| 4082 | + nested_types=[], # TODO(robinson): Implement. |
| 4083 | + enum_types=[ |
| 4084 | + ], |
| 4085 | + options=None) |
| 4086 | + |
| 4087 | + |
| 4088 | +_UDFS = descriptor.Descriptor( |
| 4089 | + name='UDFs', |
| 4090 | + full_name='ubuntuone.storageprotocol.UDFs', |
| 4091 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4092 | + containing_type=None, |
| 4093 | + fields=[ |
| 4094 | + descriptor.FieldDescriptor( |
| 4095 | + name='volume', full_name='ubuntuone.storageprotocol.UDFs.volume', index=0, |
| 4096 | + number=1, type=12, cpp_type=9, label=1, |
| 4097 | + default_value="", |
| 4098 | + message_type=None, enum_type=None, containing_type=None, |
| 4099 | + is_extension=False, extension_scope=None, |
| 4100 | + options=None), |
| 4101 | + descriptor.FieldDescriptor( |
| 4102 | + name='node', full_name='ubuntuone.storageprotocol.UDFs.node', index=1, |
| 4103 | + number=2, type=12, cpp_type=9, label=1, |
| 4104 | + default_value="", |
| 4105 | + message_type=None, enum_type=None, containing_type=None, |
| 4106 | + is_extension=False, extension_scope=None, |
| 4107 | + options=None), |
| 4108 | + descriptor.FieldDescriptor( |
| 4109 | + name='suggested_path', full_name='ubuntuone.storageprotocol.UDFs.suggested_path', index=2, |
| 4110 | + number=3, type=9, cpp_type=9, label=1, |
| 4111 | + default_value=unicode("", "utf-8"), |
| 4112 | + message_type=None, enum_type=None, containing_type=None, |
| 4113 | + is_extension=False, extension_scope=None, |
| 4114 | + options=None), |
| 4115 | + ], |
| 4116 | + extensions=[ |
| 4117 | + ], |
| 4118 | + nested_types=[], # TODO(robinson): Implement. |
| 4119 | + enum_types=[ |
| 4120 | + ], |
| 4121 | + options=None) |
| 4122 | + |
| 4123 | + |
| 4124 | +_VOLUMEDELETED = descriptor.Descriptor( |
| 4125 | + name='VolumeDeleted', |
| 4126 | + full_name='ubuntuone.storageprotocol.VolumeDeleted', |
| 4127 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4128 | + containing_type=None, |
| 4129 | + fields=[ |
| 4130 | + descriptor.FieldDescriptor( |
| 4131 | + name='volume', full_name='ubuntuone.storageprotocol.VolumeDeleted.volume', index=0, |
| 4132 | + number=1, type=12, cpp_type=9, label=1, |
| 4133 | + default_value="", |
| 4134 | + message_type=None, enum_type=None, containing_type=None, |
| 4135 | + is_extension=False, extension_scope=None, |
| 4136 | + options=None), |
| 4137 | + ], |
| 4138 | + extensions=[ |
| 4139 | + ], |
| 4140 | + nested_types=[], # TODO(robinson): Implement. |
| 4141 | + enum_types=[ |
| 4142 | + ], |
| 4143 | + options=None) |
| 4144 | + |
| 4145 | + |
| 4146 | +_DELETEVOLUME = descriptor.Descriptor( |
| 4147 | + name='DeleteVolume', |
| 4148 | + full_name='ubuntuone.storageprotocol.DeleteVolume', |
| 4149 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4150 | + containing_type=None, |
| 4151 | + fields=[ |
| 4152 | + descriptor.FieldDescriptor( |
| 4153 | + name='volume', full_name='ubuntuone.storageprotocol.DeleteVolume.volume', index=0, |
| 4154 | + number=1, type=12, cpp_type=9, label=1, |
| 4155 | + default_value="", |
| 4156 | + message_type=None, enum_type=None, containing_type=None, |
| 4157 | + is_extension=False, extension_scope=None, |
| 4158 | + options=None), |
| 4159 | + ], |
| 4160 | + extensions=[ |
| 4161 | + ], |
| 4162 | + nested_types=[], # TODO(robinson): Implement. |
| 4163 | + enum_types=[ |
| 4164 | + ], |
| 4165 | + options=None) |
| 4166 | + |
| 4167 | + |
| 4168 | +_VOLUMES = descriptor.Descriptor( |
| 4169 | + name='Volumes', |
| 4170 | + full_name='ubuntuone.storageprotocol.Volumes', |
| 4171 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4172 | + containing_type=None, |
| 4173 | + fields=[ |
| 4174 | + descriptor.FieldDescriptor( |
| 4175 | + name='type', full_name='ubuntuone.storageprotocol.Volumes.type', index=0, |
| 4176 | + number=1, type=14, cpp_type=8, label=1, |
| 4177 | + default_value=1, |
| 4178 | + message_type=None, enum_type=None, containing_type=None, |
| 4179 | + is_extension=False, extension_scope=None, |
| 4180 | + options=None), |
| 4181 | + descriptor.FieldDescriptor( |
| 4182 | + name='root', full_name='ubuntuone.storageprotocol.Volumes.root', index=1, |
| 4183 | + number=3, type=11, cpp_type=10, label=1, |
| 4184 | + default_value=None, |
| 4185 | + message_type=None, enum_type=None, containing_type=None, |
| 4186 | + is_extension=False, extension_scope=None, |
| 4187 | + options=None), |
| 4188 | + descriptor.FieldDescriptor( |
| 4189 | + name='udf', full_name='ubuntuone.storageprotocol.Volumes.udf', index=2, |
| 4190 | + number=4, type=11, cpp_type=10, label=1, |
| 4191 | + default_value=None, |
| 4192 | + message_type=None, enum_type=None, containing_type=None, |
| 4193 | + is_extension=False, extension_scope=None, |
| 4194 | + options=None), |
| 4195 | + descriptor.FieldDescriptor( |
| 4196 | + name='share', full_name='ubuntuone.storageprotocol.Volumes.share', index=3, |
| 4197 | + number=5, type=11, cpp_type=10, label=1, |
| 4198 | + default_value=None, |
| 4199 | + message_type=None, enum_type=None, containing_type=None, |
| 4200 | + is_extension=False, extension_scope=None, |
| 4201 | + options=None), |
| 4202 | + ], |
| 4203 | + extensions=[ |
| 4204 | + ], |
| 4205 | + nested_types=[], # TODO(robinson): Implement. |
| 4206 | + enum_types=[ |
| 4207 | + _VOLUMES_VOLUMETYPE, |
| 4208 | + ], |
| 4209 | + options=None) |
| 4210 | + |
| 4211 | + |
| 4212 | +_QUERYCAPS = descriptor.Descriptor( |
| 4213 | + name='QueryCaps', |
| 4214 | + full_name='ubuntuone.storageprotocol.QueryCaps', |
| 4215 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4216 | + containing_type=None, |
| 4217 | + fields=[ |
| 4218 | + descriptor.FieldDescriptor( |
| 4219 | + name='capability', full_name='ubuntuone.storageprotocol.QueryCaps.capability', index=0, |
| 4220 | + number=1, type=9, cpp_type=9, label=1, |
| 4221 | + default_value=unicode("", "utf-8"), |
| 4222 | + message_type=None, enum_type=None, containing_type=None, |
| 4223 | + is_extension=False, extension_scope=None, |
| 4224 | + options=None), |
| 4225 | + ], |
| 4226 | + extensions=[ |
| 4227 | + ], |
| 4228 | + nested_types=[], # TODO(robinson): Implement. |
| 4229 | + enum_types=[ |
| 4230 | + ], |
| 4231 | + options=None) |
| 4232 | + |
| 4233 | + |
| 4234 | +_SETCAPS = descriptor.Descriptor( |
| 4235 | + name='SetCaps', |
| 4236 | + full_name='ubuntuone.storageprotocol.SetCaps', |
| 4237 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4238 | + containing_type=None, |
| 4239 | + fields=[ |
| 4240 | + descriptor.FieldDescriptor( |
| 4241 | + name='capability', full_name='ubuntuone.storageprotocol.SetCaps.capability', index=0, |
| 4242 | + number=1, type=9, cpp_type=9, label=1, |
| 4243 | + default_value=unicode("", "utf-8"), |
| 4244 | + message_type=None, enum_type=None, containing_type=None, |
| 4245 | + is_extension=False, extension_scope=None, |
| 4246 | + options=None), |
| 4247 | + ], |
| 4248 | + extensions=[ |
| 4249 | + ], |
| 4250 | + nested_types=[], # TODO(robinson): Implement. |
| 4251 | + enum_types=[ |
| 4252 | + ], |
| 4253 | + options=None) |
| 4254 | + |
| 4255 | + |
| 4256 | +_ACCEPTCAPS = descriptor.Descriptor( |
| 4257 | + name='AcceptCaps', |
| 4258 | + full_name='ubuntuone.storageprotocol.AcceptCaps', |
| 4259 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4260 | + containing_type=None, |
| 4261 | + fields=[ |
| 4262 | + descriptor.FieldDescriptor( |
| 4263 | + name='accepted', full_name='ubuntuone.storageprotocol.AcceptCaps.accepted', index=0, |
| 4264 | + number=1, type=8, cpp_type=7, label=1, |
| 4265 | + default_value=False, |
| 4266 | + message_type=None, enum_type=None, containing_type=None, |
| 4267 | + is_extension=False, extension_scope=None, |
| 4268 | + options=None), |
| 4269 | + descriptor.FieldDescriptor( |
| 4270 | + name='redirect_hostname', full_name='ubuntuone.storageprotocol.AcceptCaps.redirect_hostname', index=1, |
| 4271 | + number=2, type=9, cpp_type=9, label=1, |
| 4272 | + default_value=unicode("", "utf-8"), |
| 4273 | + message_type=None, enum_type=None, containing_type=None, |
| 4274 | + is_extension=False, extension_scope=None, |
| 4275 | + options=None), |
| 4276 | + descriptor.FieldDescriptor( |
| 4277 | + name='redirect_port', full_name='ubuntuone.storageprotocol.AcceptCaps.redirect_port', index=2, |
| 4278 | + number=3, type=9, cpp_type=9, label=1, |
| 4279 | + default_value=unicode("", "utf-8"), |
| 4280 | + message_type=None, enum_type=None, containing_type=None, |
| 4281 | + is_extension=False, extension_scope=None, |
| 4282 | + options=None), |
| 4283 | + descriptor.FieldDescriptor( |
| 4284 | + name='redirect_srvrecord', full_name='ubuntuone.storageprotocol.AcceptCaps.redirect_srvrecord', index=3, |
| 4285 | + number=4, type=9, cpp_type=9, label=1, |
| 4286 | + default_value=unicode("", "utf-8"), |
| 4287 | + message_type=None, enum_type=None, containing_type=None, |
| 4288 | + is_extension=False, extension_scope=None, |
| 4289 | + options=None), |
| 4290 | + ], |
| 4291 | + extensions=[ |
| 4292 | + ], |
| 4293 | + nested_types=[], # TODO(robinson): Implement. |
| 4294 | + enum_types=[ |
| 4295 | + ], |
| 4296 | + options=None) |
| 4297 | + |
| 4298 | + |
| 4299 | +_FREESPACEINFO = descriptor.Descriptor( |
| 4300 | + name='FreeSpaceInfo', |
| 4301 | + full_name='ubuntuone.storageprotocol.FreeSpaceInfo', |
| 4302 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4303 | + containing_type=None, |
| 4304 | + fields=[ |
| 4305 | + descriptor.FieldDescriptor( |
| 4306 | + name='share_id', full_name='ubuntuone.storageprotocol.FreeSpaceInfo.share_id', index=0, |
| 4307 | + number=1, type=9, cpp_type=9, label=1, |
| 4308 | + default_value=unicode("", "utf-8"), |
| 4309 | + message_type=None, enum_type=None, containing_type=None, |
| 4310 | + is_extension=False, extension_scope=None, |
| 4311 | + options=None), |
| 4312 | + descriptor.FieldDescriptor( |
| 4313 | + name='free_bytes', full_name='ubuntuone.storageprotocol.FreeSpaceInfo.free_bytes', index=1, |
| 4314 | + number=2, type=4, cpp_type=4, label=1, |
| 4315 | + default_value=0, |
| 4316 | + message_type=None, enum_type=None, containing_type=None, |
| 4317 | + is_extension=False, extension_scope=None, |
| 4318 | + options=None), |
| 4319 | + ], |
| 4320 | + extensions=[ |
| 4321 | + ], |
| 4322 | + nested_types=[], # TODO(robinson): Implement. |
| 4323 | + enum_types=[ |
| 4324 | + ], |
| 4325 | + options=None) |
| 4326 | + |
| 4327 | + |
| 4328 | +_FREESPACEINQUIRY = descriptor.Descriptor( |
| 4329 | + name='FreeSpaceInquiry', |
| 4330 | + full_name='ubuntuone.storageprotocol.FreeSpaceInquiry', |
| 4331 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4332 | + containing_type=None, |
| 4333 | + fields=[ |
| 4334 | + descriptor.FieldDescriptor( |
| 4335 | + name='share_id', full_name='ubuntuone.storageprotocol.FreeSpaceInquiry.share_id', index=0, |
| 4336 | + number=1, type=9, cpp_type=9, label=1, |
| 4337 | + default_value=unicode("", "utf-8"), |
| 4338 | + message_type=None, enum_type=None, containing_type=None, |
| 4339 | + is_extension=False, extension_scope=None, |
| 4340 | + options=None), |
| 4341 | + ], |
| 4342 | + extensions=[ |
| 4343 | + ], |
| 4344 | + nested_types=[], # TODO(robinson): Implement. |
| 4345 | + enum_types=[ |
| 4346 | + ], |
| 4347 | + options=None) |
| 4348 | + |
| 4349 | + |
| 4350 | +_ACCOUNTINFO = descriptor.Descriptor( |
| 4351 | + name='AccountInfo', |
| 4352 | + full_name='ubuntuone.storageprotocol.AccountInfo', |
| 4353 | + filename='ubuntuone/storageprotocol/protocol.proto', |
| 4354 | + containing_type=None, |
| 4355 | + fields=[ |
| 4356 | + descriptor.FieldDescriptor( |
| 4357 | + name='purchased_bytes', full_name='ubuntuone.storageprotocol.AccountInfo.purchased_bytes', index=0, |
| 4358 | + number=1, type=4, cpp_type=4, label=1, |
| 4359 | + default_value=0, |
| 4360 | + message_type=None, enum_type=None, containing_type=None, |
| 4361 | + is_extension=False, extension_scope=None, |
| 4362 | + options=None), |
| 4363 | + ], |
| 4364 | + extensions=[ |
| 4365 | + ], |
| 4366 | + nested_types=[], # TODO(robinson): Implement. |
| 4367 | + enum_types=[ |
| 4368 | + ], |
| 4369 | + options=None) |
| 4370 | + |
| 4371 | + |
| 4372 | +_MESSAGE.fields_by_name['type'].enum_type = _MESSAGE_MESSAGETYPE |
| 4373 | +_MESSAGE.fields_by_name['error'].message_type = _ERROR |
| 4374 | +_MESSAGE.fields_by_name['protocol'].message_type = _PROTOCOL |
| 4375 | +_MESSAGE.fields_by_name['auth_parameters'].message_type = _AUTHPARAMETER |
| 4376 | +_MESSAGE.fields_by_name['root'].message_type = _ROOT |
| 4377 | +_MESSAGE.fields_by_name['query'].message_type = _QUERY |
| 4378 | +_MESSAGE.fields_by_name['node_state'].message_type = _NODESTATE |
| 4379 | +_MESSAGE.fields_by_name['make'].message_type = _MAKE |
| 4380 | +_MESSAGE.fields_by_name['new'].message_type = _NEW |
| 4381 | +_MESSAGE.fields_by_name['move'].message_type = _MOVE |
| 4382 | +_MESSAGE.fields_by_name['get_content'].message_type = _GETCONTENT |
| 4383 | +_MESSAGE.fields_by_name['put_content'].message_type = _PUTCONTENT |
| 4384 | +_MESSAGE.fields_by_name['upload_in_progress'].message_type = _UPLOADINPROGRESS |
| 4385 | +_MESSAGE.fields_by_name['bytes'].message_type = _BYTES |
| 4386 | +_MESSAGE.fields_by_name['unlink'].message_type = _UNLINK |
| 4387 | +_MESSAGE.fields_by_name['cancel_request'].message_type = _CANCELREQUEST |
| 4388 | +_MESSAGE.fields_by_name['node_attr'].message_type = _NODEATTR |
| 4389 | +_MESSAGE.fields_by_name['create_share'].message_type = _CREATESHARE |
| 4390 | +_MESSAGE.fields_by_name['shares'].message_type = _SHARES |
| 4391 | +_MESSAGE.fields_by_name['notify_share'].message_type = _NOTIFYSHARE |
| 4392 | +_MESSAGE.fields_by_name['share_accepted'].message_type = _SHAREACCEPTED |
| 4393 | +_MESSAGE.fields_by_name['share_deleted'].message_type = _SHAREDELETED |
| 4394 | +_MESSAGE.fields_by_name['share_created'].message_type = _SHARECREATED |
| 4395 | +_MESSAGE.fields_by_name['delete_share'].message_type = _DELETESHARE |
| 4396 | +_MESSAGE.fields_by_name['create_udf'].message_type = _CREATEUDF |
| 4397 | +_MESSAGE.fields_by_name['list_volumes'].message_type = _VOLUMES |
| 4398 | +_MESSAGE.fields_by_name['volume_deleted'].message_type = _VOLUMEDELETED |
| 4399 | +_MESSAGE.fields_by_name['volume_created'].message_type = _VOLUMES |
| 4400 | +_MESSAGE.fields_by_name['delete_volume'].message_type = _DELETEVOLUME |
| 4401 | +_MESSAGE.fields_by_name['query_caps'].message_type = _QUERYCAPS |
| 4402 | +_MESSAGE.fields_by_name['set_caps'].message_type = _SETCAPS |
| 4403 | +_MESSAGE.fields_by_name['accept_caps'].message_type = _ACCEPTCAPS |
| 4404 | +_MESSAGE.fields_by_name['free_space_info'].message_type = _FREESPACEINFO |
| 4405 | +_MESSAGE.fields_by_name['free_space_inquiry'].message_type = _FREESPACEINQUIRY |
| 4406 | +_MESSAGE.fields_by_name['account_info'].message_type = _ACCOUNTINFO |
| 4407 | +_MESSAGE.fields_by_name['begin_content'].message_type = _BEGINCONTENT |
| 4408 | +_ERROR.fields_by_name['type'].enum_type = _ERROR_ERRORTYPE |
| 4409 | +_CREATESHARE.fields_by_name['access_level'].enum_type = _CREATESHARE_ACCESSLEVEL |
| 4410 | +_SHARES.fields_by_name['direction'].enum_type = _SHARES_DIRECTION |
| 4411 | +_SHARES.fields_by_name['access_level'].enum_type = _SHARES_ACCESSLEVEL |
| 4412 | +_NOTIFYSHARE.fields_by_name['access_level'].enum_type = _NOTIFYSHARE_ACCESSLEVEL |
| 4413 | +_SHAREACCEPTED.fields_by_name['answer'].enum_type = _SHAREACCEPTED_ANSWER |
| 4414 | +_VOLUMES.fields_by_name['type'].enum_type = _VOLUMES_VOLUMETYPE |
| 4415 | +_VOLUMES.fields_by_name['root'].message_type = _ROOT |
| 4416 | +_VOLUMES.fields_by_name['udf'].message_type = _UDFS |
| 4417 | +_VOLUMES.fields_by_name['share'].message_type = _SHARES |
| 4418 | + |
| 4419 | +class Message(message.Message): |
| 4420 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4421 | + DESCRIPTOR = _MESSAGE |
| 4422 | + |
| 4423 | +class Error(message.Message): |
| 4424 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4425 | + DESCRIPTOR = _ERROR |
| 4426 | + |
| 4427 | +class Protocol(message.Message): |
| 4428 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4429 | + DESCRIPTOR = _PROTOCOL |
| 4430 | + |
| 4431 | +class AuthParameter(message.Message): |
| 4432 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4433 | + DESCRIPTOR = _AUTHPARAMETER |
| 4434 | + |
| 4435 | +class Make(message.Message): |
| 4436 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4437 | + DESCRIPTOR = _MAKE |
| 4438 | + |
| 4439 | +class New(message.Message): |
| 4440 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4441 | + DESCRIPTOR = _NEW |
| 4442 | + |
| 4443 | +class Root(message.Message): |
| 4444 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4445 | + DESCRIPTOR = _ROOT |
| 4446 | + |
| 4447 | +class Query(message.Message): |
| 4448 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4449 | + DESCRIPTOR = _QUERY |
| 4450 | + |
| 4451 | +class NodeState(message.Message): |
| 4452 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4453 | + DESCRIPTOR = _NODESTATE |
| 4454 | + |
| 4455 | +class GetContent(message.Message): |
| 4456 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4457 | + DESCRIPTOR = _GETCONTENT |
| 4458 | + |
| 4459 | +class CancelRequest(message.Message): |
| 4460 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4461 | + DESCRIPTOR = _CANCELREQUEST |
| 4462 | + |
| 4463 | +class NodeAttr(message.Message): |
| 4464 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4465 | + DESCRIPTOR = _NODEATTR |
| 4466 | + |
| 4467 | +class Bytes(message.Message): |
| 4468 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4469 | + DESCRIPTOR = _BYTES |
| 4470 | + |
| 4471 | +class PutContent(message.Message): |
| 4472 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4473 | + DESCRIPTOR = _PUTCONTENT |
| 4474 | + |
| 4475 | +class BeginContent(message.Message): |
| 4476 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4477 | + DESCRIPTOR = _BEGINCONTENT |
| 4478 | + |
| 4479 | +class UploadInProgress(message.Message): |
| 4480 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4481 | + DESCRIPTOR = _UPLOADINPROGRESS |
| 4482 | + |
| 4483 | +class Move(message.Message): |
| 4484 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4485 | + DESCRIPTOR = _MOVE |
| 4486 | + |
| 4487 | +class Unlink(message.Message): |
| 4488 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4489 | + DESCRIPTOR = _UNLINK |
| 4490 | + |
| 4491 | +class CreateShare(message.Message): |
| 4492 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4493 | + DESCRIPTOR = _CREATESHARE |
| 4494 | + |
| 4495 | +class Shares(message.Message): |
| 4496 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4497 | + DESCRIPTOR = _SHARES |
| 4498 | + |
| 4499 | +class NotifyShare(message.Message): |
| 4500 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4501 | + DESCRIPTOR = _NOTIFYSHARE |
| 4502 | + |
| 4503 | +class ShareAccepted(message.Message): |
| 4504 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4505 | + DESCRIPTOR = _SHAREACCEPTED |
| 4506 | + |
| 4507 | +class ShareDeleted(message.Message): |
| 4508 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4509 | + DESCRIPTOR = _SHAREDELETED |
| 4510 | + |
| 4511 | +class ShareCreated(message.Message): |
| 4512 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4513 | + DESCRIPTOR = _SHARECREATED |
| 4514 | + |
| 4515 | +class DeleteShare(message.Message): |
| 4516 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4517 | + DESCRIPTOR = _DELETESHARE |
| 4518 | + |
| 4519 | +class CreateUDF(message.Message): |
| 4520 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4521 | + DESCRIPTOR = _CREATEUDF |
| 4522 | + |
| 4523 | +class UDFs(message.Message): |
| 4524 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4525 | + DESCRIPTOR = _UDFS |
| 4526 | + |
| 4527 | +class VolumeDeleted(message.Message): |
| 4528 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4529 | + DESCRIPTOR = _VOLUMEDELETED |
| 4530 | + |
| 4531 | +class DeleteVolume(message.Message): |
| 4532 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4533 | + DESCRIPTOR = _DELETEVOLUME |
| 4534 | + |
| 4535 | +class Volumes(message.Message): |
| 4536 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4537 | + DESCRIPTOR = _VOLUMES |
| 4538 | + |
| 4539 | +class QueryCaps(message.Message): |
| 4540 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4541 | + DESCRIPTOR = _QUERYCAPS |
| 4542 | + |
| 4543 | +class SetCaps(message.Message): |
| 4544 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4545 | + DESCRIPTOR = _SETCAPS |
| 4546 | + |
| 4547 | +class AcceptCaps(message.Message): |
| 4548 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4549 | + DESCRIPTOR = _ACCEPTCAPS |
| 4550 | + |
| 4551 | +class FreeSpaceInfo(message.Message): |
| 4552 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4553 | + DESCRIPTOR = _FREESPACEINFO |
| 4554 | + |
| 4555 | +class FreeSpaceInquiry(message.Message): |
| 4556 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4557 | + DESCRIPTOR = _FREESPACEINQUIRY |
| 4558 | + |
| 4559 | +class AccountInfo(message.Message): |
| 4560 | + __metaclass__ = reflection.GeneratedProtocolMessageType |
| 4561 | + DESCRIPTOR = _ACCOUNTINFO |
| 4562 | + |
| 4563 | |
| 4564 | === modified file 'ubuntuone/storageprotocol/request.py' |
| 4565 | --- ubuntuone/storageprotocol/request.py 2009-08-26 12:00:00 +0000 |
| 4566 | +++ ubuntuone/storageprotocol/request.py 2010-02-17 23:29:10 +0000 |
| 4567 | @@ -56,17 +56,18 @@ |
| 4568 | class StorageProtocolError(Exception): |
| 4569 | """base class for all client/server exceptions.""" |
| 4570 | |
| 4571 | + |
| 4572 | class StorageProtocolErrorSizeTooBig(StorageProtocolError): |
| 4573 | """the size we received was too big.""" |
| 4574 | |
| 4575 | + |
| 4576 | class StorageProtocolProtocolError(StorageProtocolError): |
| 4577 | """A protocol error on the storage protocol.""" |
| 4578 | |
| 4579 | |
| 4580 | class StorageRequestError(StorageProtocolError): |
| 4581 | - """an exception that keeps the request that generated it around |
| 4582 | + """an exception that keeps the request that generated it around.""" |
| 4583 | |
| 4584 | - """ |
| 4585 | def __init__(self, request, message): |
| 4586 | """create a StorageRequestError. |
| 4587 | |
| 4588 | |
| 4589 | === modified file 'ubuntuone/storageprotocol/sharersp.py' |
| 4590 | --- ubuntuone/storageprotocol/sharersp.py 2009-06-30 12:00:00 +0000 |
| 4591 | +++ ubuntuone/storageprotocol/sharersp.py 2010-02-17 23:29:10 +0000 |
| 4592 | @@ -5,42 +5,31 @@ |
| 4593 | # |
| 4594 | # Copyright 2009 Canonical Ltd. |
| 4595 | # |
| 4596 | -# This program is free software: you can redistribute it and/or modify it |
| 4597 | +# This program is free software: you can redistribute it and/or modify it |
| 4598 | # under the terms of the GNU Affero General Public License version 3, |
| 4599 | # as published by the Free Software Foundation. |
| 4600 | # |
| 4601 | -# This program is distributed in the hope that it will be useful, but |
| 4602 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 4603 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 4604 | +# This program is distributed in the hope that it will be useful, but |
| 4605 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 4606 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 4607 | # PURPOSE. See the GNU Affero General Public License for more details. |
| 4608 | # |
| 4609 | # You should have received a copy of the GNU Affero General Public License |
| 4610 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 4611 | -"""provides a handy class to use Shares |
| 4612 | -""" |
| 4613 | +"""A handy class to use Shares.""" |
| 4614 | |
| 4615 | import uuid |
| 4616 | -from ubuntuone.storageprotocol import protocol_pb2 |
| 4617 | - |
| 4618 | -_direction_prot2nice = { |
| 4619 | - protocol_pb2.Shares.FROM_ME: "from_me", |
| 4620 | - protocol_pb2.Shares.TO_ME: "to_me", |
| 4621 | -} |
| 4622 | -_direction_nice2prot = dict((y, x) for x, y in _direction_prot2nice.items()) |
| 4623 | - |
| 4624 | -_access_prot2nice = { |
| 4625 | - protocol_pb2.Shares.VIEW: "View", |
| 4626 | - protocol_pb2.Shares.MODIFY: "Modify", |
| 4627 | -} |
| 4628 | -_access_nice2prot = dict((y, x) for x, y in _access_prot2nice.items()) |
| 4629 | + |
| 4630 | +from ubuntuone.storageprotocol import volumes |
| 4631 | +# pylint: disable-msg=W0212 |
| 4632 | |
| 4633 | class ShareResponse(object): |
| 4634 | - '''This is a handy object to support all the fields of a share listing.''' |
| 4635 | + """This is a handy object to support all the fields of a share listing.""" |
| 4636 | |
| 4637 | @classmethod |
| 4638 | def from_params(cls, id, direction, subtree, share_name, other_username, |
| 4639 | other_visible_name, accepted, access_level): |
| 4640 | - '''Creates the object from given parameters.''' |
| 4641 | + """Creates the object from given parameters.""" |
| 4642 | # pylint: disable-msg=W0201 |
| 4643 | o = cls() |
| 4644 | o.id = id |
| 4645 | @@ -55,28 +44,29 @@ |
| 4646 | |
| 4647 | @classmethod |
| 4648 | def load_from_msg(cls, msg): |
| 4649 | - '''Creates the object loading the information from a message.''' |
| 4650 | + """Creates the object loading the information from a message.""" |
| 4651 | + # pylint: disable-msg=W0201 |
| 4652 | o = cls() |
| 4653 | o.id = uuid.UUID(msg.share_id) |
| 4654 | - o.direction = _direction_prot2nice[msg.direction] |
| 4655 | + o.direction = volumes._direction_prot2nice[msg.direction] |
| 4656 | o.subtree = msg.subtree |
| 4657 | o.name = msg.share_name |
| 4658 | o.other_username = msg.other_username |
| 4659 | o.other_visible_name = msg.other_visible_name |
| 4660 | o.accepted = msg.accepted |
| 4661 | - o.access_level = _access_prot2nice[msg.access_level] |
| 4662 | + o.access_level = volumes._access_prot2nice[msg.access_level] |
| 4663 | return o |
| 4664 | |
| 4665 | def dump_to_msg(self, msg): |
| 4666 | - '''Dumps the object information to a given message.''' |
| 4667 | + """Dumps the object information to a given message.""" |
| 4668 | msg.share_id = str(self.id) |
| 4669 | - msg.direction = _direction_nice2prot[self.direction] |
| 4670 | + msg.direction = volumes._direction_nice2prot[self.direction] |
| 4671 | msg.subtree = str(self.subtree) |
| 4672 | msg.share_name = self.name |
| 4673 | msg.other_username = self.other_username |
| 4674 | msg.other_visible_name = self.other_visible_name |
| 4675 | msg.accepted = self.accepted |
| 4676 | - msg.access_level = _access_nice2prot[self.access_level] |
| 4677 | + msg.access_level = volumes._access_nice2prot[self.access_level] |
| 4678 | |
| 4679 | def __str__(self): |
| 4680 | t = "Share %r [%s] (other: %s, access: %s, accepted: %s, id: %s)" % ( |
| 4681 | @@ -85,12 +75,12 @@ |
| 4682 | return t |
| 4683 | |
| 4684 | class NotifyShareHolder(object): |
| 4685 | - '''This is a handy object to support all the fields of a share notify.''' |
| 4686 | + """This is a handy object to support all the fields of a share notify.""" |
| 4687 | |
| 4688 | @classmethod |
| 4689 | def from_params(cls, share_id, subtree, share_name, from_username, |
| 4690 | - from_visible_name, access_level): |
| 4691 | - '''Creates the object from given parameters.''' |
| 4692 | + from_visible_name, access_level): |
| 4693 | + """Creates the object from given parameters.""" |
| 4694 | # pylint: disable-msg=W0201 |
| 4695 | o = cls() |
| 4696 | o.share_id = share_id |
| 4697 | @@ -103,24 +93,24 @@ |
| 4698 | |
| 4699 | @classmethod |
| 4700 | def load_from_msg(cls, msg): |
| 4701 | - '''Creates the object loading the information from a message.''' |
| 4702 | + """Creates the object loading the information from a message.""" |
| 4703 | o = cls() |
| 4704 | o.share_id = uuid.UUID(msg.share_id) |
| 4705 | o.subtree = msg.subtree |
| 4706 | o.share_name = msg.share_name.decode("utf8") |
| 4707 | o.from_username = msg.from_username.decode("utf8") |
| 4708 | o.from_visible_name = msg.from_visible_name.decode("utf8") |
| 4709 | - o.access_level = _access_prot2nice[msg.access_level] |
| 4710 | + o.access_level = volumes._access_prot2nice[msg.access_level] |
| 4711 | return o |
| 4712 | |
| 4713 | def dump_to_msg(self, msg): |
| 4714 | - '''Dumps the object information to a given message.''' |
| 4715 | + """Dumps the object information to a given message.""" |
| 4716 | msg.share_id = str(self.share_id) |
| 4717 | msg.subtree = str(self.subtree) |
| 4718 | msg.share_name = self.share_name.encode("utf8") |
| 4719 | msg.from_username = self.from_username.encode("utf8") |
| 4720 | msg.from_visible_name = self.from_visible_name.encode("utf8") |
| 4721 | - msg.access_level = _access_nice2prot[self.access_level] |
| 4722 | + msg.access_level = volumes._access_nice2prot[self.access_level] |
| 4723 | |
| 4724 | def __str__(self): |
| 4725 | t = "Share Notification %r (from: %s, access: %s, id: %s)" % ( |
| 4726 | |
| 4727 | === added file 'ubuntuone/storageprotocol/volumes.py' |
| 4728 | --- ubuntuone/storageprotocol/volumes.py 1970-01-01 00:00:00 +0000 |
| 4729 | +++ ubuntuone/storageprotocol/volumes.py 2010-02-17 23:29:10 +0000 |
| 4730 | @@ -0,0 +1,141 @@ |
| 4731 | +# Author: Natalia B. Bidart <natalia.bidart@canonical.com> |
| 4732 | +# |
| 4733 | +# Copyright 2009 Canonical Ltd. |
| 4734 | +# |
| 4735 | +# This program is free software: you can redistribute it and/or modify it |
| 4736 | +# under the terms of the GNU Affero General Public License version 3, |
| 4737 | +# as published by the Free Software Foundation. |
| 4738 | +# |
| 4739 | +# This program is distributed in the hope that it will be useful, but |
| 4740 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 4741 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 4742 | +# PURPOSE. See the GNU Affero General Public License for more details. |
| 4743 | +# |
| 4744 | +# You should have received a copy of the GNU Affero General Public License |
| 4745 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 4746 | +"""The volumes abstraction.""" |
| 4747 | + |
| 4748 | +import uuid |
| 4749 | + |
| 4750 | +from ubuntuone.storageprotocol import protocol_pb2 |
| 4751 | + |
| 4752 | +_direction_prot2nice = { |
| 4753 | + protocol_pb2.Shares.FROM_ME: "from_me", |
| 4754 | + protocol_pb2.Shares.TO_ME: "to_me", |
| 4755 | +} |
| 4756 | +_direction_nice2prot = dict((y, x) for x, y in _direction_prot2nice.items()) |
| 4757 | + |
| 4758 | +_access_prot2nice = { |
| 4759 | + protocol_pb2.Shares.VIEW: "View", |
| 4760 | + protocol_pb2.Shares.MODIFY: "Modify", |
| 4761 | +} |
| 4762 | +_access_nice2prot = dict((y, x) for x, y in _access_prot2nice.items()) |
| 4763 | + |
| 4764 | + |
| 4765 | +class Volume(object): |
| 4766 | + """A generic volume.""" |
| 4767 | + |
| 4768 | + def __init__(self, volume_id, node_id): |
| 4769 | + """Create the volume.""" |
| 4770 | + self.volume_id = volume_id |
| 4771 | + self.node_id = node_id |
| 4772 | + |
| 4773 | + @classmethod |
| 4774 | + def from_params(cls, **kwargs): |
| 4775 | + """Creates the object from given parameters.""" |
| 4776 | + result = cls(**kwargs) |
| 4777 | + return result |
| 4778 | + |
| 4779 | + @classmethod |
| 4780 | + def from_msg(cls, msg): |
| 4781 | + """Creates the object using the information from a message.""" |
| 4782 | + raise NotImplementedError |
| 4783 | + |
| 4784 | + def __eq__(self, other): |
| 4785 | + result = (self.volume_id == other.volume_id and |
| 4786 | + self.node_id == other.node_id) |
| 4787 | + return result |
| 4788 | + |
| 4789 | +class ShareVolume(Volume): |
| 4790 | + """A volume representing an accepted Share.""" |
| 4791 | + |
| 4792 | + def __init__(self, volume_id, node_id, direction, share_name, |
| 4793 | + other_username, other_visible_name, accepted, access_level): |
| 4794 | + """Create the share.""" |
| 4795 | + super(ShareVolume, self).__init__(volume_id, node_id) |
| 4796 | + self.direction = direction |
| 4797 | + self.share_name = share_name |
| 4798 | + self.other_username = other_username |
| 4799 | + self.other_visible_name = other_visible_name |
| 4800 | + self.accepted = accepted |
| 4801 | + self.access_level = access_level |
| 4802 | + |
| 4803 | + @classmethod |
| 4804 | + def from_msg(cls, msg): |
| 4805 | + """Creates the object using the information from a message.""" |
| 4806 | + kwargs = dict( |
| 4807 | + volume_id=uuid.UUID(msg.share_id), |
| 4808 | + node_id=uuid.UUID(msg.subtree), |
| 4809 | + direction = _direction_prot2nice[msg.direction], |
| 4810 | + share_name=msg.share_name, |
| 4811 | + other_username=msg.other_username, |
| 4812 | + other_visible_name=msg.other_visible_name, |
| 4813 | + accepted=msg.accepted, |
| 4814 | + access_level=_access_prot2nice[msg.access_level] |
| 4815 | + ) |
| 4816 | + result = cls(**kwargs) |
| 4817 | + return result |
| 4818 | + |
| 4819 | + def __eq__(self, other): |
| 4820 | + result = (super(ShareVolume, self).__eq__(other) and |
| 4821 | + self.direction == other.direction and |
| 4822 | + self.share_name == other.share_name and |
| 4823 | + self.other_username == other.other_username and |
| 4824 | + self.other_visible_name == other.other_visible_name and |
| 4825 | + self.accepted == other.accepted and |
| 4826 | + self.access_level == other.access_level) |
| 4827 | + return result |
| 4828 | + |
| 4829 | + |
| 4830 | +class UDFVolume(Volume): |
| 4831 | + """A volume representing a User Defined Folder.""" |
| 4832 | + |
| 4833 | + def __init__(self, volume_id, node_id, suggested_path): |
| 4834 | + """Create the UDF.""" |
| 4835 | + super(UDFVolume, self).__init__(volume_id, node_id) |
| 4836 | + self.suggested_path = suggested_path |
| 4837 | + |
| 4838 | + @classmethod |
| 4839 | + def from_msg(cls, msg): |
| 4840 | + """Creates the object using the information from a message.""" |
| 4841 | + kwargs = dict( |
| 4842 | + volume_id=uuid.UUID(msg.volume), |
| 4843 | + node_id=uuid.UUID(msg.node), |
| 4844 | + suggested_path=msg.suggested_path |
| 4845 | + ) |
| 4846 | + result = cls(**kwargs) |
| 4847 | + return result |
| 4848 | + |
| 4849 | + def __eq__(self, other): |
| 4850 | + result = (super(UDFVolume, self).__eq__(other) and |
| 4851 | + self.suggested_path == other.suggested_path) |
| 4852 | + return result |
| 4853 | + |
| 4854 | + |
| 4855 | +class RootVolume(Volume): |
| 4856 | + """A volume representing a Root-root.""" |
| 4857 | + |
| 4858 | + def __init__(self, node_id): |
| 4859 | + """Create the volume.""" |
| 4860 | + super(RootVolume, self).__init__(volume_id=None, node_id=node_id) |
| 4861 | + |
| 4862 | + @classmethod |
| 4863 | + def from_msg(cls, msg): |
| 4864 | + """Creates the object using the information from a message.""" |
| 4865 | + kwargs = dict(node_id=uuid.UUID(msg.node)) |
| 4866 | + result = cls(**kwargs) |
| 4867 | + return result |
| 4868 | + |
| 4869 | + def __eq__(self, other): |
| 4870 | + return self.node_id == other.node_id |
| 4871 | + |

