TransferSegmentMetadata.CalculateSegmentCount(Int64) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Calculates the number of segments a file of the given length should be split into. The method to calculate this is based on some empirical measurements that allows both the number of segments and the length of each segment to grow as the input file size grows. They both grow on a logarithmic pattern as the file length increases. The formula is roughly this:
- Multiplier = Min(100, 50 * 2 ^ Log10(FileLengthInGB))
- SegmentCount = Max(1, Multiplier * 2 ^ Log10(FileLengthInGB) Essentially we quadruple the number of segments for each tenfold increase in the file length, with certain caps. The formula is designed to support both small files and extremely large files (and not cause very small segment lengths or very large number of segments).
public static int CalculateSegmentCount (long fileLength);
static member CalculateSegmentCount : int64 -> int
Public Shared Function CalculateSegmentCount (fileLength As Long) As Integer
Parameters
- fileLength
- Int64
The length of the file, in bytes.
Returns
The number of segments to split the file into. Returns 0 if fileLength is 0.
Exceptions
File Length cannot be negative