IP Library Granted Patent US 11,481,142
Granted Patent B2
US 11,481,142 · App. 16/957,059 · Granted Oct 25, 2022

Method and device for downloading resources

Inventor: Jie Shi (Beijing, CN)
Assignee: Alibaba Group Holding Limited
G06F3/0653G06F3/0604G06F3/067G11B5/59683H04L47/748H04L47/827H04L67/1065
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,481,142
App. No.
16/957,059
Granted
Oct 25, 2022
Kind
B2
Abstract

Method and device for downloading resources, applicable to a peer to peer (P2P) network. The method includes: initiating a downloading task according to a downloading request from a resource requester; acquiring data of the downloading task and writing the data of the downloading task to a memory; and reading the data from the memory and providing the data to the resource requester. The present invention can reduce the amount of magnetic disk consumption due to resource downloading.

Claims (52)

1. A method for downloading resources, applied to a peer-to-peer (P2P) network, the method comprising:

initiating a downloading task according to a downloading request from a resource requester;

acquiring data of the downloading task and writing the data of the downloading task to a memory;

reading the data from the memory and providing the data to the resource requester; and

writing the data in the memory to a magnetic disk based on a determination that the downloading task is complete when the data in the memory reaches a preset upper limit of use.

2. The method according to claim 1 , wherein the method further comprises:

determining whether the downloading task is complete when the data in the memory reaches the preset upper limit of use, wherein the downloading task being complete indicates that a complete resource is able to be acquired by the downloading task; and

filtering out the downloading task when the downloading task is incomplete so that the data in the memory will not be written to the magnetic disk.

3. The method according to claim 2 , wherein the method further comprises:

determining whether the downloading task is complete according to Range information in the downloading request.

4. The method according to claim 3 , wherein the method further comprises one or two of the following:

determining whether the Range information in the downloading request starts from 0, and determining that the downloading task is complete if the Range information starts from 0; and

identifying, according to the Range information in the downloading request, whether the downloading request corresponds to a Seek operation, and determining that the downloading task is incomplete if the downloading request corresponds to the Seek operation.

5. The method according to claim 4 , wherein the identifying, according to the Range information in the downloading request, whether the downloading request corresponds to the Seek operation, comprises:

determining, according to the Range information in the downloading request and Range information of a corresponding downloading task already existing in the memory, whether data corresponding to the downloading request is able to be spliced into a complete resource with corresponding data already existing in the memory; and

determining, if the data corresponding to the downloading request is able to be spliced into the complete resource with the corresponding data already existing in the memory, that the downloading request does not correspond to the Seek operation.

6. The method according to claim 2 , wherein:

the filtering out the downloading task when the downloading task is incomplete comprises: setting a downloading mode of the downloading task as a memory mode when the downloading task is incomplete, wherein the data in the memory will not be written to the magnetic disk in the memory mode; and

the writing the data in the memory to the magnetic disk when the downloading task is complete comprises: setting the downloading mode of the downloading task as a mode of magnetic disk+memory when the downloading task is complete, wherein the data in the memory will be written to the magnetic disk in the mode of magnetic disk+memory.

7. The method according to claim 6 , wherein:

the downloading mode of the downloading task is set by resetting a downloading mode parameter of the downloading task.

8. The method according to claim 1 , wherein the method further comprises:

determining whether the downloading task is complete when the data in the memory reaches the preset upper limit of use, wherein the downloading task being complete indicates that a complete resource is able to be acquired by the downloading task.

9. The method according to claim 8 , wherein the writing the data in the memory to the magnetic disk comprises:

when the data in the memory reaches the preset upper limit of use and the downloading task is complete, creating a file in the magnetic disk and writing the data in the memory to the file, or directly opening a file corresponding to the downloading task and writing the data in the memory to the opened file.

10. The method according to claim 8 , wherein the writing the data in the memory to the magnetic disk comprises:

splicing the data in the memory into a continuous data block and writing the continuous data block to the magnetic disk.

11. The method according to claim 8 , wherein the method further comprises:

when the data in the memory reaches the preset upper limit of use and the downloading task is complete, analyzing free space of the magnetic disk; and if the free space of the magnetic disk is not sufficient to store the data in the memory, performing an elimination operation on resources so as to write the data in the memory to the magnetic disk.

12. The method according to claim 1 , wherein acquiring the data of the downloading task and writing the data of the downloading task to the memory comprises:

initially allocating one or a plurality of fixed-sized memory blocks to the downloading task, and writing the data of the downloading task to the memory through recycling of the memory block(s).

13. The method according to claim 12 , wherein, after the data in the memory is written to the magnetic disk, a memory block occupied by the data in the memory is released.

14. The method according to claim 12 , wherein, after the data is read from the memory and provided to the resource requester, a memory block occupied by the data in the memory is released.

15. The method according to claim 1 , wherein acquiring the data of the downloading task and writing the data of the downloading task to the memory comprises:

initially allocating one or a plurality of fixed-sized memory blocks to the downloading task;

writing the data of the downloading task to the memory block(s) upon receipt of the data; when the memory block(s) is/are full, releasing part or all of the memory block(s) for use by subsequent data received; and repeating such an operation until the downloading task is completed.

16. A device for downloading resources, applied to a peer to peer (P2P) network, the device comprising:

an initiating module for initiating a downloading task according to a downloading request from a resource requester;

an acquisition module for acquiring data of the downloading task;

a memory module for writing the data of the downloading task to a memory;

a providing module for reading the data from the memory and providing the data to the resource requester; and

a magnetic-disk writing module for writing the data in the memory to a magnetic disk based on a determination that the downloading task is complete when the data in the memory reaches a preset upper limit of use.

17. The device according to claim 16 , wherein the device further comprises:

a determining module for determining whether the downloading task is complete when the data in the memory reaches the preset upper limit of use, wherein the downloading task being complete indicates that a complete resource is able to be acquired by the downloading task; and

a filtering module for filtering out the downloading task when the downloading task is incomplete so that the data in the memory will not be written to the magnetic disk.

18. The device according to claim 17 , wherein

the determining module is specifically configured to determine whether the downloading task is complete according to Range information in the downloading request.

19. The device according to claim 18 , wherein the determining module is specifically configured to determine whether the downloading task is complete by one or two of the following ways:

determining whether the Range information in the downloading request starts from 0, and determining that the downloading task is complete if the Range information starts from 0; and

identifying, according to the Range information in the downloading request, whether the downloading request corresponds to a Seek operation, and determining that the downloading task is incomplete if the downloading request corresponds to the Seek operation.

20. The device according to claim 17 , wherein

the magnetic-disk writing module is specifically configured to: when the data in the memory reaches the preset upper limit of use and the downloading task is complete, create a file in the magnetic disk and write the data in the memory to the file, or directly open a file corresponding to the downloading task and write the data in the memory to the opened file.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 29, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075499/0384 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 21, 2020
From: SHI, JIE
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 053564/0403 →
Priority Claims (1)
CN 201711406746.2 · Dec 22, 2017 · national
Continuity (1)
Related Publication 20210064270A1 · Mar 4, 2021