Changeset 55ec994 in trunk
- Timestamp:
- 2020-11-06T16:40:34Z (4 years ago)
- Branches:
- master
- Children:
- 9dd0faf
- Parents:
- 2e6f8ca
- Location:
- src/allmydata
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/mutable/retrieve.py ¶
r2e6f8ca r55ec994 1 from past.builtins import unicode 2 1 3 import time 2 4 … … 907 909 908 910 def notify_server_corruption(self, server, shnum, reason): 911 if isinstance(reason, unicode): 912 reason = reason.encode("utf-8") 909 913 storage_server = server.get_storage_server() 910 914 storage_server.advise_corrupt_share( 911 "mutable",915 b"mutable", 912 916 self._storage_index, 913 917 shnum, -
TabularUnified src/allmydata/mutable/servermap.py ¶
r2e6f8ca r55ec994 1 1 from __future__ import print_function 2 3 from past.builtins import unicode 2 4 3 5 import sys, time, copy … … 801 803 802 804 def notify_server_corruption(self, server, shnum, reason): 805 if isinstance(reason, unicode): 806 reason = reason.encode("utf-8") 803 807 ss = server.get_storage_server() 804 808 ss.advise_corrupt_share( 805 "mutable",809 b"mutable", 806 810 self._storage_index, 807 811 shnum, -
TabularUnified src/allmydata/test/mutable/test_problems.py ¶
r2e6f8ca r55ec994 57 57 self.set_up_grid() 58 58 nm = self.g.clients[0].nodemaker 59 d = nm.create_mutable_file(MutableData( "contents 1"),59 d = nm.create_mutable_file(MutableData(b"contents 1"), 60 60 version=version) 61 61 def _created(n): … … 68 68 # then modify the file, leaving the old map untouched 69 69 d.addCallback(lambda res: log.msg("starting winning write")) 70 d.addCallback(lambda res: n.overwrite(MutableData( "contents 2")))70 d.addCallback(lambda res: n.overwrite(MutableData(b"contents 2"))) 71 71 # now attempt to modify the file with the old servermap. This 72 72 # will look just like an uncoordinated write, in which every … … 77 77 "test_publish_surprise", None, 78 78 n.upload, 79 MutableData( "contents 2a"), self.old_map))79 MutableData(b"contents 2a"), self.old_map)) 80 80 return d 81 81 d.addCallback(_created) … … 92 92 self.set_up_grid() 93 93 nm = self.g.clients[0].nodemaker 94 d = nm.create_mutable_file(MutableData( "contents 1"*4000))94 d = nm.create_mutable_file(MutableData(b"contents 1"*4000)) 95 95 def _created(n): 96 96 d = defer.succeed(None) … … 102 102 # then modify the file, leaving the old map untouched 103 103 d.addCallback(lambda res: log.msg("starting winning write")) 104 d.addCallback(lambda res: n.overwrite(MutableData( "contents 2")))104 d.addCallback(lambda res: n.overwrite(MutableData(b"contents 2"))) 105 105 # now attempt to retrieve the old version with the old servermap. 106 106 # This will look like someone has changed the file since we … … 129 129 self.set_up_grid() 130 130 nm = self.g.clients[0].nodemaker 131 d = nm.create_mutable_file(MutableData( "contents 1"))131 d = nm.create_mutable_file(MutableData(b"contents 1")) 132 132 def _created(n): 133 133 d = defer.succeed(None) … … 141 141 # then modify the file, leaving the old map untouched 142 142 log.msg("starting winning write") 143 return n.overwrite(MutableData( "contents 2"))143 return n.overwrite(MutableData(b"contents 2")) 144 144 d.addCallback(_got_smap1) 145 145 # now attempt to modify the file with the old servermap. This … … 151 151 "test_surprise", None, 152 152 n.upload, 153 MutableData( "contents 2a"), self.old_map))153 MutableData(b"contents 2a"), self.old_map)) 154 154 return d 155 155 d.addCallback(_created) … … 160 160 self.set_up_grid() 161 161 nm = self.g.clients[0].nodemaker 162 d = nm.create_mutable_file(MutableData( "contents 1"))162 d = nm.create_mutable_file(MutableData(b"contents 1")) 163 163 # remove one of the servers and reupload the file. 164 164 def _created(n): … … 227 227 # now "create" the file, using the pre-established key, and let the 228 228 # initial publish finally happen 229 d.addCallback(lambda res: nm.create_mutable_file(MutableData( "contents 1")))229 d.addCallback(lambda res: nm.create_mutable_file(MutableData(b"contents 1"))) 230 230 # that ought to work 231 231 def _got_node(n): 232 232 d = n.download_best_version() 233 d.addCallback(lambda res: self.failUnlessEqual(res, "contents 1"))233 d.addCallback(lambda res: self.failUnlessEqual(res, b"contents 1")) 234 234 # now break the second peer 235 235 def _break_peer1(res): 236 236 self.g.break_server(self.server1.get_serverid()) 237 237 d.addCallback(_break_peer1) 238 d.addCallback(lambda res: n.overwrite(MutableData( "contents 2")))238 d.addCallback(lambda res: n.overwrite(MutableData(b"contents 2"))) 239 239 # that ought to work too 240 240 d.addCallback(lambda res: n.download_best_version()) 241 d.addCallback(lambda res: self.failUnlessEqual(res, "contents 2"))241 d.addCallback(lambda res: self.failUnlessEqual(res, b"contents 2")) 242 242 def _explain_error(f): 243 243 print(f) … … 268 268 self.g.break_server(peerids[0]) 269 269 270 d = nm.create_mutable_file(MutableData( "contents 1"))270 d = nm.create_mutable_file(MutableData(b"contents 1")) 271 271 def _created(n): 272 272 d = n.download_best_version() 273 d.addCallback(lambda res: self.failUnlessEqual(res, "contents 1"))273 d.addCallback(lambda res: self.failUnlessEqual(res, b"contents 1")) 274 274 # now break one of the remaining servers 275 275 def _break_second_server(res): 276 276 self.g.break_server(peerids[1]) 277 277 d.addCallback(_break_second_server) 278 d.addCallback(lambda res: n.overwrite(MutableData( "contents 2")))278 d.addCallback(lambda res: n.overwrite(MutableData(b"contents 2"))) 279 279 # that ought to work too 280 280 d.addCallback(lambda res: n.download_best_version()) 281 d.addCallback(lambda res: self.failUnlessEqual(res, "contents 2"))281 d.addCallback(lambda res: self.failUnlessEqual(res, b"contents 2")) 282 282 return d 283 283 d.addCallback(_created) … … 295 295 "test_publish_all_servers_bad", 296 296 "ran out of good servers", 297 nm.create_mutable_file, MutableData( "contents"))297 nm.create_mutable_file, MutableData(b"contents")) 298 298 return d 299 299 … … 307 307 "test_publish_no_servers", 308 308 "Ran out of non-bad servers", 309 nm.create_mutable_file, MutableData( "contents"))309 nm.create_mutable_file, MutableData(b"contents")) 310 310 return d 311 311 … … 323 323 # we need some contents that are large enough to push the privkey out 324 324 # of the early part of the file 325 LARGE = "These are Larger contents" * 2000 # about 50KB325 LARGE = b"These are Larger contents" * 2000 # about 50KB 326 326 LARGE_uploadable = MutableData(LARGE) 327 327 d = nm.create_mutable_file(LARGE_uploadable) … … 360 360 self.set_up_grid(num_servers=20) 361 361 nm = self.g.clients[0].nodemaker 362 LARGE = "These are Larger contents" * 2000 # about 50KiB362 LARGE = b"These are Larger contents" * 2000 # about 50KiB 363 363 LARGE_uploadable = MutableData(LARGE) 364 364 nm._node_cache = DevNullDictionary() # disable the nodecache … … 386 386 self.set_up_grid(num_servers=20) 387 387 nm = self.g.clients[0].nodemaker 388 CONTENTS = "contents" * 2000388 CONTENTS = b"contents" * 2000 389 389 CONTENTS_uploadable = MutableData(CONTENTS) 390 390 d = nm.create_mutable_file(CONTENTS_uploadable) … … 452 452 453 453 454 TEST_1654_CAP = "URI:SSK:6jthysgozssjnagqlcxjq7recm:yxawei54fmf2ijkrvs2shs6iey4kpdp6joi7brj2vrva6sp5nf3a"455 456 TEST_1654_SH0 = """\454 TEST_1654_CAP = b"URI:SSK:6jthysgozssjnagqlcxjq7recm:yxawei54fmf2ijkrvs2shs6iey4kpdp6joi7brj2vrva6sp5nf3a" 455 456 TEST_1654_SH0 = b"""\ 457 457 VGFob2UgbXV0YWJsZSBjb250YWluZXIgdjEKdQlEA46m9s5j6lnzsOHytBTs2JOo 458 458 AkWe8058hyrDa8igfBSqZMKO3aDOrFuRVt0ySYZ6oihFqPJRAAAAAAAAB8YAAAAA … … 508 508 72mXGlqyLyWYuAAAAAA=""" 509 509 510 TEST_1654_SH1 = """\510 TEST_1654_SH1 = b"""\ 511 511 VGFob2UgbXV0YWJsZSBjb250YWluZXIgdjEKdQlEA45R4Y4kuV458rSTGDVTqdzz 512 512 9Fig3NQ3LermyD+0XLeqbC7KNgvv6cNzMZ9psQQ3FseYsIR1AAAAAAAAB8YAAAAA
Note: See TracChangeset
for help on using the changeset viewer.