Changeset 0fab511 in trunk
- Timestamp:
- 2008-11-22T03:28:12Z (17 years ago)
- Branches:
- master
- Children:
- 3e25efc
- Parents:
- bf06492
- Location:
- src/allmydata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/immutable/upload.py ¶
rbf06492 r0fab511 165 165 raise NotEnoughSharesError("client gave us zero peers") 166 166 167 # figure out how much space to ask for168 169 167 # this needed_hashes computation should mirror 170 168 # Encoder.send_all_share_hash_trees. We use an IncompleteHashTree … … 173 171 ht = hashtree.IncompleteHashTree(total_shares) 174 172 num_share_hashes = len(ht.needed_hashes(0, include_leaf=True)) 173 174 # figure out how much space to ask for 175 allocated_size = layout.allocated_size(share_size, 176 num_segments, 177 num_share_hashes, 178 EXTENSION_SIZE) 179 # filter the list of peers according to which ones can accomodate 180 # this request. This excludes older peers (which used a 4-byte size 181 # field) from getting large shares (for files larger than about 182 # 12GiB). See #439 for details. 183 def _get_maxsize(peer): 184 (peerid, conn) = peer 185 v1 = conn.version["http://allmydata.org/tahoe/protocols/storage/v1"] 186 return v1["maximum-immutable-share-size"] 187 peers = [peer for peer in peers 188 if _get_maxsize(peer) >= allocated_size] 189 if not peers: 190 raise NotEnoughSharesError("no peers could accept an allocated_size of %d" % allocated_size) 175 191 176 192 # decide upon the renewal/cancel secrets, to include them in the -
TabularUnified src/allmydata/test/test_upload.py ¶
rbf06492 r0fab511 8 8 from foolscap import eventual 9 9 10 import allmydata 10 11 from allmydata import uri, monitor 11 12 from allmydata.immutable import upload … … 82 83 self.allocated = [] 83 84 self.queries = 0 85 self.version = { "http://allmydata.org/tahoe/protocols/storage/v1" : 86 { "maximum-immutable-share-size": 2**32 }, 87 "application-version": str(allmydata.__version__), 88 } 89 84 90 def callRemote(self, methname, *args, **kwargs): 85 91 def _call():
Note: See TracChangeset
for help on using the changeset viewer.