CN113411363A - Uploading method of image file, related equipment and computer storage medium - Google Patents

Uploading method of image file, related equipment and computer storage medium Download PDF

Info

Publication number
CN113411363A
CN113411363A CN202010183182.6A CN202010183182A CN113411363A CN 113411363 A CN113411363 A CN 113411363A CN 202010183182 A CN202010183182 A CN 202010183182A CN 113411363 A CN113411363 A CN 113411363A
Authority
CN
China
Prior art keywords
fragment
segment
data packet
image file
uploading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010183182.6A
Other languages
Chinese (zh)
Inventor
孙思东
申思
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010183182.6A priority Critical patent/CN113411363A/en
Priority to PCT/CN2021/075236 priority patent/WO2021184992A1/en
Publication of CN113411363A publication Critical patent/CN113411363A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/54Store-and-forward switching systems 
    • H04L12/56Packet switching systems
    • H04L12/5601Transfer mode dependent, e.g. ATM
    • H04L2012/5603Access techniques
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services

Abstract

The application provides an uploading method of an image file, related equipment and a computer storage medium, wherein the method comprises the following steps: acquiring a target mirror image file; the target mirror image file is fragmented to obtain fragments S1,S2,...,SmAnd the total number m of the fragments, wherein m is a positive integer; to data packet P1,P2,...,PnAnd the total number m of the fragments is sent to the uploading agent equipment, wherein, the data packet P1Comprising a segment S1And fragment sequence number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising a segment SnAnd a fragment number InN is a positive integer, and n is not more than m.

Description

Uploading method of image file, related equipment and computer storage medium
Technical Field
The present application relates to the field of virtualization technologies, and in particular, to an uploading method of an image file, a related device, and a computer storage medium.
Background
In an application scenario of a cloud service, an image service is presented in the form of a portal, so that a user needs to complete registration and uploading of an image through a browser. In the process of uploading files by the browser, the problem of file uploading interruption or uploading failure caused by poor network environment often occurs, and the browser does not support fragment uploading of the files, so that when a user uploads a large image file through the browser and unsuccessfully uploads the large image file to the server, the large image file needs to be uploaded again, and the uploading efficiency of the large image file is greatly reduced.
Currently, for a public cloud image service, a user needs to open a commercial object storage service and upload an image file through a special tool (e.g., a Packer and an OBS Browser), and this way requires that the user can upload the image file after downloading and learning the tool, thereby reducing the usability. For the mirror image service of the private cloud, an enterprise needs to deploy a dedicated object storage service, so that the method consumes higher cost and reduces the usability to a certain extent.
Disclosure of Invention
The embodiment of the application discloses a method for uploading a mirror image file, related equipment and a computer storage medium, which can effectively solve the problems that a browser does not support the uploading of a large mirror image file and the uploading efficiency is low.
In a first aspect, the present application provides an image file uploading method, applied to a client, including:
acquiring a target mirror image file;
the target mirror image file is fragmented to obtain fragments S1,S2,...,SmAnd the total number m of the fragments, wherein m is a positive integer;
to data packet P1,P2,...,PnAnd the total number m of the fragments is sent to an uploading agent device, wherein, the data packet P1Comprising a segment S1And fragment sequence number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising a segment SnAnd a fragment number InN is a positive integer, and n is not more than m.
In some possible designs, where n is less than m, the method further comprises: in case n is smaller than m, the methodThe method also comprises the following steps: sending a breakpoint resume request to the upload agent device to obtain the fragment sequence number InThe breakpoint continuous transmission request is used for requesting the fragment serial number corresponding to the fragment with the breakpoint; according to the fragment sequence number InData packet Pn+1And sending the data to the uploading agent equipment.
In some possible designs, the packet P is sent to a destination1,P2,...,PnThe sending to the upload agent device includes: using l threads, the data packet P is divided1,P2,...,PlSending the data to the uploading agent equipment in parallel; using the l threads, the data packet P is transmittedl+1,Pl+2,...,P2×lSending the data to the uploading agent equipment in parallel; …, respectively; using the l threads, the data packet P is transmittedn-l+1,Pn-l+2,...,PnAnd sending the data to the uploading agent equipment in parallel, wherein l is more than or equal to 1 and less than or equal to n/2, and l is a positive integer.
Therefore, the target image file to be uploaded can be fragmented in the client by using the method, and then the fragments of the target image file are sent to the uploading agent device. Therefore, when the uploading of the target image file is interrupted or fails in the uploading process, the client can re-upload the target image file from the fragment with failed transmission, and the uploading efficiency of the target image file is improved. And the client divides the target image file into pieces, and uploads the target image file by uploading the pieces, so that the uploading success rate of the target image file is improved. In addition, the client side can also send the fragments of the target image file to the uploading agent device in parallel, and the uploading efficiency of the target image file can be greatly improved.
In a second aspect, the present application provides another method for uploading an image file, which is applied to an upload agent device, and includes:
receiving the total number m of the fragments and the data packet P sent by the client1,P2,...,PnWherein the data packet P1Comprising a segment S1And a fragment number I1Data packet P2Comprising a segment S2And is divided intoChip number I2…, packet PnComprising a segment SnAnd a fragment number InSeparation of S1,S2,...,SmThe target image file is obtained by the client by fragmenting the target image file, wherein m and n are positive integers, and n is not more than m;
dividing the total number m of the fragments into S1,S2,...,SnAnd sending the data to the object storage device.
In some possible designs, in the case where n is less than m, the total number of fragments m and the data packet P sent at the receiving client1,P2,...,PnThereafter, the method further comprises: receiving a data packet P sent by the clientn+2,Pn+3,...,PmAnd dividing into pieces Sn+2,Sn+3,...,SmTo the object storage device, wherein the data packet Pn+2Comprising a segment Sn+2And a fragment number In+2Data packet Pn+3Comprising a segment Sn+3And a fragment number In+3…, packet PmComprising a segment SmAnd a fragment number Im(ii) a Receiving a breakpoint continuous transmission request sent by the client; according to the breakpoint continuous transmission request, the fragment sequence number I corresponding to the fragment with the breakpointnSending the data to the client; receiving the sequence number I of the client according to the fragmentsnTransmitted data packet Pn+1And sends the data packet Pn+1Sending the data to the object storage device for the object storage device to use according to the fragment S1,S2,...,SmRestoring the target image file, wherein the data packet Pn+1Comprising a segment Sn+1And a fragment number In+1
In some possible designs, where n is less than m, the method further comprises: receiving a breakpoint continuous transmission request sent by the client; according to the breakpoint continuous transmission request, the fragment sequence number I corresponding to the fragment with the breakpointnSending the data to the client; receiving the sequence number I of the client according to the fragmentsnFrom said data packet Pn+1The remainder of the transmissionAnd sending the fragments corresponding to the remaining data packets to the object storage device, so that the object storage device can use the fragments S1,S2,...,SmRestoring the target image file, wherein the remaining data packets comprise data packet Pn+1,Pn+2,...,PmSaid data packet Pn+1Comprising a segment Sn+1And a fragment number In+1Said data packet Pn+2Comprising a segment Sn+2And a fragment number In+2…, packet PmComprising a segment SmAnd a fragment number Im
In some possible designs, the method further comprises: receiving the data packet P sent by the client1And calling mirror image management equipment to create a mirror image identifier corresponding to the target mirror image file and storing the mirror image identifier.
In some possible designs, the method further comprises: and calling the mirror image management equipment to refresh the mirror image state corresponding to the target mirror image file.
In the method, the uploading agent equipment receives the fragments of the target image file sent by the client, forwards the fragments to the object storage equipment, and then restores the fragments into the target image file by the object storage equipment, thereby realizing the uploading of the target image file. Meanwhile, when the target image file is uploaded in the uploading process and is interrupted or fails to be uploaded, the uploading agent equipment can send the fragment serial numbers corresponding to the fragments with the breakpoints to the client, so that the client can continuously upload the target image file according to the fragment serial numbers corresponding to the fragments with the breakpoints, and the uploading efficiency and the uploading success rate of the image file are improved.
In a third aspect, the present application provides a client, including:
the acquisition unit is used for acquiring a target mirror image file;
a fragment processing unit for fragmenting the target image file to obtain a fragment S1,S2,...,SmAnd the total number m of the fragments, wherein m is a positive integer;
a transmitting unit for transmitting the data packet P1,P2,...,PnAnd the total number m of the fragments is sent to an uploading agent device, wherein, the data packet P1Comprising a segment S1And fragment sequence number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising a segment SnAnd a fragment number InN is a positive integer, and n is not more than m.
In some possible designs, in case n is smaller than m, the sending unit is further configured to: sending a breakpoint resume request to the upload agent device to obtain the fragment sequence number InThe breakpoint continuous transmission request is used for requesting the fragment serial number corresponding to the fragment with the breakpoint; according to the fragment sequence number InData packet Pn+1And sending the data to the uploading agent equipment.
In some possible designs, the sending unit is specifically configured to: using l threads, the data packet P is divided1,P2,...,PlSending the data to the uploading agent equipment in parallel; using the l threads, the data packet P is transmittedl+1,Pl+2,...,P2×lSending the data to the uploading agent equipment in parallel; …, respectively; using the l threads, the data packet P is transmitted1,P2,...,PnAnd sending the data to the uploading agent equipment in parallel, wherein l is more than or equal to 1 and less than or equal to n/2, and l is a positive integer.
In the client, the fragment processing unit fragments the target image file, so that the client uploads the target image file fragment. When the uploading of the target image file is interrupted or fails in the uploading process, the breakpoint continuous transmission of the image file can be realized by using the client, so that the uploading efficiency of the target image file can be improved, and the uploading success rate of the target image file can be improved. Meanwhile, the sending unit can also realize the concurrent uploading of the fragments, so that the uploading efficiency of the target image file can be improved greatly when the client side is used for uploading the image file.
In a fourth aspect, the present application provides an upload agent apparatus, including:
an obtaining unit, configured to receive a total amount m of fragments and a data packet P sent by a client1,P2,...,PnWherein the data packet P1Comprising a segment S1And a fragment number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising a segment SnAnd a fragment number InSeparation of S1,S2,...,SmThe target image file is obtained by the client by fragmenting the target image file, wherein m and n are positive integers, and n is not more than m;
a sending unit, configured to sum the total number of fragments m and the fragments S1,S2,...,SnAnd sending the data to the object storage device.
In some possible designs, in the case that n is smaller than m, the total number m of fragments and the data packet P sent by the client are received at the obtaining unit1,P2,...,PnThen, the obtaining unit is further configured to receive a data packet P sent by the clientn+2,Pn+3,...,PmAnd dividing into pieces Sn+2,Sn+3,...,SmTo the object storage device, wherein the data packet Pn+2Comprising a segment Sn+2And a fragment number In+2Data packet Pn+3Comprising a segment Sn+3And a fragment number In+3…, packet PmComprising a segment SmAnd a fragment number Im(ii) a The acquisition unit is also used for receiving a breakpoint continuous transmission request sent by the client; the sending unit is further configured to send a breakpoint resume request to a corresponding fragment sequence number I of a fragment with a breakpointnSending the data to the client; the obtaining unit is further configured to receive the fragment sequence number I from the clientnTransmitted data packet Pn+1And sends the data packet Pn+1Sending the data to the object storage device for the object storage device to use according to the fragment S1,S2,...,SmRestoring the target image file, wherein the data packetPn+1Comprising a segment Sn+1And a fragment number In+1
In some possible designs, in the case that n is smaller than m, the obtaining unit is further configured to receive a breakpoint resuming request sent by the client; the sending unit is further configured to send a breakpoint resume request to a corresponding fragment sequence number I of a fragment with a breakpointnSending the data to the client; the obtaining unit is further configured to receive the fragment sequence number I from the clientnFrom said data packet Pn+1Transmitting the remaining data packets to the object storage device for the object storage device to continue transmitting the remaining data packets according to the fragments S1,S2,...,SmRestoring the target image file, wherein the remaining data packets comprise data packet Pn+1,Pn+2,...,PmSaid data packet Pn+1Comprising a segment Sn+1And a fragment number In+1Said data packet Pn+2Comprising a segment Sn+2And a fragment number In+2…, packet PmComprising a segment SmAnd a fragment number Im
In some possible designs, the device further includes a call unit and a progress recording unit, where the call unit is configured to, upon receiving the data packet P sent by the client, send the data packet P to the client1Then, calling mirror image management equipment to create a mirror image identifier corresponding to the target mirror image file; and the progress recording unit is used for storing the mirror image identifier.
In some possible designs, the calling unit is further configured to: and calling the mirror image management equipment to refresh the mirror image state corresponding to the target mirror image file.
After the acquisition unit receives the fragments of the target image file sent by the client, the sending unit forwards the fragments to the target storage device, so that the target storage device can restore the target image file according to the fragments, and the target image file is uploaded. Moreover, when the target image file is uploaded in the uploading process and is interrupted or fails to be uploaded, the sending unit can send the fragment sequence numbers corresponding to the fragments with the breakpoints to the client, so that the client can continue to upload the target image file according to the fragment sequence numbers corresponding to the fragments with the breakpoints, and the uploading efficiency and the uploading success rate of the image file are improved.
In a fifth aspect, the present application provides an image file uploading system, which is characterized in that the system includes the client described in the third aspect, the uploading agent device described in the fourth aspect, an object storage device, and an image service device, wherein,
the object storage device is used for receiving the fragments S sent by the uploading agent device1,S2,...,SmAnd dividing the slice S1,S2,...,SmRestoring the target image file;
the mirror image management equipment is used for creating a mirror image identifier corresponding to the target mirror image file;
the mirror image management device is also used for refreshing the mirror image state of the target mirror image file.
In the image file uploading system, the client-side fragments the image file, transmits the fragments to the uploading agent device, forwards the fragments to the object storage device by the uploading agent device, and restores the fragments into the target image file by the object storage device, thereby completing the uploading of the target image file. Meanwhile, in the uploading process of the target image file, the image management device refreshes the image state of the target image file so as to determine whether the target image file is uploaded successfully. Therefore, by using the image file uploading system, breakpoint continuous transmission and fragment concurrent uploading of the target image file can be realized, the uploading efficiency of the target image file can be improved, and the uploading success rate of the target image file can be improved.
In a sixth aspect, the present application provides a client comprising a processor and a memory, the processor executing code in the memory to implement some or all of the steps of the first aspect.
In a seventh aspect, the present application provides an upload agent device, comprising a processor and a memory, wherein the processor executes code in the memory to implement part or all of the steps of the second aspect.
In an eighth aspect, the present application provides a computer storage medium storing computer instructions; the computer instructions are for implementing some or all of the steps as described in the first aspect.
In a ninth aspect, the present application provides a computer storage medium storing computer instructions; the computer instructions are for implementing some or all of the steps as described in the second aspect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a cloud system provided in the present application;
FIG. 2 is a schematic diagram of a specific cloud system provided herein;
FIG. 3 is a schematic structural diagram of an image file uploading system provided by the present application;
FIG. 4 is a schematic diagram of a mirror upload interface provided herein;
FIG. 5 is a schematic flow chart of uploading an image file provided by the present application;
FIG. 6 is a schematic flow chart of uploading an image file provided by the present application;
fig. 7 is a schematic structural diagram of a client provided in the present application;
fig. 8 is a schematic structural diagram of an upload agent apparatus provided in the present application;
fig. 9 is a schematic structural diagram of another client provided in the present application;
fig. 10 is a schematic structural diagram of another upload agent apparatus provided in the present application.
Detailed Description
Referring to fig. 1, fig. 1 shows a schematic structural diagram of a cloud system. The cloud system owner deploys the cloud computing infrastructure itself, i.e., deploys computing resources (e.g., servers) 110, deploys storage resources (e.g., memory) 120, and deploys network resources (e.g., network cards) 130, among others. An owner (e.g., an operator) of the public cloud virtualizes the computing resources, storage resources, and network resources of the cloud computing infrastructure and provides corresponding services to users (e.g., users) of the cloud for use. The operator can provide the following three services for the user to use: cloud computing infrastructure as a service (IaaS), platform as a service (PaaS), and software as a service (SaaS).
The services provided by IaaS to users are the utilization of the cloud computing infrastructure, including processing, storage, networking, and other basic computing resources, to enable users to deploy and run arbitrary software, including operating systems and applications. Users do not manage or control any cloud computing infrastructure, but can control operating system selection, storage space, deployment applications, and possibly limited network component (e.g., firewall, load balancer, etc.) control.
The services provided by PaaS to users are the deployment of applications developed or purchased by users in vendor-provided development languages and tools (e.g., Java, python, Net, etc.) onto the cloud computing infrastructure. The user does not need to manage or control the underlying cloud computing infrastructure, including networks, servers, operating systems, storage, etc., but the user can control the deployed applications and possibly also the hosting environment configuration in which the applications are run.
The services provided by SaaS to the user are applications that the operator runs on the cloud computing infrastructure, and the user can access the applications on the cloud computing infrastructure through a client interface (e.g., a browser) on various devices. The user does not need to manage or control any cloud computing infrastructure, including networks, servers, operating systems, storage, and the like.
Therefore, the user can run own business by using the service provided by the operator, such as deep learning, artificial intelligence, big data and the like.
Referring to fig. 2, fig. 2 shows a schematic diagram of a particular cloud system. The cloud system of the present application includes: a cloud management platform 210 and an infrastructure 220. The cloud management platform 210 provides cloud services for users by invoking the infrastructure 220, and the cloud management platform 210 may be OpenStack, cloudstock, Hadoop, AWS (Amazon Web Service), and the like, which is not limited herein.
Cloud management platform 210 may include a total 211, computing services 212, storage services 213, web services 214, and management services 215. Where protal211 may provide a user access to a cloud system or cloud service. The computing service 212 can be a component for deploying virtual machines and the like. The storage service 213 may be used to provide components of distributed, persistent virtual object storage, and the like. Network service 214 may be a component for providing network topology management of network nodes. The management service 215 may be a component for controlling other services.
Taking the cloud management platform 210 as OpenStack for example, the computing service 212 may be Nova, the storage service 213 may be Swift, Cinder, the web service 214 may be Neutron, and the management service 215 may be Glance, Nova, Horizon, Neutron, and Keystone, among others. The Glance is mainly responsible for managing metadata of various images provided in the cloud system, providing image management service for users, and specifically realizing functions of registering, searching, retrieving and the like of virtual machine images, so that users can conveniently select and install operating systems for the virtual machines. Furthermore, the backend storage of the gland supports interfacing with a plurality of storage types, such as Swift, simple storage service (S3), or container storage, and so on. Swift, as a default object storage scheme in OpenStack, is easier to build on a low-cost, standard hardware storage infrastructure than other storage schemes (e.g., S3, container storage, etc.), and supports fragmented upload of large object files (e.g., static large files and dynamic large files).
Therefore, the Swift is used as the back-end storage of the Glance to store the image file uploaded by the client browser. Referring specifically to fig. 3, fig. 3 illustrates an image file uploading system according to the present application. The image file uploading system may specifically include a client 310, an uploading agent device 320, an object storage device 330, and an image management device 340. In the present application, the object storage device 330 is a device with a Swift, and the mirror management device 340 is a device with a company, so the object storage device 330 is hereinafter referred to as the Swift, and the mirror management device 340 is hereinafter referred to as the company. The upload agent device 320, the object storage device 330, and the image management device 340 may be deployed on one computing device, or may be deployed on different computing devices, which is not limited herein.
In the application, when a user uploads a mirror image file through a client 310, firstly, the client 310 performs a fragmentation operation on the mirror image file, then, the fragment of the mirror image file is sent to an uploading proxy device 320, and after receiving the fragment of the mirror image file, the uploading proxy device 320 forwards the fragment of the mirror image file to a Swift330, and calls a Glance340 to refresh the state of the mirror image. Therefore, the system can upload the image file in a client fragment mode, namely, when the uploading of the image file is interrupted or fails in the uploading process, the client can continuously upload the image file from the breakpoint position without uploading the complete image file again, so that the transmission efficiency and the uploading success rate of the image file are greatly improved.
The present application will be described in detail below based on the image file upload system shown in fig. 3.
In a specific embodiment of the application, before the client sends the image file to be uploaded to the secondary management device, the client may receive a login request input by a user through a browser, and send the login request to the cloud management platform. The login request carries an account and a password, the login request is used for requesting to login the mirror image management system, and the mirror image management system is provided by the company. Then, the cloud management platform determines the login authority of the client according to the login request, and if the client has the login authority, a mirror image uploading interface is displayed in the browser interface, as shown in fig. 4. Taking fig. 4 as an example, the image files to be uploaded include a first image file, a second image file, and a third image file. The following description will be made in detail by taking the first image file as an example, and the uploading method of the image file provided by the present application can be specifically divided into the following two cases.
First, a case where the upload of the first image file is not interrupted or failed in the upload process is described. As shown in fig. 5, fig. 5 is a schematic flowchart illustrating an uploading method of an image file provided by the present application. The image file uploading method of the embodiment includes, but is not limited to, the following steps:
s101, the client side obtains a first mirror image file.
In a specific embodiment of the present application, after the client acquires the first image file, it is determined whether the size of the first image file is greater than a preset threshold. If the size of the first image file is larger than a preset threshold value, executing S102; and if the size of the first image file is smaller than or equal to the preset threshold, the client sends the first image file to the uploading proxy equipment, and the uploading proxy equipment forwards the first image file to the Swift for storage. When the Swift receives the first image file, the uploading agent device calls a Glance interface to refresh the image state of the first image file.
In a more specific embodiment, the client receives a dragging instruction input by a user through a browser, and acquires the first image file according to the dragging instruction. The image uploading interface provides a file reading interface, and the dragging instruction is used for dragging the first image file to the file reading interface. The client determines the size of the first image file based on the file reading interface, and if the size of the first image file is larger than a preset threshold, S102 is executed; if the size of the first image file is smaller than or equal to the preset threshold, S107 is executed. In addition, the client may also receive other types of instructions (e.g., a selection instruction) input by the user through the browser, so as to obtain the first image file.
S102, the client performs fragmentation operation on the first image file according to the preset fragmentation sizeTo obtain the fragment S of the first mirror image file1,S2,...,SmAnd a fragmentation total m, wherein m is a positive integer.
In a specific embodiment of the present application, the client performs a fragment operation on the first image file according to a preset fragment size to obtain a fragment S1,S2,...,SmAnd is a segment S1Adding fragment sequence number I1Separation of S2Adding fragment sequence number I2…, slicing SmAdding fragment sequence number ImThereby obtaining a data packet P1,P2,...,Pm. Wherein the data packet P1Comprising a segment S1And a fragment number I1Data packet P2Comprising a segment S2And a fragment number I2…, packet PmComprising a segment SmAnd a fragment number Im. Wherein, the sequence number of the fragment I1,I2,...,ImFor representing slices S1,S2,...,SmIn a sequential order, i.e. slicing S1Is the 1 st slice, slice S22 nd fragment, …, fragment SmThe mth slice.
To be noted, packet P1,P2,...,PmThe first mirror image file may also carry information such as a file name of the first mirror image file and a size of the corresponding fragment, and is not specifically limited herein.
S103, the client side sends the data packet P1,P2,...,PmAnd the total number m of the fragments is sent to the uploading agent equipment.
In one possible embodiment, the client sends packet P1,P2,...,PmAnd sequentially sending the data to the uploading agent equipment.
In another possible embodiment, the client uses l threads to simultaneously transmit packet P1,P2,...,PlSending to the uploading agent device, when the uploading agent device receives the data packet P1,P2,...,PlThen, the client uses the above-mentioned one thread to simultaneously transmit the data packet Pl+1,Pl+2,...,P2×lTransmitting to the uploading agent device until the client side sends the data packet P1,P2,...,PmAll sent to the upload agent device. Wherein l is more than or equal to 1 and less than or equal to m2, and l is a positive integer. Therefore, the uploading times and the file data stream can be effectively reduced by a fragmentation concurrency mode.
In particular embodiments of the present application, when a client first sends a data packet to an upload agent device (e.g., data packet P)1Or a data packet P1,P2,...,Pl) And then, the uploading proxy equipment calls a Glance interface to create mirror image data, so as to obtain the mirror image Identification (ID) corresponding to the mirror image data. Then, the uploading agent device creates an empty object file named by the mirror ID according to the mirror ID. The mirror metadata is used to describe the first image, and may specifically include an image ID of the first image, a size of the first image, an image state of the first image, an image format (e.g., qcow2 format, vhd format) of the first image, and the like. The image ID is used to identify the first image.
S104, the uploading agent device divides the total number m of the fragments into D1,D2,...,DmAnd sending to Swift.
In one possible embodiment, if the client sends packet P1,P2,...,PmSequentially sending the data to the uploading agent equipment, and then the uploading agent equipment will segment D1,D2,...,DmAnd in turn to Swift.
Specifically, the upload agent device receives the packet P1Then, according to the data packet P1And mirror ID, as shard S1Add object prefix name N1To obtain a segment D1Then segment D1Sent to Swift. Wherein, the object prefix name N1Including mirror ID and segment D1Corresponding segment sequence number, segment D1The corresponding segment sequence number is the fragment sequence number I1. If Swift receives segment D1The upload agent device saves segment D in the segment upload record1Mirror ID and segment D of1The corresponding segment sequence number. Same as aboveThe transmission agent device receives the data packet P2Then, according to the data packet P2And mirror ID, as shard S2Add object prefix name N2To obtain a segment D2Then segment D2Sent to Swift. Wherein, the object prefix name N2Including mirror ID and segment D2Corresponding segment sequence number, segment D2The corresponding segment sequence number is the fragment sequence number I2. If Swift receives segment D2The upload agent device saves segment D in the segment upload record2Mirror ID and segment D of2The corresponding segment sequence number. … are provided. The uploading agent equipment receives the data packet PmThen, according to the data packet PmAnd mirror ID, as shard SmAdd object prefix name NmTo obtain a segment DmThen segment DmSent to Swift. Wherein, the object prefix name NmIncluding mirror ID and segment DmCorresponding segment sequence number, segment DmThe corresponding segment sequence number is the fragment sequence number Im. If Swift receives segment DmThe upload agent device saves segment D in the segment upload recordmMirror ID and segment D ofmThe corresponding segment sequence number.
The object prefix name may be specifically represented as a mirror ID-segment sequence number, the format of the mirror ID may be set to a storage format default to the global, such as xxxxxxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxxxxxxxxxxxxxx, the segment sequence number may also be set to a storage format default to the global, and the segment sequence numbers are in one-to-one correspondence, such as segment sequence number I15(00015) The corresponding segment sequence number is 00015, so the object prefix name N15Can be represented as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxx-00015. The segment upload record can be seen in table 1, and the segment S can be seen from table 11The corresponding object prefix name is xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx-00001, slice S2The corresponding object prefix name is xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx-00002, …, slice SmThe corresponding object prefix name is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx-m.
TABLE 1 segmented upload records
Mirror ID Sequence number of segment
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 00001
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 00002
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 00003
….
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx m
In another possible embodiment, if the client sends packet P1,P2,...,PlSending the P to the uploading agent equipment in parallell+1,Pl+2,...,P2×lIn parallel to the upload agent device …, sends the packet Pm-l+1,Pm-l+2,...,PmSending the segments to the uploading agent device in parallel, and then the uploading agent device sends the segments D1,D2,...,DlSending the segments D to Swift in parallell+1,Dl+2,...,D2×lSend to Swift, … in parallel, segment Dm-l+1,Dm-l+2,...,DmParallel transmissionGiven Swift.
Specifically, the upload agent device receives the packet P1,P2,...,PlThen, according to the data packet P1,P2,...,PlAnd mirror ID, respectively, as fragment S1,S2,...,SlAdd object prefix name N1,N2,...,NlTo obtain a segment D1,D2,...,DlThen segment D1,D2,...,DlAnd sent to Swift in parallel. Wherein, the object prefix name N1Including mirror ID and segment D1Corresponding segment sequence number, segment D1The corresponding segment sequence number is the fragment sequence number I1(ii) a Object prefix name N2Including mirror ID and segment D2Corresponding segment sequence number, segment D2The corresponding segment sequence number is the fragment sequence number I2(ii) a …, respectively; object prefix name NlIncluding mirror ID and segment DmCorresponding segment sequence number, segment DlThe corresponding segment sequence number is the fragment sequence number Il. If Swift receives segment D1,D2,...,DlIf so, the upload agent device stores the segments D in the segment upload records respectively1,D2,...,DlMirror ID and segment D of1,D2,...,DlThe corresponding segment sequence number. It should be appreciated that the upload agent device will fragment Sl+1,Sl+2,...,S2×lParallel to the Swift process, …, the slice Sm-l+1,Sm-l+2,...,SmSending the same to the Swift process and uploading the agent device to segment S1,S2,...,SlThe process of sending the Swift in parallel is similar, and detailed description is omitted here.
It can be seen that the above steps implement a process from an input stream of the uploading proxy device to an output stream of the Swift, that is, the image file is read from the uploading proxy device and written into the Swift, so that the image file is uploaded to the Swift without local cache, thereby not only improving the uploading efficiency of the image file, but also saving the storage space.
S105、SwiftBy object prefix name N1,N2,...,NmWill divide into pieces S1,S2,...,SmAnd merging the images into a first image file.
In a specific embodiment of the present application, Swift is based on the received segment D1To obtain a fragment S1And object prefix name N1(ii) a Swift according to the received segment D2To obtain a fragment S2And object prefix name N2(ii) a …, respectively; swift according to the received segment DmTo obtain a fragment SmAnd object prefix name Nm. Also, Swift is according to segment D1,D2,...DmThe object prefix name of (2) can also obtain the fragment S1,S2,...,SmAnd corresponding segment sequence number, thereby determining the segment S1,S2,...,SmAll belong to a fragment of the first image file. When the Swift receives all the segments, that is, the uploading proxy device determines that the number of the segments recorded in the segment uploading record is the same as the total number m of the segments, the uploading proxy device sends an object file named by a mirror image ID to the Swift, and calls a Swift interface to enable the Swift to obtain the object prefix name N according to the object prefix name1,N2,...,NmThe first mirror image file is divided into sections S1,S2,...,SmAnd merging according to the segment sequence number to obtain a first mirror image file.
S106, the uploading agent device obtains the uploading progress of the first mirror image file according to the segmented uploading record and the total fragment amount m, and then calls a Glance interface to refresh the mirror image state of the first mirror image.
The mirror state includes a queue state, a viewing state, an active state, a kill state, and the like. The queued state represents waiting for the image file to be uploaded; the saving state indicates that the image file is being uploaded; the active state represents that the uploading of the mirror image file is finished, and the mirror image can be used at the moment; the kill state indicates that an error occurred during the uploading of the image file.
In a specific embodiment of the application, the upload agent device determines an upload progress of the first image file according to the segmented upload record, and then calls a Glance interface to refresh an image state corresponding to the first image file. If the image ID and the segment serial number of any segment are not stored in the segment uploading record, the uploading progress of the first image file is 0, and the state of the first image file is queued. If the mirror image IDs of the k segments and the corresponding k segment serial numbers of the k segments are stored in the segment uploading record, it indicates that the uploading progress of the first mirror image file is k/m, and the state of the first mirror image is a saving state at this time. If the mirror image IDs of the m segments and the corresponding m segment serial numbers are stored in the segment uploading record, the uploading progress of the first mirror image file is 100%, and at this time, the state of the first mirror image is an active state. If the uploading process is interrupted or fails, the state of the first mirror image is a killed state.
In the specific embodiment of the present application, when Swift divides a slice S1,S2,...,SmAfter the first mirror image file is combined, the uploading proxy equipment calls a Glance interface to refresh the mirror image state of the first mirror image, and the first mirror image is determined to be in an available state, so that the registration of the first mirror image is completed.
For example, assume that the size of the first image file is 130GB, and the preset fragment size is 50 Megabytes (MB). After the file reading interface receives the first image file, the client processes the first image file into 2663 fragments according to the preset fragment size, namely fragment S1,S2,...,S2663Wherein the total number of the fragments is 2663, and the fragments S1,S2,...,S2662Are all 50MB, slice S2663Is 20 MB. The client is a fragment S1,S2,...,S2663Sequentially adding fragment sequence numbers to obtain a data packet P1,P2,...,P2663Wherein the sheet S is divided1Fragment sequence number I of100001, slice S2Fragment sequence number I of2Is recorded as 00002, …, slice S2663Fragment sequence number I of2663Noted as 02663. Client side sends data packet P1And the total amount of the fragments is transmitted to an uploading agent device which receives the data packet P1And calls the Glance interface to create mirror elementsAnd (4) acquiring a mirror ID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxx), and then creating a target object file named by the mirror ID according to the mirror ID. Then, the uploading agent device is based on the data packet P1And mirror ID, which is the acquired fragment S1Add object prefix name N1(xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx-00001) to obtain the segment D1And segment D1And forwarded to Swift. When Swift receives segment D1The uploading agent device will segment D1The corresponding mirror ID and segment sequence number (00001) are saved in the segment upload record. Similarly, the client will package P2Sending the data packet to an uploading agent device which sends the data packet to the uploading agent device according to the data packet P2And mirror ID, to the received fragment S2Add object prefix name N2(xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx-00002) to obtain the segment D2And segment D2Forwarding to Swift, when Swift receives segment D2The upload agent device will segment D2The corresponding mirror image ID and the segment serial number (00002) are stored in the segment uploading record; …, respectively; client side sends data packet P2663Sending the data packet to an uploading agent device which sends the data packet to the uploading agent device according to the data packet P2663And mirror ID, to the received fragment S2663Add object prefix name N2663(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxxxxxxxxxx-02663) to give a section D2663And segment D2663Forwarding to Swift, when Swift receives segment D2663The upload agent device will segment D2663The corresponding image ID and segment sequence number (02663) are stored in the segment upload record. At this time, the uploading proxy equipment sends the target object file to the Swift, and will call the Swift interface, so that the Swift can obtain the object prefix name N1,N2,...,N2663Will divide into pieces S1,S2,...,S2663And merging the images into a first image file. In addition, the uploading agent device also calls a Glance interface periodically to refresh the mirror image state of the first mirror image according to the segmented uploading record and the total amount of the fragments in the uploading process of the first mirror image file. Slicing S at Swift1,S2,...,S2663Merge into a first mirror imageAfter the file is stored, the uploading agent device refreshes the mirror image state of the first mirror image by calling a Glance interface, and the mirror image state of the first mirror image is obtained to be an available state, so that the registration of the first mirror image is completed.
In the method, when the uploading interruption or uploading failure of the mirror image file does not occur in the uploading process, the client divides the mirror image file, sends the divided pieces of the mirror image file to the uploading agent device, and forwards the divided pieces corresponding to the divided pieces to the Swift by the uploading agent device, so that the Swift can combine the divided pieces into the mirror image file according to the received divided pieces and the object prefix name. Therefore, the method can realize uploading by using the fragments of the image files instead of the image files, thereby improving the uploading success rate of the image files. In addition, the client can also send the fragments of the image file to the uploading agent device in parallel, and then the uploading agent device sends the fragments to the Swift in parallel, so that the uploading efficiency of the image file is improved.
When the client sends the fragments of the first image file to the upper-generation proxy device, the upload proxy device may not completely receive all the fragments S of the first image file due to network reasons or abnormal upload proxy device1,S2,...,Sm. Then, the image file uploading method provided by the present application will be described next by taking an example that an uploading interruption occurs in the uploading process of the first image file or that a single fragmented uploading fails. As shown in fig. 6, fig. 6 is a schematic flowchart illustrating a method for uploading an image file provided by the present application. The image file uploading method of the embodiment includes, but is not limited to, the following steps:
s201, the client sends a breakpoint resuming request to the uploading agent device.
The breakpoint continuous transmission request carries a mirror image ID corresponding to the first mirror image file, and is used for requesting a fragment serial number corresponding to a fragment at the breakpoint when the uploading is interrupted or fails.
In a specific embodiment of the present application, a situation that uploading of a single fragment fails occurs when a client uploads a fragment of a first image file, for example, the client uploads a fragment of a first image fileThe uploading agent device does not receive the fragment Sn+1. Or, when the client uploads the fragment of the first image file, the uploading is interrupted, that is, the uploading agent device does not receive the fragment Sn+1,Sn+2,...,Sm. Wherein n is more than or equal to 1<m and n are positive integers.
In one possible embodiment, when the client sends a packet P to the upload agent devicen+1In time, network interruption, uploading of a data packet which is not supported by the current network environment, abnormality of the uploading agent device and the like occur, so that the uploading agent device does not receive the data packet Pn+1. When the client sends a data packet P to the uploading agent devicen+2When the network environment or the uploading agent equipment and the like return to normal, the uploading agent equipment can receive the data packet Pn+2,Pn+3,...,PmIn other words, the upload agent apparatus receives the packet P1,P2,...,Pn,Pn+2,Pn+3,...,Pm
In another possible embodiment, when the client sends a packet P to the upload agent devicen+1In time, network interruption, uploading of a data packet which is not supported by the current network environment, abnormality of the uploading agent device and the like occur, so that the uploading agent device cannot receive the slave data packet Pn+1The remaining data packet (P) of the beginningn+1,Pn+2,...,Pm) At this time, the uploading agent device only receives the data packet P1,P2,...,Pn
S202, the uploading agent equipment sends the fragment sequence number I corresponding to the fragment at the breakpoint to the client according to the breakpoint continuous transmission requestn
In a specific embodiment of the application, after the upload agent device receives the breakpoint resume request, a company interface is called to refresh the mirror state of the first mirror according to the mirror ID corresponding to the first mirror file, so as to obtain a file upload token (token). Then, the uploading agent device uploads the fragment sequence number I corresponding to the fragment (fragment) with the breakpoint in the record in the fragment uploading mode according to the file uploading tokenn(segment sequence number) to the client, so that the clientCan be according to the fragment sequence number InFrom the data packet Pn+1And starting the rest data packets which are continuously transmitted.
S203, the client side according to the fragment sequence number InAnd sending a data packet corresponding to the uploading failed fragment to the uploading agent equipment, and sending the segment corresponding to the uploading failed fragment to the Swift by the uploading agent equipment.
In one possible embodiment, the client end is based on the fragment sequence number InSending data packet P only to upper sub-management devicen+1. Wherein the data packet Pn+1Comprising fragmentation Sn+1And fragment sequence number In+1. The uploading agent equipment receives the data packet Pn+1Then, according to the data packet Pn+1And the mirror image ID of the first mirror image file is a fragment Sn+1Add object prefix name Nn+1To obtain a segment Dn+1Then segment Dn+1Sent to Swift. Wherein, the object prefix name Nn+1Including mirror ID and segment Dn+1Corresponding segment sequence number, segment Dn+1The corresponding segment sequence number is the fragment sequence number In+1. If Swift receives segment Dn+1The upload agent device saves segment D in the segment upload recordn+1Mirror ID and segment D ofn+1The corresponding segment sequence number.
In another possible embodiment, the client end is based on the fragment sequence number InSequentially sending data packets P to the upper sub-management devicen+1,Pn+2,...,Pm. Wherein the data packet Pn+1Comprising fragmentation Sn+1And fragment sequence number In+1Data packet Pn+2Comprising fragmentation Sn+2And fragment sequence number In+2…, packet PmComprising fragmentation SmAnd fragment sequence number Im. The uploading agent equipment receives the data packet Pn+1Then, according to the data packet Pn+1And mirror ID, as shard Sn+1Add object prefix name Nn+1To obtain a segment Dn+1Then segment Dn+1Sent to Swift. Wherein, the object prefix name Nn+1Including mirror ID and segment Dn+1Corresponding segment sequence number, segment Dn+1The corresponding segment sequence number is the fragment sequence number In+1. If Swift receives segment Dn+1The upload agent device saves segment D in the segment upload recordn+1Mirror ID and segment D ofn+1The corresponding segment sequence number. The uploading agent equipment receives the data packet Pn+2Then, according to the data packet Pn+2And mirror ID, as shard Sn+2Add object prefix name Nn+2To obtain a segment Dn+2Then segment Dn+2Sent to Swift. Wherein, the object prefix name Nn+2Including mirror ID and segment Dn+2Corresponding segment sequence number, segment Dn+2The corresponding segment sequence number is the fragment sequence number In+2. If Swift receives segment Dn+2The upload agent device saves segment D in the segment upload recordn+2Mirror ID and segment D ofn+2The corresponding segment sequence number. … are provided. The uploading agent equipment receives the data packet PmThen, according to the data packet PmAnd mirror ID, as shard SmAdd object prefix name NmTo obtain a segment DmThen segment DmSent to Swift. Wherein, the object prefix name NmIncluding mirror ID and segment DmCorresponding segment sequence number, segment DmThe corresponding segment sequence number is the fragment sequence number Im. If Swift receives segment DmThe upload agent device saves segment D in the segment upload recordmMirror ID and segment D ofmThe corresponding segment sequence number.
In another possible embodiment, the client uses l threads to transmit packet Pn+1,Pn+2,...,Pn+lThe data packets are sent to the uploading agent device in parallel until the uploading agent device receives the data packet Pm. The uploading agent equipment receives the data packet Pn+1,Pn+2,...,Pn+lThen, according to the data packet Pn+1,Pn+2,...,Pn+lAnd mirror ID, respectively, as fragment Sn+1,Sn+2,...,Sn+lAdd object prefix name Nn+1,Nn+2,...,Nn+lThereby obtaining a segment Dn+1,Dn+2,...,Dn+lThen segment Dn+1,Dn+2,...,Dn+lAnd sent to Swift in parallel. Wherein, the object prefix name Nn+1Including mirror ID and segment Dn+1Corresponding segment sequence number, segment Dn+1The corresponding segment sequence number is the fragment sequence number In+1(ii) a Object prefix name Nn+2Including mirror ID and segment Dn+2Corresponding segment sequence number, segment Dn+2The corresponding segment sequence number is the fragment sequence number In+2(ii) a …, respectively; object prefix name Nn+lIncluding mirror ID and segment Dn+lCorresponding segment sequence number, segment Dn+lThe corresponding segment sequence number is the fragment sequence number In+l. If Swift receives segment Dn+1,Dn+2,...,Dn+lIf so, the upload agent device stores the segments D in the segment upload records respectivelyn+1,Dn+2,...,Dn+lMirror ID and segment D ofn+1,Dn+2,...,Dn+lThe corresponding segment sequence number.
S205, Swift divides S1,S2,...,SmAnd merging the images into a first image file.
In one possible embodiment, before the client sends the breakpoint resume request to the upload agent device, the Swift stores the segment D1,D2,...,Dn,Dn+2,Dn+3,...,Dm. Wherein segment D1,D2,...,Dn,Dn+2,Dn+3,...,DmIs based on data packet P by the uploading agent device1,P2,...,Pn,Pn+2,Pn+3,...,PmAnd mirror ID, respectively, as fragment S1,S2,...,Sn,Sn+2,Sn+3,...,SmAdd object prefix name N1,N2,...,Nn,Nn+2,Nn+3,...,NmAnd then obtaining the product. When Swift receives segment DnThen Swift according to segment D1,D2,...,Dn,Dn+1,Dn+2,...,DmObject prefix name of (N)1,N2,...,Nn,Nn+1,Nn+2,...,NmWill divide into pieces S1,S2,...,SmAnd merging the images into a first image file.
In another possible embodiment, before the client sends the breakpoint resume request to the upload agent device, the fragment D is saved in the Swift1,D2,...,Dn. Wherein segment D1,D2,...,DnIs based on data packet P by the uploading agent device1,P2,...,PnAnd mirror ID, respectively, as fragment S1,S2,...,SnAdd object prefix name N1,N2,...,NnAnd then obtaining the product. When Swift receives segment Dn+1,Dn+2,...,DmThen Swift according to segment D1,D2,...,Dn,Dn+1,Dn+2,...,DmObject prefix name of (N)1,N2,...,Nn,Nn+1,Nn+2,...,NmWill divide into pieces S1,S2,...,SmAnd merging the images into a first image file.
S206, the uploading agent device obtains the uploading progress of the first mirror image file according to the segmented uploading record and the total fragment amount m, and then calls a Glance interface to refresh the mirror image state of the first mirror image.
In the specific embodiment of the present application, when Swift divides a slice S1,S2,...,SmAfter the first mirror image file is combined, the agent component calls a Glance interface to refresh the mirror image state of the first mirror image, and the first mirror image is determined to be in an available state, so that the registration of the first mirror image is completed. In addition, in the process of breakpoint continuous transmission of the fragments which are failed to upload, the upload agent device can call the Glance interface to refresh the mirror state of the first mirror.
For example, assume that the size of the first image file is 500GB, and the preset fragment size is 200 MB. After the file reading interface receives the first image file, the client browser processes the first image file into 2560 fragments according to the preset fragment size, namely fragment S1,S2,...,S2560. Wherein the total number of the slices is 2560Separation of S1,S2,...,S2560Are all 200MB in size. The browser is divided into S1,S2,...,S2560Sequentially adding fragment sequence numbers to obtain a data packet P1,P2,...,P2560. Wherein, the slice S1Fragment sequence number I of100001, slice S2Fragment sequence number I of2Is recorded as 00002, …, slice S2560Fragment sequence number I of2560Noted as 02560. Client side sends data packet P1And the total amount of the fragments is transmitted to an uploading agent device which receives the data packet P1And calling a Glance interface to create mirror metadata so as to obtain a mirror ID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxxxx), and then creating a target object file named by the mirror ID according to the mirror ID. The uploading agent equipment receives the data packet P1Then, according to the data packet P1And mirror ID as fragment S1Add object prefix name N1(xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxx-00001), to give segment D1And segment D1Sending to Swift, when Swift receives segment D1The upload agent device saves segment D in the segment upload record1The corresponding mirror ID and its segment sequence number (00001); client side sends data packet P2Sending the data packet to an uploading agent device which receives the data packet P2Then, according to the data packet P2And mirror ID as fragment S2Add object prefix name N2(xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxx-00002) to obtain the segment D2And segment D2Sending to Swift, when Swift receives segment D2The upload agent device saves segment D in the segment upload record2The corresponding mirror ID and its segment sequence number (00002); …, respectively; client side sends data packet P2000Sending the data packet to an uploading agent device which receives the data packet P2000Then, according to the data packet P2000And mirror ID as fragment S2000Add object prefix name N2000(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxx-02000) to give a segment D2000And segment D2000Sent to SwiftWhen Swift receives segment D2000The upload agent device saves segment D in the segment upload record2000The corresponding mirror ID and its segment number (02000). When the client sends a data packet P to the uploading agent device2001When, due to network interruption, packet P2001And the remaining data packets cannot be transmitted to the upload agent device. When the network is restored, the client sends a breakpoint resuming request to the uploading agent device. The uploading agent equipment sends the fragment sequence number I to the client according to the breakpoint resume request2000(02000). Then, the client end processes the fragment sequence number I2000Sending data packet P to an upload agent device2001The uploading agent equipment receives the data packet P2001Then, according to the data packet P2001And mirror ID as fragment S2001Add object prefix name N2001(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxx-02001), thereby obtaining a segment D2001And segment D2001Sending to Swift, when Swift receives segment D2001The upload agent device saves segment D in the segment upload record2001The corresponding mirror ID and its segment number (02001); …, respectively; the client sends a data packet P to the uploading agent device2560The uploading agent equipment receives the data packet P2560Then, according to the data packet P2560And mirror ID as fragment S2560Add object prefix name N2560(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxxxxxxxxxx-02560), thereby obtaining a segment D2560And segment D2560Sending to Swift, when Swift receives segment D2560The upload agent device saves segment D in the segment upload record2560The corresponding mirror ID and its segment sequence number (02560). At this time, the upload agent apparatus calls the Swift interface so that the Swift is according to the object prefix name N1,N2,...,N2560Will divide into pieces S1,S2,...,S2560And merging the images into a first image file. In addition, the uploading agent device also calls a Glance interface periodically to refresh the mirror image state of the first mirror image according to the segmented uploading record and the total amount of the fragments in the uploading process of the first mirror image file. Slicing S at Swift1,S2,...,S2560After the first mirror image file is merged, the uploading proxy equipment refreshes the mirror image state of the first mirror image by calling a Glance interface to obtain that the mirror image state of the first mirror image is in an available state, and therefore the registration of the first mirror image is completed.
It should be understood that, when the size of the first image file is smaller than or equal to the preset threshold and the uploading of the first image file is interrupted or failed in the uploading process, the browser uploads the first image file to the uploading agent again, and then the uploading agent forwards the first image file to the Swift for storage. When the Swift receives the first image file again, the uploading agent device calls a Glance interface to refresh the image state of the first image file.
It should be noted that the preset slice size may be 50MB or 200MB, or 60MB or 150MB, etc. in the above embodiments, which is not limited herein.
For simplicity, the data packet P is not described in this embodiment1,P2,...,Pn-1,Pn+1,...,PmP1,P2,...,PmData packet P1,P2,...,Pn-1Definition and acquisition procedure of, segment D1,D2,...,Dn-1,Dn+1,...,DmSegment D1,D2,...,Dn-1The definition and the acquisition process of (A) are explained in detail, and the Swift is not divided into the slices S1,S2,…,SmThe specific process of merging into the first image file and the process of calling the global interface by the upload agent device to refresh the image state are described in detail, and details of the segment upload record are not described yet, which may be specifically referred to as S101-S107 and related embodiments thereof, and are not described herein again. In this embodiment, only an application scenario where a single fragment upload fails is described, and the similar method may also be applied to an application scenario where multiple fragments upload fails, which is not described herein again. In addition, only the uploading method of the first image file is described in detail in the above two embodiments, and in practical application, the uploading method of the second image file, the third image file and so on is similar to the uploading process of the first image file, and hereAnd will not be described in detail.
In the method, when the uploading of the image file is interrupted or fails in the uploading process, the client sends the breakpoint continuous transmission request to the uploading agent device, so that the fragment serial number corresponding to the fragment with the breakpoint is obtained, the client can resend the fragment with the uploading failure to the uploading agent device, and the uploading process of the image file is completed. Therefore, the method can realize breakpoint continuous transmission of the image file, and improve the uploading success rate and uploading efficiency of the image file. In addition, the client can also send the fragments of the image file to the uploading agent device in parallel, and then the uploading agent device sends the fragments to the Swift in parallel, so that the uploading efficiency of the image file is improved.
With reference to fig. 1 to fig. 6 and the related embodiments, the following will describe related apparatuses related to the embodiments in detail by taking the uploading process of the first image file as an example.
In this embodiment, the client 310 may be an entity for receiving or transmitting a signal at a user side, such as a new generation User Equipment (UE), and specifically may include a mobile phone, a tablet computer, a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), a notebook computer, an intelligent wearable device (e.g., a smart watch, a smart bracelet), and the like. Specifically, referring to fig. 7, fig. 7 is a schematic structural diagram of a client according to the present application. The client 310 may include an acquisition unit 410, a fragment processing unit 420, and a transmission unit 430. Wherein the content of the first and second substances,
the obtaining unit 410 is configured to obtain a first image file.
The fragment processing unit 420 is configured to perform a fragment operation on the first image file according to a preset fragment size to obtain a fragment S of the first image file1,S2,...,SmAnd a fragmentation total m, wherein m is a positive integer.
The sending unit 430 is used for sending the data packet P1,P2,...,PmAnd the total number m of the fragments is sent to the uploading agent equipment.
In a specific embodiment of the present application, the obtaining unit 410 is further configured to determine whether the size of the first image file is greater than a preset threshold after obtaining the first image file, and send the first image file 311 to the fragment processing unit 420 if the size of the first image file is greater than the preset threshold; if the size of the first image file is smaller than or equal to the preset threshold, the first image file is sent to the sending unit 430, and then the sending unit 430 sends the first image file to the upload agent device.
In a more specific embodiment, the obtaining unit 410 may obtain the first image file by receiving a drag instruction input by a user, and obtaining the first image file according to the drag instruction; the obtaining unit 410 may further obtain the first image file and the like according to a selection instruction input by a user, and is not limited in particular here.
In a specific embodiment of the present application, the fragment processing unit 420 is specifically configured to perform a fragment operation on the first image file according to a preset fragment size to obtain a fragment S1,S2,...,SmAnd is a segment S1Adding fragment sequence number I1Separation of S2Adding fragment sequence number I2…, slicing SmAdding fragment sequence number ImThereby obtaining a data packet P1,P2,...,Pm. Wherein the data packet P1Comprising a segment S1And a fragment number I1Data packet P2Comprising a segment S2And a fragment number I2…, packet PmComprising a segment SmAnd a fragment number Im. Wherein, the sequence number of the fragment I1,I2,...,ImFor representing slices S1,S2,...,SmIn a sequential order, i.e. slicing S1Is the 1 st slice, slice S22 nd fragment, …, fragment SmThe mth slice.
In a possible embodiment, when the uploading of the first image file is not interrupted or the uploading fails during the uploading process, the sending unit 430 may send the data packet P1,P2,...,PmAnd sequentially sending the data to the uploading agent equipment. Alternatively, the sending unit 430 uses l threads to simultaneously send the data packet P1,P2,...,PlSending to the uploading agent device, when the uploading agent device receives the data packet P1,P2,...,PlThereafter, the sending unit 430 reuses the l threads to simultaneously send the data packet Pl+1,Pl+2,...,P2×lTransmitting to the upload agent device until the transmitting unit 430 transmits the packet P1,P2,...,PmAll sent to the upload agent device. Wherein l is more than or equal to 1 and less than or equal to m2, and l is a positive integer. Therefore, the uploading times and the file data stream can be effectively reduced by a fragmentation concurrency mode.
In another possible embodiment, a single fragment (e.g., packet to P) occurs during the upload of the first image filen+1Corresponding segment Sn+1) When the upload fails, the sending unit 430 is further configured to send a breakpoint resume request to the upload agent device to obtain the fragment sequence number InThe breakpoint continuous transmission request carries a mirror image ID corresponding to the first mirror image file, and is used for requesting a fragment serial number corresponding to a fragment where a breakpoint occurs; according to the fragment sequence number InData packet Pn+1And sending the data to the uploading agent equipment. It should be understood that the case that the uploading failure of multiple fragments occurs in the uploading process of the first image file is similar to the case that the uploading failure of a single fragment occurs, and the detailed description is omitted here.
In another possible embodiment, the uploading interruption occurs when the first image file is uploaded (for example, in the data packet P)n+1Where interruption occurs), the sending unit 430 is further configured to send a breakpoint resume request to the upload agent device to obtain the fragment sequence number In. The breakpoint continuous transmission request carries a mirror image ID corresponding to the first mirror image file, and is used for requesting a fragment serial number corresponding to a fragment where a breakpoint occurs; according to the fragment sequence number InData packet Pn+1,Pn+2,...,PmAnd sending the data to the uploading agent equipment. Wherein, the sending unit 430 can send the data packet Pn+1,Pn+2,...,PmSequentially sending the data packets to the uploading agent equipment, and adopting a concurrent uploading mode to transmit the data packets Pn+1,Pn+2,...,PmAnd sending the request to the upload agent device, specifically please refer to S203.
In the client, the fragment processing unit fragments the mirror image file, so that the client uploads the mirror image file fragments. Moreover, the sending unit can also realize the concurrent uploading of the fragments, so that the uploading efficiency of the target image file can be improved greatly when the client side is used for uploading the image file. In addition, when the uploading of the image file is interrupted or the uploading fails in the uploading process, the sending unit sends a breakpoint continuous transmission request through the upper sub-management device to obtain the fragment serial number corresponding to the fragment with the breakpoint, so that the sending unit can send the data packet corresponding to the fragment with the uploading failure to the upper sub-management device according to the fragment serial number corresponding to the fragment with the breakpoint. Therefore, when the mirror image file is uploaded by the client, breakpoint continuous transmission and fragment concurrent uploading of the mirror image file can be realized, the uploading efficiency of the mirror image file can be improved, and the uploading success rate of the mirror image file can be improved.
The uploading proxy equipment provided by the application can be a software device or a hardware device, and when the uploading proxy equipment is a software device, the uploading proxy equipment can be independently deployed on one computing equipment in any environment (such as a cloud environment, an edge environment, terminal computing equipment and the like), or can be deployed on the same computing equipment with Swift and Glance; when the upload agent device is a hardware device, the upload agent device may be a computing device in any environment. The unit modules in the upload agent device may also be divided into various partitions, and each module may be a software module, a hardware module, or a part of the software module and a part of the hardware module, which are not limited in the present application. Fig. 8 is an exemplary division manner, and as shown in fig. 8, the upload agent device 320 may include an obtaining unit 510, a sending unit 520, a calling unit 530, and a progress recording unit 540. The function of each functional unit is described separately below.
The obtaining unit 510 is configured to receive a total amount m of fragments and a data packet P sent by a client1,P2,...,PmWherein the data packet P1Comprising a segment S1And a fragment number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PmComprising a segment SmAnd a fragment number ImSeparation of S1,S2,...,SmThe target image file is obtained by fragmenting a target image file by a client, and m is a positive integer.
The transmitting unit 520 is used for transmitting the total number m of the fragments and the fragments S1,S2,...,SmSent to Swift.
The invoking unit 530 is used for receiving the data packet P sent by the client1And calling the Glance to create the image ID corresponding to the first image file.
The progress recording unit 540 is configured to store the image ID of the first image file, the image size of the first image file, and the segment S1,S2,...,SmSize of (2) and fragment number I1,I2,...,Im
In a specific embodiment of the present application, the sending unit 520 is sending the slice S to the Swift1,S2,...,SmThe sending unit 520 is also used for the pair of slices S before1,S2,...,SmAdding corresponding object prefix names to obtain a segment D1,D2,...,DmThen segment D1,D2,...,DmSent to Swift. Wherein, the slice S1Corresponding object prefix name N1Comprises mirror image ID and fragment sequence number I1Separation of S2Corresponding object prefix name N2Comprises mirror image ID and fragment sequence number I2…, slicing SmCorresponding object prefix name NmComprises mirror image ID and fragment sequence number Im
In a possible embodiment, when the first image file is not interrupted or failed to be uploaded during the uploading process, the sending unit 520 is the fragment S1Add object prefix name N1To obtain a segment D1Then segment D1Sending to Swift, if Swift receives segment D1Then segment D is saved in the progress recording unit 5401Mirror image ID and fragment sequence number I of1(ii) a The transmitting unit 520 is a slice S2Add object prefix name N2To obtain a segment D2Then segment D2Sending to Swift, if Swift receives segment D2Then segment D is saved in the progress recording unit 5402Mirror image ID and fragment sequence number I of2(ii) a …, respectively; the transmitting unit 520 is a slice SmAdd object prefix name NmTo obtain a segment DmThen segment DmSending to Swift, if Swift receives segment DmThen segment D is saved in the progress recording unit 540mMirror ID and fragment sequence number Im
In another possible embodiment, when the first image file is not interrupted or failed to be uploaded during the uploading process, the sending unit 520 respectively is the fragment S1,S2,...,SlAdd object prefix name N1,N2,...,NlTo obtain a segment D1,D2,...,DlThen segment D1,D2,...,DlAnd sent to Swift in parallel. If Swift receives segment D1,D2,...,DlThen the segments D are saved separately in the progress recording unit 5401,D2,...,DlMirror ID and segment D of1,D2,...,DlCorresponding fragment sequence number I1,I2,...,Il. It should be appreciated that the upload agent device will fragment Sl+1,Sl+2,...,S2×lParallel to the Swift process, …, the slice Sm-l+1,Sm-l+2,...,SmSending the same to the Swift process and uploading the agent device to segment S1,S2,...,SlThe process of sending the Swift in parallel is similar, and detailed description is omitted here.
In another possible embodiment, a single fragment (e.g., a packet) may appear during the upload of the first image fileCorresponds to Pn+1Corresponding segment Sn+1) The case of uploading failure, that is, the obtaining unit 510 only receives the data packet P sent by the client1,P2,...,Pn,Pn+2,Pn+3,...,PmMeanwhile, the obtaining unit 510 is further configured to receive a breakpoint resume request sent by the client, and the sending unit 520 is further configured to store the fragment sequence number I stored in the progress recording unit 540nAnd sending the data to the client. Afterwards, the obtaining unit 510 is further configured to receive the client according to the fragment sequence number InTransmitted data packet Pn+1The sending unit 520 is also used for being the slice Sn+1Add object prefix name Nn+1Obtaining a segment Dn+1And segment Dn+1Sent to Swift. If Swift receives segment Dn+1Then segment D is saved in the progress recording unit 540n+1Mirror image ID and fragment sequence number I ofn+1. It should be understood that the case that the uploading failure of multiple fragments occurs in the uploading process of the first image file is similar to the case that the uploading failure of a single fragment occurs, and the detailed description is omitted here.
In another possible embodiment, the upload interruption occurs when the first image file is uploaded (for example, in the data packet P)n+1Where an interrupt occurs), that is, the obtaining unit 510 receives only the data packet P sent by the client1,P2,...,PnMeanwhile, the obtaining unit 510 is further configured to receive a breakpoint resume request sent by the client, and the sending unit 520 is further configured to store the fragment sequence number I stored in the progress recording unit 540nAnd sending the data to the client. Afterwards, the obtaining unit 510 is further configured to receive the client according to the fragment sequence number InFrom the data packet Pn+1The remaining data packet (P) to be transmitted continuouslyn+1,Pn+2,...,Pm) The sending unit 520 is also used for being the slice Sn+1,Sn+2,...,SmAdd object prefix name Nn+1,Nn+2,...,NmObtaining a segment Dn+1,Dn+2,...,DmAnd segment Dn+1,Dn+2,...,DmSent to Swift. If Swift receives segment Dn+1,Dn+2,...,DmThen the segments D are saved separately in the progress recording unit 540n+1,Dn+2,...,DmCorresponding mirror ID and fragment sequence number In+1,In+2,...,Im
In a specific embodiment of the present application, segment D is received at SwiftmThereafter, that is, the progress recording unit 540 holds the segment D1,D2,...,DmMirror image ID and corresponding fragment sequence number I of1,I2,...,ImAfter that, the calling unit 530 is further configured to call Swift to restore the first image file.
In a specific embodiment of the present application, the invoking unit 530 is further configured to fragment S in Swift1,S2,...,SmAnd after the first image file is merged into the first image file, calling the Glance to refresh the image state of the first image to determine that the first image is in an available state, thereby finishing the registration of the first image. In addition, the invoking unit 530 may also invoke the company to refresh the image state of the first image in real time during the uploading process of the first image file, which is not specifically limited herein.
For simplicity, in this embodiment, a detailed description is not given to a specific process of the upload agent device calling the Swift to restore the first image file, a detailed description is not given to a specific process of the upload agent device calling the global to refresh the image state of the first image, and a detailed description is not given to a specific process of the upload agent device sending the segment corresponding to the segment.
It can be seen that the acquisition unit of the upload agent device receives the data packet sent by the client, may obtain the fragment of the image file, and then the sending unit forwards the segment corresponding to the fragment to the Swift, so that the Swift can obtain the object prefix name and the fragment according to the fragment, thereby reducing the fragment to the image file on the basis of not needing the local cache, and implementing the upload of the target image file. Moreover, when the uploading of the target image file is interrupted or fails in the uploading process, the sending unit can send the fragment serial numbers corresponding to the fragments with the breakpoints to the client, so that the client can continuously upload the fragments with the uploading failure in the image file according to the fragment serial numbers corresponding to the fragments with the breakpoints, and the uploading efficiency and the uploading success rate of the image file are greatly improved.
As shown in fig. 9, fig. 9 shows a schematic structural diagram of another client provided in the present application. Client 310 may specifically include a processor 610, a communication interface 620, and a memory 630. Wherein processor 610, communication interface 620, and memory 630 are coupled by a bus 640.
The processor 610 may be a Central Processing Unit (CPU), a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable Logic Device (PLD), a transistor logic device, a hardware component, or any combination thereof. The processor 610 may implement or perform various exemplary methods described in connection with the present disclosure. Specifically, the processor 610 reads the program code stored in the memory 630 and performs a part or all of the steps of S101 to S103, S201, and S203 in cooperation with the communication interface 620.
The communication interface 620 may be a wired interface, such as an ethernet interface, a controller area network interface, a Local Interconnect Network (LIN) interface, and a FlexRay interface, or a wireless interface, such as a cellular network interface or a wireless lan interface, for communicating with other modules or devices. In particular, the communication interface 620 may be coupled to the upload agent device 320, and so on.
Memory 630 may include volatile memory, such as Random Access Memory (RAM); the memory 630 may also include a non-volatile memory, such as a Read Only Memory (ROM), a flash memory, a Hard Disk Drive (HDD), or a Solid State Drive (SSD), and the memory 630 may also include a combination of the above types of memories. Memory 630 may store program codes as well as program data.The program code is composed of codes of some or all units in the client shown in fig. 7, for example, a code of the acquiring unit 410, a code of the fragment processing unit 420, a code of the transmitting unit 430, and the like. Program data generated by the client shown in fig. 7 during execution of the program, for example, the slice S1,S2,...,SmData packet P1,P2,...,PmThe size of the image file, the number of slices, and so on.
Bus 640 may be a Controller Area Network (CAN) or other implementation internal bus. The bus 640 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 9, but this does not represent only one bus or one type of bus.
As shown in fig. 10, fig. 10 is a schematic structural diagram illustrating another upload agent device provided in the present application. The upload agent device 320 may specifically include a processor 710, a communication interface 720, and a memory 730. Processor 710, communication interface 720, and memory 730 are coupled by a bus 740.
The processor 710 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other PLD, transistor logic, hardware component, or any combination thereof. The processor 710 may implement or perform various exemplary methods described in connection with the present disclosure. Specifically, processor 710 reads program codes stored in memory 730 and cooperates with communication interface 720 to perform some or all of steps S103-S106, S202-S205.
The communication interface 720 may be a wired interface, such as ethernet interface, controller area network interface, LIN, and FlexRay interface, or a wireless interface, such as a cellular network interface or a wireless lan interface, for communicating with other modules or devices. In particular, communication interface 720 may interface with network device 750, and network device 750 may include, among other things, client 310, Swift330, and pane 340.
Memory 730 may include volatile memory such as RAM; memory 730Non-volatile memory may also be included, such as ROM, flash memory, HDD, or SSD, and memory 730 may also include combinations of the above types of memory. Memory 730 may store program codes as well as program data. The program code is composed of codes of some or all units in the upload agent apparatus shown in fig. 8, for example, a code of the acquiring unit 510, a code of the sending unit 520, a code of the calling unit 530, and the like. Program data generated by the uploading apparatus shown in fig. 8 during the execution of the program, for example, the segment D1,D2,...,DmObject prefix name N1,N2,...,NmSegment upload records, and the like.
The bus 740 may be a CAN or other implementation internal bus. The bus 740 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 10, but this does not represent only one bus or one type of bus.
The present application also provides a computer storage medium storing computer instructions that are executed by hardware (e.g., a processor, etc.) to implement some or all of the steps (e.g., S101-103, S201, S203) performed by the client 310 in the present application.
The present application also provides a computer storage medium storing computer instructions, which are executed by hardware (e.g., a processor, etc.) to implement some or all of the steps (e.g., S103-S106, S202-S205) executed by the upload agent device 320 in the present application.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer instruction product. The computer instruction product includes one or more computer instructions. The processes or functions described in accordance with the embodiments of the present application occur, in whole or in part, when the computer instruction instructions described above are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, memory disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), among others. In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other ways of dividing the actual implementation, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted or not executed. In addition, the indirect coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, and may be electrical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the elements may be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage media may include, for example: u disk, removable hard disk, read only memory, random access memory, magnetic or optical disk, and other various media capable of storing program codes and data files.
While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (21)

1. A method for uploading a mirror image file is applied to a client and is characterized by comprising the following steps:
acquiring a target mirror image file;
the target mirror image file is fragmented to obtain fragments S1,S2,...,SmAnd the total number m of the fragments, wherein m is a positive integer;
to data packet P1,P2,...,PnAnd the total number m of the fragments is sent toA sub-management device, wherein the data packet P1Comprising a segment S1And fragment sequence number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising a segment SnAnd a fragment number InN is a positive integer, and n is not more than m.
2. The method of claim 1, wherein in the case that n is less than m, the method further comprises: sending a breakpoint resume request to the upload agent device to obtain the fragment sequence number InThe breakpoint continuous transmission request is used for requesting the fragment serial number corresponding to the fragment with the breakpoint;
according to the fragment sequence number InData packet Pn+1And sending the data to the uploading agent equipment.
3. Method according to claim 2, characterized in that said packet P is transmitted1,P2,...,PnThe sending to the upload agent device includes:
using l threads, the data packet P is divided1,P2,...,PlSending the data to the uploading agent equipment in parallel; using the l threads, the data packet P is transmittedl+1,Pl+2,...,P2×lSending the data to the uploading agent equipment in parallel; …, respectively; using the l threads, the data packet P is transmittedn-l+1,Pn-l+2,...,PnAnd sending the data to the uploading agent equipment in parallel, wherein l is more than or equal to 1 and less than or equal to n/2, and l is a positive integer.
4. An uploading method of an image file is applied to an uploading agent device, and is characterized by comprising the following steps:
receiving the total number m of the fragments and the data packet P sent by the client1,P2,...,PnWherein the data packet P1Comprising a segment S1And a fragment number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising segmentsSnAnd a fragment number InSeparation of S1,S2,...,SmThe target image file is obtained by the client by fragmenting the target image file, wherein m and n are positive integers, and n is not more than m;
dividing the total number m of the fragments into S1,S2,...,SnAnd sending the data to the object storage device.
5. The method according to claim 4, wherein in case n is smaller than m, the total number of fragments m and the data packet P sent at the receiving client are1,P2,...,PnThereafter, the method further comprises:
receiving a data packet P sent by the clientn+2,Pn+3,...,PmAnd dividing into pieces Sn+2,Sn+3,...,SmTo the object storage device, wherein the data packet Pn+2Comprising a segment Sn+2And a fragment number In+2Data packet Pn+3Comprising a segment Sn+3And a fragment number In+3…, packet PmComprising a segment SmAnd a fragment number Im
Receiving a breakpoint continuous transmission request sent by the client;
according to the breakpoint continuous transmission request, the fragment sequence number I corresponding to the fragment with the breakpointnSending the data to the client;
receiving the sequence number I of the client according to the fragmentsnTransmitted data packet Pn+1And sends the data packet Pn+1Sending the data to the object storage device for the object storage device to use according to the fragment S1,S2,...,SmRestoring the target image file, wherein the data packet Pn+1Comprising a segment Sn+1And a fragment number In+1
6. The method of claim 4, wherein in the case that n is less than m, the method further comprises:
receiving a breakpoint continuous transmission request sent by the client;
according to the breakpoint continuous transmission request, the fragment sequence number I corresponding to the fragment with the breakpointnSending the data to the client;
receiving the sequence number I of the client according to the fragmentsnFrom said data packet Pn+1Transmitting the remaining data packets to the object storage device for the object storage device to continue transmitting the remaining data packets according to the fragments S1,S2,...,SmRestoring the target image file, wherein the remaining data packets comprise data packet Pn+1,Pn+2,...,PmSaid data packet Pn+1Comprising a segment Sn+1And a fragment number In+1Said data packet Pn+2Comprising a segment Sn+2And a fragment number In+2…, packet PmComprising a segment SmAnd a fragment number Im
7. The method of claim 5 or 6, further comprising:
receiving the data packet P sent by the client1And calling mirror image management equipment to create a mirror image identifier corresponding to the target mirror image file and storing the mirror image identifier.
8. The method according to any one of claims 4 to 7, further comprising: and calling the mirror image management equipment to refresh the mirror image state corresponding to the target mirror image file.
9. A client, comprising:
the acquisition unit is used for acquiring a target mirror image file;
a fragment processing unit for fragmenting the target image file to obtain a fragment S1,S2,...,SmAnd the total number m of the fragments, wherein m is a positive integer;
a transmission unit forTo data packet P1,P2,...,PnAnd the total number m of the fragments is sent to an uploading agent device, wherein, the data packet P1Comprising a segment S1And fragment sequence number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising a segment SnAnd a fragment number InN is a positive integer, and n is not more than m.
10. The client according to claim 9, wherein in case n is smaller than m, the sending unit is further configured to:
sending a breakpoint resume request to the upload agent device to obtain the fragment sequence number InThe breakpoint continuous transmission request is used for requesting the fragment serial number corresponding to the fragment with the breakpoint;
according to the fragment sequence number InData packet Pn+1And sending the data to the uploading agent equipment.
11. The client according to claim 10, wherein the sending unit is specifically configured to:
using l threads, the data packet P is divided1,P2,...,PlSending the data to the uploading agent equipment in parallel; using the l threads, the data packet P is transmittedl+1,Pl+2,...,P2×lSending the data to the uploading agent equipment in parallel; …, respectively; using the l threads, the data packet P is transmitted1,P2,...,PnAnd sending the data to the uploading agent equipment in parallel, wherein l is more than or equal to 1 and less than or equal to n/2, and l is a positive integer.
12. An upload agent apparatus, comprising:
an obtaining unit, configured to receive a total amount m of fragments and a data packet P sent by a client1,P2,...,PnWherein the data packet P1Comprising a segment S1And a fragment number I1Data packet P2Comprising a segment S2And fragment sequence number I2…, packet PnComprising a segment SnAnd a fragment number InSeparation of S1,S2,...,SmThe target image file is obtained by the client by fragmenting the target image file, wherein m and n are positive integers, and n is not more than m;
a sending unit, configured to sum the total number of fragments m and the fragments S1,S2,...,SnAnd sending the data to the object storage device.
13. The apparatus according to claim 12, wherein in case that n is smaller than m, the obtaining unit receives the total amount of fragments m and the data packet P sent by the client1,P2,...,PnAfter that time, the user can use the device,
the obtaining unit is further configured to receive a data packet P sent by the clientn+2,Pn+3,...,PmAnd dividing into pieces Sn+2,Sn+3,...,SmTo the object storage device, wherein the data packet Pn+2Comprising a segment Sn+2And a fragment number In+2Data packet Pn+3Comprising a segment Sn+3And a fragment number In+3…, packet PmComprising a segment SmAnd a fragment number Im
The acquisition unit is also used for receiving a breakpoint continuous transmission request sent by the client;
the sending unit is further configured to send a breakpoint resume request to a corresponding fragment sequence number I of a fragment with a breakpointnSending the data to the client;
the obtaining unit is further configured to receive the fragment sequence number I from the clientnTransmitted data packet Pn+1And sends the data packet Pn+1Sending the data to the object storage device for the object storage device to use according to the fragment S1,S2,...,SmRestoring the target image file, wherein the data packet Pn+1Comprising a segment Sn+1And a fragment number In+1
14. The apparatus of claim 12, wherein in the case where n is less than m,
the acquisition unit is also used for receiving a breakpoint continuous transmission request sent by the client;
the sending unit is further configured to send a breakpoint resume request to a corresponding fragment sequence number I of a fragment with a breakpointnSending the data to the client;
the obtaining unit is further configured to receive the fragment sequence number I from the clientnFrom said data packet Pn+1Transmitting the remaining data packets to the object storage device for the object storage device to continue transmitting the remaining data packets according to the fragments S1,S2,...,SmRestoring the target image file, wherein the remaining data packets comprise data packet Pn+1,Pn+2,...,PmSaid data packet Pn+1Comprising a segment Sn+1And a fragment number In+1Said data packet Pn+2Comprising a segment Sn+2And a fragment number In+2…, packet PmComprising a segment SmAnd a fragment number Im
15. The apparatus according to claim 13 or 14, characterized in that the apparatus further comprises a call unit and a progress recording unit,
the calling unit is used for receiving the data packet P sent by the client1Then, calling mirror image management equipment to create a mirror image identifier corresponding to the target mirror image file;
and the progress recording unit is used for storing the mirror image identifier.
16. The apparatus according to any one of claims 12 to 15, wherein the invoking unit is further configured to: and calling the mirror image management equipment to refresh the mirror image state corresponding to the target mirror image file.
17. An image file uploading system, comprising the client terminal of any one of claims 9 to 11, the uploading agent device of any one of claims 12 to 16, the object storage device, and the image service device, wherein,
the object storage device is used for receiving the fragments S sent by the uploading agent device1,S2,...,SmAnd dividing the slice S1,S2,...,SmRestoring the target image file;
the mirror image management equipment is used for creating a mirror image identifier corresponding to the target mirror image file;
the mirror image management device is also used for refreshing the mirror image state of the target mirror image file.
18. A client comprising a processor and a memory, the processor executing code in the memory to implement the method of any one of claims 1 to 3.
19. An upload agent apparatus comprising a processor and a memory, the processor executing code in the memory to implement the method of any of claims 4 to 8.
20. A computer storage medium having stored thereon computer instructions; the computer instructions are for implementing the method of any one of claims 1 to 3.
21. A computer storage medium having stored thereon computer instructions; the computer instructions are for implementing the method of any one of claims 4 to 8.
CN202010183182.6A 2020-03-16 2020-03-16 Uploading method of image file, related equipment and computer storage medium Pending CN113411363A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010183182.6A CN113411363A (en) 2020-03-16 2020-03-16 Uploading method of image file, related equipment and computer storage medium
PCT/CN2021/075236 WO2021184992A1 (en) 2020-03-16 2021-02-04 Mirror image file uploading method, related device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010183182.6A CN113411363A (en) 2020-03-16 2020-03-16 Uploading method of image file, related equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN113411363A true CN113411363A (en) 2021-09-17

Family

ID=77676598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010183182.6A Pending CN113411363A (en) 2020-03-16 2020-03-16 Uploading method of image file, related equipment and computer storage medium

Country Status (2)

Country Link
CN (1) CN113411363A (en)
WO (1) WO2021184992A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114911580A (en) * 2022-07-11 2022-08-16 统信软件技术有限公司 Mirror image state processing method and device and computing equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116233120B (en) * 2023-05-10 2023-07-14 深圳普菲特信息科技股份有限公司 Large file fragment transmission method, system and medium based on data processing

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581216B (en) * 2012-07-20 2017-12-19 中国电信股份有限公司 The method, apparatus and system of fragment data storage
CN104144186B (en) * 2013-05-10 2017-12-01 中国电信股份有限公司 Data uploading method and system based on Web browser in cloud computing environment
CN107426258B (en) * 2016-05-23 2020-04-28 华为技术有限公司 Method and device for uploading and downloading mirror image file
CN107360233A (en) * 2017-07-14 2017-11-17 世纪龙信息网络有限责任公司 Method, apparatus, equipment and the readable storage medium storing program for executing that file uploads
CN108933837A (en) * 2018-08-07 2018-12-04 郑州云海信息技术有限公司 A kind of transmission method and device of image file
CN109783193A (en) * 2018-12-27 2019-05-21 南京优速网络科技有限公司 A kind of mirror image file management method that can be multiplexed in multiple domain cloud platform

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114911580A (en) * 2022-07-11 2022-08-16 统信软件技术有限公司 Mirror image state processing method and device and computing equipment
CN114911580B (en) * 2022-07-11 2022-09-27 统信软件技术有限公司 Mirror image state processing method and device and computing equipment

Also Published As

Publication number Publication date
WO2021184992A1 (en) 2021-09-23

Similar Documents

Publication Publication Date Title
US10700979B2 (en) Load balancing for a virtual networking system
US10782880B2 (en) Apparatus and method for providing storage for providing cloud services
JP6569020B2 (en) Networking technology
US9350682B1 (en) Compute instance migrations across availability zones of a provider network
US10313282B1 (en) Flexible middleware messaging system
US11095716B2 (en) Data replication for a virtual networking system
US20170124021A1 (en) Methods for enabling direct memory access (dma) capable devices for remote dma (rdma) usage and devices thereof
US20180006963A1 (en) Network-accessible data volume modification
US20230216895A1 (en) Network-based media processing (nbmp) workflow management through 5g framework for live uplink streaming (flus) control
CN110196843A (en) A kind of document distribution method and container cluster based on container cluster
WO2021184992A1 (en) Mirror image file uploading method, related device and computer storage medium
CN111225003B (en) NFS node configuration method and device
US10545667B1 (en) Dynamic data partitioning for stateless request routing
CN112306380A (en) Storage management method and device and computer storage medium
CN108829340B (en) Storage processing method, device, storage medium and processor
US20200379857A1 (en) Host multipath layer notification and path switchover following node failure
CN110798366B (en) Task logic processing method, device and equipment
US20170235631A1 (en) Resilient distributed storage system
WO2018032499A1 (en) Load balancing method and associated device
CN114003342A (en) Distributed storage method and device, electronic equipment and storage medium
US10712959B2 (en) Method, device and computer program product for storing data
US11442943B1 (en) Error-causing record isolation for data stream processing
US9961027B2 (en) Email webclient automatic failover
US11872497B1 (en) Customer-generated video game player matchmaking in a multi-tenant environment
CN108600025B (en) Method and device for automatic disaster recovery of system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination