swift/proxy/controllers/obj.py
def _convert_range(self, req, policy):
        """
        Take the requested range(s) from the client and convert it to range(s)
        to be sent to the object servers.

        This includes widening requested ranges to full segments, then
        converting those ranges to fragments so that we retrieve the minimum
        number of fragments from the object server.

        Mutates the request passed in.

        Returns a list of range specs (dictionaries with the different byte
        indices in them).
        """
        # Since segments and fragments have different sizes, we need
        # to modify the Range header sent to the object servers to
        # make sure we get the right fragments out of the fragment
        # archives.
        segment_size = policy.ec_segment_size
        fragment_size = policy.fragment_size

        range_specs = []
        new_ranges = []
        for client_start, client_end in req.range.ranges:
            # TODO: coalesce ranges that overlap segments. For
            # example, "bytes=0-10,20-30,40-50" with a 64 KiB
            # segment size will result in a Range header in the
            # object request of "bytes=0-65535,0-65535,0-65535",
            # which is wasteful. We should be smarter and only
            # request that first segment once.
            segment_start, segment_end = client_range_to_segment_range(
                client_start, client_end, segment_size)

            fragment_start, fragment_end = \
                segment_range_to_fragment_range(
                    segment_start, segment_end,
                    segment_size, fragment_size)

            new_ranges.append((fragment_start, fragment_end))
            range_specs.append({'req_client_start': client_start,
                                'req_client_end': client_end,
                                'req_segment_start': segment_start,
                                'req_segment_end': segment_end,
                                'req_fragment_start': fragment_start,
                                'req_fragment_end': fragment_end})

        req.range = "bytes=" + ",".join(
            "%s-%s" % (s if s is not None else "",
                       e if e is not None else "")
            for s, e in new_ranges)
        return range_specs

        Take the requested range(s) from the client and convert it to range(s)
        to be sent to the object servers.

        This includes widening requested ranges to full segments, then
        converting those ranges to fragments so that we retrieve the minimum
        number of fragments from the object server.

        Mutates the request passed in.

        Returns a list of range specs (dictionaries with the different byte
        indices in them).
        
Take the requested range(s) from the client and convert it to range(s)
to be sent to the object servers.

This includes widening requested ranges to full segments, then
converting those ranges to fragments so that we retrieve the minimum
number of fragments from the object server.

Mutates the request passed in.

Returns a list of range specs (dictionaries with the different byte
indices in them).
Take the requested range ( s ) from the client and convert it to range ( s ) to be sent to the object servers . This includes widening requested ranges to full segments then converting those ranges to fragments so that we retrieve the minimum number of fragments from the object server . Mutates the request passed in . Returns a list of range specs ( dictionaries with the different byte indices in them ) .
def _convert_range(self, req, policy):
        segment_size = policy.ec_segment_size
        fragment_size = policy.fragment_size
        range_specs = []
        new_ranges = []
        for client_start, client_end in req.range.ranges:
            segment_start, segment_end = client_range_to_segment_range(
                client_start, client_end, segment_size)
            fragment_start, fragment_end = \
                segment_range_to_fragment_range(
                    segment_start, segment_end,
                    segment_size, fragment_size)
            new_ranges.append((fragment_start, fragment_end))
            range_specs.append({'req_client_start': client_start,
                                'req_client_end': client_end,
                                'req_segment_start': segment_start,
                                'req_segment_end': segment_end,
                                'req_fragment_start': fragment_start,
                                'req_fragment_end': fragment_end})
        req.range = "bytes=" + ",".join(
            "%s-%s" % (s if s is not None else "",
                       e if e is not None else "")
            for s, e in new_ranges)
        return range_specs
def _convert_range ( self , req , policy ) : segment_size = policy . ec_segment_size fragment_size = policy . fragment_size range_specs = [ ] new_ranges = [ ] for client_start , client_end in req . range . ranges : segment_start , segment_end = client_range_to_segment_range ( client_start , client_end , segment_size ) fragment_start , fragment_end = segment_range_to_fragment_range ( segment_start , segment_end , segment_size , fragment_size ) new_ranges . append ( ( fragment_start , fragment_end ) ) range_specs . append ( { 'req_client_start' : client_start , 'req_client_end' : client_end , 'req_segment_start' : segment_start , 'req_segment_end' : segment_end , 'req_fragment_start' : fragment_start , 'req_fragment_end' : fragment_end } ) req . range = "bytes=" + "," . join ( "%s-%s" % ( s if s is not None else "" , e if e is not None else "" ) for s , e in new_ranges ) return range_specs
Take the requested range(s) from the client and convert it to range(s)
to be sent to the object servers.
Take the requested range ( s ) from the client and convert it to range ( s ) to be sent to the object servers .
"""
        Take the requested range(s) from the client and convert it to range(s)
        to be sent to the object servers.

        This includes widening requested ranges to full segments, then
        converting those ranges to fragments so that we retrieve the minimum
        number of fragments from the object server.

        Mutates the request passed in.

        Returns a list of range specs (dictionaries with the different byte
        indices in them).
        """ # Since segments and fragments have different sizes, we need # to modify the Range header sent to the object servers to # make sure we get the right fragments out of the fragment # archives. # TODO: coalesce ranges that overlap segments. For # example, "bytes=0-10,20-30,40-50" with a 64 KiB # segment size will result in a Range header in the # object request of "bytes=0-65535,0-65535,0-65535", # which is wasteful. We should be smarter and only # request that first segment once.
self
req
policy