@@ -239,38 +239,40 @@ def parse(cls, prefix: str) -> Self:
239239 return cls (common = entry , partition = partition )
240240
241241 @classmethod
242- def for_main_deployment (cls , num_subgraphs : int ) -> Self :
242+ def for_main_deployment (cls , num_elements : int , partition_size : int ) -> Self :
243243 """
244- A prefix that is expected to rarely exceed 8192 subgraphs per partition
244+ A prefix that divides a source containing the given number of elements
245+ (subgraphs, files, …) into partitions that rarely exceed the given size.
245246
246- >>> str(Prefix.for_main_deployment(0))
247+ >>> n = 8192
248+
249+ >>> str(Prefix.for_main_deployment(0, n))
247250 Traceback (most recent call last):
248251 ...
249252 ValueError: math domain error
250253
251- >>> str(Prefix.for_main_deployment(1))
254+ >>> str(Prefix.for_main_deployment(1, n ))
252255 '/0'
253256
254257 >>> cases = [-1, 0, 1, 2]
255258
256- >>> n = 8192
257- >>> [str(Prefix.for_main_deployment(n + i)) for i in cases]
259+ >>> [str(Prefix.for_main_deployment(n + i, n)) for i in cases]
258260 ['/0', '/0', '/1', '/1']
259261
260262 Sources with this many bundles are very rare, so we have a generous
261263 margin of error surrounding this cutoff point
262264
263- >>> n = 8192 * 16
264- >>> [str(Prefix.for_main_deployment(n + i)) for i in cases]
265+ >>> m = n * 16
266+ >>> [str(Prefix.for_main_deployment(m + i, n )) for i in cases]
265267 ['/1', '/1', '/2', '/2']
266268 """
267- partition = cls ._prefix_length (num_subgraphs , 8192 )
269+ partition = cls ._prefix_length (num_elements , partition_size )
268270 return cls (common = '' , partition = partition )
269271
270272 @classmethod
271- def for_lesser_deployment (cls , num_subgraphs : int ) -> Self :
273+ def for_lesser_deployment (cls , num_elements : int ) -> Self :
272274 """
273- A prefix that yields an average of approximately 24 subgraphs per
275+ A prefix that yields an average of approximately 24 elements per
274276 source, using an experimentally derived heuristic formula designed to
275277 minimize manual adjustment of the computed common prefixes. The
276278 partition prefix length is always 1, even though some partitions may be
@@ -294,9 +296,9 @@ def for_lesser_deployment(cls, num_subgraphs: int) -> Self:
294296 >>> [str(Prefix.for_lesser_deployment(n + i)) for i in cases]
295297 ['e/1', 'f/1', '00/1', '10/1']
296298 """
297- digits = f'{ num_subgraphs - 1 :x} ' [::- 1 ]
298- length = cls ._prefix_length (num_subgraphs , 64 )
299- assert length < len (digits ), num_subgraphs
299+ digits = f'{ num_elements - 1 :x} ' [::- 1 ]
300+ length = cls ._prefix_length (num_elements , 64 )
301+ assert length < len (digits ), num_elements
300302 return cls (common = digits [:length ], partition = 1 )
301303
302304 @classmethod
0 commit comments