Skip to content

Keep in cache chunks that may be needed in later parts of the download stream #1284

@coyotte508

Description

@coyotte508

Eg sometimes the terms look like this:

    {
      "hash": "1c7d639dd1c16ad28b8acac35ad54bbc4000222f40e40a189913390eac09041b",
      "unpacked_length": 22778309,
      "range": { "start": 0, "end": 346 }
    },
    {
      "hash": "023f73d1ee9ab8c30f58f00e2ab701b4757dd1095720835923584fa27a6f9d20",
      "unpacked_length": 8128,
      "range": { "start": 629, "end": 630 }
    },
    {
      "hash": "1c7d639dd1c16ad28b8acac35ad54bbc4000222f40e40a189913390eac09041b",
      "unpacked_length": 14036784,
      "range": { "start": 346, "end": 571 }
    },
    {
      "hash": "023f73d1ee9ab8c30f58f00e2ab701b4757dd1095720835923584fa27a6f9d20",
      "unpacked_length": 8128,
      "range": { "start": 858, "end": 859 }
    },
    {
      "hash": "1c7d639dd1c16ad28b8acac35ad54bbc4000222f40e40a189913390eac09041b",
      "unpacked_length": 30196753,
      "range": { "start": 571, "end": 1087 }
    },

and in fetch_info, we have this:

    "1c7d639dd1c16ad28b8acac35ad54bbc4000222f40e40a189913390eac09041b": [
      {
        "range": { "start": 0, "end": 1087 },
        "url": "https://s3.us-east-1.amazonaws.com/xethub-xorb-bucket/xorbs/default/1c7d639dd1c16ad28b8acac35ad54bbc4000222f40e40a189913390eac09041b?x-id=GetObject&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA2JU7TKAQLRJCO34O%2F20250312%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250312T123613Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host%3Brange&X-Amz-Signature=8aae8823a8a19578faf34bf92879d8bce4b0cf7459ec17152017fda36d600448",
        "url_range": { "start": 0, "end": 67023668 }
      }
    ],

With current code, the whole section is fetched three times instead of only once.

Instead, we should do only one http call and save the data for when it's needed and clean it up when it's not needed afterwards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions