Transmission method and electronic equipment
By recording the transmission offset during the image file transfer process and continuing to transmit when interrupted, the problem that the layered transmission of image file in the prior art does not support interruption in breakpoints is solved, and the reliability and efficiency of transmission are improved.
Patent Information
- Application Number
- CN202411730385.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, the image file is not supported for continuous transmission within the layer when transmitting layered images in hierarchical, resulting in a decrease in the reliability and retransmission efficiency of file transmission.
By recording the transmission offset during the image file transmission process, if the transmission is interrupted, the interrupt position is determined based on the transmission offset, and the data after the interrupt position is continued to be transmitted to realize the interrupt point transmission within the mirror layer.
Improves the reliability and retransmission efficiency of mirror file transmission, ensuring that target data can be quickly positioned and continued to be transmitted when transmission is interrupted.
Smart Images

Figure CN119544700A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a transmission method and electronic equipment. Background Art
[0002] In the field of data processing technology, with the development of cloud computing, image technology has been more and more widely used. Image files usually contain system configuration information, file systems, installed software, etc., and are used for backup, migration, deployment or creating isolated working environments, so that users can quickly copy and start an identical state through image files without having to install or set up from scratch.
[0003] Since the image file has a large amount of data, it is usually transmitted layer by layer according to the image layer. However, the transmission methods provided in the related art do not support intra-layer breakpoint resumption, that is, when the image layer transmission is interrupted, the entire layer needs to be uploaded again. This reduces the reliability of file transmission and the retransmission efficiency. Summary of the invention
[0004] The present application provides a transmission method and an electronic device for improving the reliability and retransmission efficiency of image file transmission.
[0005] In order to achieve the above technical objectives, this application adopts the following technical solutions:
[0006] In a first aspect, the present application provides a transmission method, which is applied to a first node, and the method includes: obtaining an image file to be transmitted, the image file includes at least one image layer, and each image layer corresponds to a layer identifier; transmitting image data of the first image layer to a second node, and the image data carries a first layer identifier corresponding to the first image layer; the first image layer is any image layer in the image file to be transmitted; if the transmission of the first image layer is interrupted, determining the transmission interruption position according to the current transmission offset of the first image layer; wherein the current transmission offset is used to indicate the length of the data currently transmitted successfully; the transmission interruption position indicates the boundary position between the data currently transmitted successfully and the remaining data in the first image layer; transmitting the target image data in the first image layer to the second node at the transmission interruption position, the target image data is located after the transmission interruption position and carries the first layer identifier.
[0007] It can be seen that in the transmission method provided by the embodiment of the present application, in the process of layered transmission of the first mirror layer in the mirror file to the second node, if the transmission is interrupted, the transmission interruption position is determined according to the current transmission offset of the first mirror layer. Among them, the current transmission offset is used to indicate the length of the data currently transmitted successfully. That is, the boundary position between the successfully transmitted data and the remaining data is determined according to the length of the data that has been successfully transmitted. Then, the target mirror data after the boundary position continues to be transmitted to the second node to achieve the effect of breakpoint resumption within the mirror layer. The scheme provided by the present application enables the target data that has not been transmitted in the mirror layer to be accurately located by setting the transmission offset, especially when data retransmission is required, the target data in the mirror layer can be quickly located for transmission; based on this, the reliability of mirror file transmission and the retransmission efficiency are improved.
[0008] In some embodiments, the transmission offset is an index value generated after the second node successfully receives the mirror data in the first mirror layer; different index values represent different data lengths; determining the transmission interruption position according to the current transmission offset of the first mirror layer, including: determining the length of the currently successfully transmitted data in the first mirror layer according to the index value; determining the transmission interruption position according to the data length of the first mirror layer and the length of the currently successfully transmitted data.
[0009] In some embodiments, the method further includes: after starting to transmit the first mirror layer to the second node, obtaining the transmission offset of the first mirror layer, and detecting whether the transmission is interrupted; if the transmission of the first mirror layer is interrupted, determining the transmission interruption position according to the current transmission offset of the first mirror layer, including: determining whether the transmission of the first mirror layer is completed according to the current transmission offset of the first mirror layer and the data length of the first mirror layer; if the transmission of the first mirror layer is not completed, determining the transmission interruption position according to the current transmission offset of the first mirror layer; if the transmission of the first mirror layer is completed, sending the second mirror layer to the second node, and / or outputting a first prompt message, the first prompt message is used to prompt that the transmission of the first mirror layer has been completed.
[0010] In some embodiments, after obtaining the image file, the method also includes: determining all image layers of the image file, and querying the second node for the image layers that already exist on the second node; marking the image layers in the image file that do not exist on the second node as target image layers to be transmitted; transmitting the image file to the second node includes: transmitting the target image layers to the second node one by one, the first image layer being any target image layer.
[0011] In a second aspect, the present application provides a transmission method, which is applied to a second node, and the method includes: receiving mirror data sent by a first node, and storing the mirror data based on a hierarchical identifier carried by the mirror data.
[0012] In some embodiments, the method further includes: generating a transmission offset of a first mirror layer according to the length of the received mirror data, the first mirror layer being the mirror layer corresponding to the layer identifier carried by the mirror data; returning the transmission offset of the first mirror layer to the first node; the transmission offset is used by the first node to determine a transmission interruption position when the transmission of the first mirror layer is interrupted, and the transmission interruption position indicates the boundary position between the data currently transmitted successfully and the remaining data in the first mirror layer.
[0013] In some embodiments, returning the transmission offset of the first image layer to the first node includes: returning the transmission offset of the first image layer to a third node; the third node is a proxy node of the second node, and the third node is used to receive and store the transmission offset of the first image layer sent by the second node during the process of the first node transmitting the first image layer to the second node; the third node is also used to send the transmission offset of the first image layer to the first node.
[0014] In some embodiments, the transmission offset of the first mirror layer is generated according to the length of the received mirror data, including: each time mirror data of a preset length is received, a corresponding index value is determined according to the length of all received mirror data belonging to the first mirror layer; different index values correspond to different data lengths.
[0015] In some embodiments, the method further includes: receiving target mirror data, the target mirror data being data received after the mirror data transmission is interrupted;
[0016] According to the layer identifier carried by the target image data, the target image data is merged with the received image data having the same layer identifier as that carried by the target image data.
[0017] In some embodiments, the method further includes: receiving a query request sent by a third node, the query request including layer identification or summary information of each image layer in the image file; wherein the summary information is used to describe the data content of the image layer; determining a target layer from each image layer in the image file, the target layer being the image layer existing on the second node; and returning the target layer to the third node.
[0018] In a third aspect, the present application provides a transmission method, which is applied to a third node, and the method includes: in the process of transmitting the mirror data in the first mirror layer from the first node to the second node, obtaining the transmission offset of the first mirror layer generated by the second node; the transmission offset of the first mirror layer is used to indicate the length of the data successfully transmitted in the first mirror layer; the first mirror layer is any mirror layer in the mirror file; each time the transmission offset of the first mirror layer is obtained, the transmission offset of the first mirror layer is returned to the first node; and / or, in response to the first query request sent by the first node, the transmission offset of the first mirror layer obtained the most recently returned to the first node; wherein the transmission offset is used by the first node to determine the transmission interruption position when the transmission of the first mirror layer is interrupted, and the transmission interruption position indicates the boundary position between the currently successfully transmitted data and the remaining data in the first mirror layer.
[0019] In some embodiments, the method also includes: receiving a second query request sent by the first node; the second query request includes a layer identifier or summary information of each image layer in the image file; wherein the summary information is used to describe the data content of the image layer; according to the layer identifier or summary information of each image layer, querying the second node for the image layer that already exists on the second node and belongs to the image file, and obtaining the target layer, which is the image layer existing on the second node; and returning the target layer to the first node.
[0020] In a fourth aspect, the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed on a computer, the computer implements any one of the transmission methods provided in the embodiments of the present application.
[0021] In a fifth aspect, the present application provides an electronic device, comprising: a processor and a memory for storing instructions executable by the processor; the processor is configured to execute the instructions so that the electronic device implements any one of the transmission methods provided in the embodiments of the present application.
[0022] In a sixth aspect, the present application provides a computer program product, which includes computer program instructions. When the computer instructions are executed on a computer, the computer implements any one of the transmission methods provided in the embodiments of the present application.
[0023] It should be noted that the above computer instructions may be stored in whole or in part on a computer-readable storage medium, wherein the computer-readable storage medium may be packaged together with the processor of the controller, or may be packaged separately from the processor of the controller, which is not limited in this application.
[0024] For the specific description of the second to sixth aspects and their various implementations in the present application, reference may be made to the detailed description in the first aspect and its various implementations; and for the beneficial effects of the second to sixth aspects and their various implementations, reference may be made to the beneficial effects analysis in the first aspect and its various implementations, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of the structure of a transmission system provided in an embodiment of the present application;
[0026] Figure 2 A schematic diagram of a transmission method provided in an embodiment of the present application Figure 1 ;
[0027] Figure 3 A schematic diagram of a transmission method provided in an embodiment of the present application Figure 2 ;
[0028] Figure 4 A schematic diagram of a transmission method provided in an embodiment of the present application Figure 3 ;
[0029] Figure 5 A schematic diagram of a transmission method provided in an embodiment of the present application Figure 4 ;
[0030] Figure 6 The overall process of a transmission method provided in the embodiment of the present application Figure 1 ;
[0031] Figure 7 The overall process of a transmission method provided in the embodiment of the present application Figure 2 ;
[0032] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0034] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. The terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, "multiple" means two or more.
[0035] As described in the background technology, in the field of data processing technology, with the development of cloud computing, image technology has also been more and more widely used. Image files usually contain system configuration information, file systems, installed software, etc., and are used for backup, migration, deployment, or creating isolated working environments, so that users can quickly copy and start an identical state through image files without having to install or set up from scratch.
[0036] The following is a brief introduction using the image file as a container image as an example. As cloud computing technology has evolved from virtualization to the cloud-native stage, container technology has been widely used. A container image is an executable package that encapsulates the binary data of an application and all its software dependencies. The image container can contain multiple layers, each of which can be stored and transmitted independently. A key feature of a container is that the product of an application changes from a traditional binary executable file to a container image. The image contains the compiled binary program and the environment, dependent libraries, and configuration files on which it depends. Taking project execution as an example, container images are usually used to deliver and run the project; in addition, the circulation, storage, and use of image files in projects are becoming more and more frequent.
[0037] In order to achieve the transmission of container images, in a related technology, a command line method is usually used, such as using the image push (docker push) command to transmit the image file to some image warehouse (such as open source image warehouse or commercial image warehouse, etc.). Among them, the image warehouse is a system that can store container images and files, supports pushing images to the warehouse for storage, and supports pulling images from the warehouse for running.
[0038] However, this command line method requires that the data sender and the data receiver (image warehouse) are in the same network in order to use the docker push command to transfer the image file; and it requires the operator to have a certain professional knowledge background, which is not easy to operate and will lead to reduced transmission efficiency.
[0039] Since the data sender and the data receiver are usually not in the same network, and in order to facilitate the operator's operation, another data transmission method is proposed in the related art. By developing a web program, a web interface is provided to the operator on the web client. The user can click the upload image entrance through the web interface and select the image file to be uploaded. The web client divides the image file into multiple segments and sends them to the server. For example, 128M is a segment, and images larger than 128M need to be split and uploaded.
[0040] The server is in the same network as the image repository. After receiving the image file completely, the administrator or automated script will use the command line tools provided by Docker (such as the docker command) to parse the image file. These tools can read the metadata of the image file and identify the layered structure of the image. An image file usually contains multiple layers, which are stacked together in the order of construction to form a complete image. The parsing process traverses these layers and extracts the content, metadata, and dependencies of each layer with other layers. By parsing the image file, the server can identify multiple layers of the image. Each layer contains a portion of the file system content and the changes made to the layer relative to the previous layer. Then, the docker push command is used to mirror each layer to the image repository according to the layers in the image file.
[0041] The image data between the web client and the server is transmitted in pieces, so if any piece of transmission is interrupted, the piece will be re-uploaded. The image data between the server and the image repository is transmitted in layers, so if any image layer transmission is interrupted, the image layer will be re-uploaded.
[0042] However, when the content of a single image file is large, this transmission method will, on the one hand, cause the transmission to take a long time. After the image file is transferred between the web client and the server, the server can parse it and send it to the warehouse in layers, occupying disk input / output (IO) and space. On the other hand, there are many steps in the process, and two data transmissions are required, which will lead to a greater possibility of errors in the image transmission and reduce the reliability of file transmission. On the other hand, when the transmission of the image layer is abnormally interrupted, it may cause all data to be lost when the transmission is interrupted, and the entire layer of files or the entire fragment needs to be retransmitted, resulting in low retransmission efficiency and low transmission reliability.
[0043] In this regard, an embodiment of the present application provides a transmission method, which is applied to a first node, and the method includes: obtaining an image file to be transmitted, the image file includes at least one image layer, and each image layer corresponds to a layer identifier; transmitting image data of the first image layer to a second node, and the image data carries a first layer identifier corresponding to the first image layer; the first image layer is any image layer in the image file; if the transmission of the first image layer is interrupted, determining the transmission interruption position according to the current transmission offset of the first image layer; transmitting the target image data in the first image layer to the second node at the transmission interruption position, the target image data is located after the transmission interruption position and carries the first layer identifier; wherein the transmission interruption position indicates the boundary position between the data currently transmitted successfully and the remaining data in the first image layer; the current transmission offset is used to indicate the length of the data currently transmitted successfully.
[0044] It can be seen that in the transmission method provided in the embodiment of the present application, the first node can directly transmit the image layer by layer to the second node without the need for an intermediate server to store and forward, which can reduce the steps of data transmission, reduce the transmission time and the possibility of errors during the transmission process, and improve the reliability of file transmission.
[0045] Furthermore, in the solution of the present application, if a transmission interruption occurs during the layered transmission of the first mirror layer in the mirror file to the second node, the transmission interruption position is determined according to the current transmission offset of the first mirror layer. The current transmission offset is used to indicate the length of the data currently transmitted successfully. That is, the boundary position between the successfully transmitted data and the remaining data is determined according to the length of the data that has been successfully transmitted. Then, the target mirror data after the boundary position continues to be transmitted to the second node to achieve the effect of breakpoint resumption within the mirror layer. The solution provided by the present application enables the untransmitted data in the mirror layer to be accurately located by setting the transmission offset, especially when breakpoint resumption is required, the target mirror data in the mirror layer can be quickly located for transmission; thus, the retransmission efficiency of file transmission is improved.
[0046] The transmission method provided in the embodiment of the present application can be applied to Figure 1 In the transmission system shown in FIG. Figure 1 The transmission system at least includes: a first node 110, a second node 120 and a third node 130.
[0047] The first node 110 is used to send the mirror data to the second node for storage. The first node 110 may also be referred to as a client, a web client, a user interaction module, a user interaction terminal, and the like.
[0048] The second node 120 is used to store the mirror data. The second node 120 may also be called a warehouse end, a mirror warehouse, a storage end, a server, etc.
[0049] The third node 130 is a proxy node of the second node, which can receive data requests from the first node 110 or other nodes, forward the requests to the second node 120, and manage some data generated by the second node 120, such as transmission offset. The third node 130 can also be called a warehouse proxy, a proxy, and a service proxy, etc. The embodiment of the present application does not limit the specific forms of the first node, the second node, and the third node.
[0050] In some embodiments, the first node 110 is specifically used to, when receiving a storage operation for an image file to be transmitted, obtain the image file to be transmitted, and transmit the image data of the first image layer in the image file to the second node, where the image data carries a layer identifier corresponding to the first image layer.
[0051] As a feasible implementation method, the first node 110 is also used to parse the image file after obtaining the image file to be transmitted, identify and read the metadata of the image file, and then obtain the summary information of each image layer based on the metadata for subsequent use. And identify the layered structure of the image, and then obtain the multiple image layers included in the image file.
[0052] It is understandable that an image file is usually a compressed package that contains all layers and metadata of the image. In the process of reading the image file by the first node, the first node 110 will identify and read the metadata of the image file. Metadata is information that describes the properties and configuration of the image, such as the creation time, author, dependencies, etc. of the image. Container images usually adopt a layered structure, and each layer contains incremental changes to the file system. The parsing process identifies the layered structure of the image and determines the content and dependencies of each layer. This process may involve decompressing the image file and traversing the layers therein. Through analysis, the first node 110 can determine the multiple image layers included in the image file. These layers are stacked together in the order of construction to form a complete image.
[0053] The first node 110 stores the identified image layer information locally or in a database, and then packages each image layer separately as needed, and then transmits each layer to the second node 120 according to the sequence.
[0054] In some embodiments, the first node 110 is also used to, when the transmission of the first mirror layer is interrupted, determine the boundary position between the currently successfully transmitted data and the remaining data in the first mirror layer according to the length of the currently successfully transmitted data of the first mirror layer, and then transmit the mirror data after the transmission interruption position to the second node, thereby completing the continued transmission of the first mirror layer.
[0055] In some embodiments, the second node 120 is used to receive the mirror data sent by the first node, and store the mirror data based on the layered identifier carried by the mirror data.
[0056] In some embodiments, the second node 120 is used to receive target mirror data, wherein the target mirror data is data received after the mirror data transmission is interrupted; according to the layer identifier carried by the target mirror data, the target mirror data is merged with the received mirror data with the same layer identifier carried by the target mirror data.
[0057] In some embodiments, the second node 120 is configured to return the transmission offset of the first mirror layer to the third node.
[0058] In some embodiments, the third node 130 is used to obtain the transmission offset of the first mirror layer generated by the second node; and return the transmission offset to the first node.
[0059] In some other embodiments, the third node 130 is configured to return the most recently acquired transmission offset of the first mirror layer to the first node upon receiving the first query request sent by the first node.
[0060] It should be understood that other functions of the first node 110, the second node 120 and the third node 130 can refer to the description in the following method embodiment and will not be described in detail here.
[0061] In some embodiments, there are communication connections between the first node 110, the second node 120 and the third node, and the connection mode can be a wired connection or a wireless connection, which is not limited in the embodiments of the present application.
[0062] It should be understood that Figure 1 The structure shown in the figure does not constitute a limitation on the transmission system. Figure 1 In addition to the modules shown, the transmission system may include more or fewer modules (e.g., display devices) than shown, or combine certain modules, or use different module arrangements. For example, the third node 130 and the second node 120 may be integrated into one module, etc. This application does not make specific limitations on this.
[0063] It should be understood that the execution subject of the transmission method provided in the present application may be the above-mentioned first node 110, the second node 120, the integrated device of the first node 110 and the third node 130, the integrated device of the second node 120 and the third node 130, or the above-mentioned transmission system, etc. In addition, the execution subject may also be any device with processing functions, such as mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, super mobile personal computers, netbooks, as well as cellular phones, personal digital assistants, augmented reality\virtual reality devices, etc.; for example, central processing units (CPU), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) and digital signal processors (DSP), etc., which are not specifically limited in the present application.
[0064] The implementation of the embodiment of the present application is described in detail below in conjunction with the accompanying drawings.
[0065] like Figure 2 As shown, an embodiment of the present application provides a transmission method, which is applied to the above-mentioned first node, and the method includes the following steps S101 to S104:
[0066] S101: Obtain an image file to be transmitted.
[0067] It should be understood that the image file is an image file stored or run on the first node. In a specific example, the image file is a container image. The image can be regarded as a file system composed of multiple image layers. Each image layer is superimposed in the form of a pointer to form a complete image. During the construction process of these image layers, each layer represents a construction step or component, such as a basic environment, middleware, software package, application code, etc.
[0068] That is, the image file includes at least one image layer, and in order to distinguish multiple image layers, each image layer corresponds to a layer identifier. In some embodiments, the triggering condition of S101 may be: responding to an operation on the image file to be transmitted, the operation including but not limited to: clicking, dragging, box selection, swiping, and selecting the image file to be transmitted by inputting the identifier of the image file, etc. This application does not make specific limitations on this.
[0069] It is understandable that an image file is usually a compressed package that contains all layers and metadata of the image. When the first node reads the image file, it needs to parse the image file, identify and read the metadata of the image file and the hierarchical structure of the image, and determine the content and dependency of each layer. Then the first node can determine the multiple image layers included in the image file.
[0070] It should be understood that by acquiring and transmitting the image file by operating the image file to be transmitted, the image file can be directly transmitted in the form of a web. Compared with transmitting the image file using the command line, this transmission method can reduce the operation threshold, thereby improving the efficiency of file transmission.
[0071] In some embodiments, when the first node has never transmitted data to the second node, the image file to be transmitted is all image layers of the image file.
[0072] In other embodiments, the image file to be transmitted is an image layer selected from all image layers of the image file that has not been completely transmitted to the second node. Exemplarily, the method further includes: the first node determines all image layers of the image file; and queries the second node for image layers that already exist on the second node; and marks the image layer in the image file that does not exist on the second node as the target image layer to be transmitted; in this way, the first image layer in the following embodiments is any target image layer.
[0073] As a feasible implementation method, when the first node queries the second node for the image layers that already exist on the second node, it can send a query request including the layer identifiers of all the image layers to the second node, so that the second node will query its own existing image layers according to the layer identifiers. The second node can also send the transmission offset of the existing image layers to the first node, so that the first node can determine whether the transmission of the existing image layers is complete, and then use the image layers that have not been transmitted and the image layers that do not exist on the second node as the target image layers.
[0074] As another feasible implementation, the query request sent by the first node to the second node may include summary information of all image layers. It should be understood that the summary information of the image layer is used to describe the data content of the image layer. After receiving the query request, the second node searches for the corresponding image layer by the summary information. If it exists, it indicates that the image layer has been completely transmitted. Therefore, the existing layer information is returned to the first node, so that the first node determines the target image layer to be transmitted according to the existing layer information.
[0075] It should be understood that since the third node is the proxy node of the second node, when the first node performs a query, it can directly send a query request to the second node, or it can send a query request to the third node, and obtain the second query response through the forwarding operation of the third node. The embodiment of the present application does not limit this.
[0076] In an example, the first node may obtain summary information of each image layer in the following manner: parsing the image structure in the image file, obtaining the header file and the image layer information; and obtaining summary information of each image layer through the header file.
[0077] Based on this, the summary information of all image layers in the image file can be sent to the second node or the third node, so as to query the summary information of the image layers that have not been completely transmitted (that is, the target summary information) from the second node or the third node to determine at least one image layer that has not been completely transmitted. In this way, the preliminary screening task of the image layers can be transferred to other nodes, reducing the processing pressure of the first node.
[0078] It should be understood that in container technology, each layer of an image file is built on the basis of the previous layer, and only the changed part will be saved as a new layer. That is, the base layers of multiple image files are usually the same and do not need to be transmitted repeatedly. Therefore, the method provided in this embodiment first queries the second node for the image layers that already exist on the second node before the image is transmitted, that is, before uploading the image layer, first determine whether the same layer already exists in the second node, filter out duplicate image layers, only transmit the difference layer, perform incremental upload, and reduce the amount of transmitted data.
[0079] As another example, the above-mentioned determining at least one mirror layer from all mirror layers includes: obtaining transmission offsets of all mirror layers; and determining at least one mirror layer from all mirror layers according to the transmission offsets of all mirror layers and the data lengths of all mirror layers. The related concept of the transmission offset of the mirror layer can refer to the description of step S102 below.
[0080] In the case where the transmission offset of the mirror layer is represented by the parameter "the end index value of the data in the mirror layer that has been transmitted to the second node", the above-mentioned determining at least one mirror layer from all the mirror layers according to the transmission offsets of all the mirror layers and the data lengths of all the mirror layers includes: in the case where the data index in the mirror layer starts from 1, according to the transmission offsets of each mirror layer in all the mirror layers and the data lengths of each mirror layer in all the mirror layers, determining at least one mirror layer whose end index value is less than the total data length of itself from all the mirror layers; in the case where the data index in the mirror layer starts from 0, according to the transmission offsets of each mirror layer in all the mirror layers and the data lengths of each mirror layer in all the mirror layers, determining at least one mirror layer whose end index value is less than "the data length of itself - 1" from all the mirror layers.
[0081] In the case where the transmission offset of the mirror layer is represented by the parameter "data length corresponding to the data transmitted to the second node in the mirror layer", the determining at least one mirror layer from all the mirror layers according to the transmission offsets of all the mirror layers and the data lengths of all the mirror layers includes: determining at least one mirror layer from all the mirror layers whose data length corresponding to the data transmitted to the second node is smaller than the total data length of the mirror layer according to the transmission offsets of each mirror layer in all the mirror layers and the data lengths of each mirror layer in all the mirror layers.
[0082] S102: Transmit the mirror data of the first mirror layer to the second node.
[0083] The first image layer is any image layer in the image file to be transmitted. It should be understood that in order to facilitate the second node to store the first image layer correspondingly, the image data carries the first layer identifier corresponding to the first image layer.
[0084] During the transmission of mirrored data, if the network connection is not stable enough or the bandwidth is limited, resulting in network fluctuations or interruptions, the transmission process may be interrupted.
[0085] Based on this, please continue to refer to Figure 2 , the transmission method provided in the embodiment of the present application also includes:
[0086] S103: If the transmission of the first mirroring layer is interrupted, determine the transmission interruption position according to the current transmission offset of the first mirroring layer.
[0087] The current transmission offset is used to indicate the length of the data currently transmitted successfully; the transmission interruption position indicates the boundary position between the data currently transmitted successfully and the remaining data in the first mirror layer.
[0088] It should be understood that the transmission interruption includes interruptions triggered by the user and interruptions not triggered by the user. If the transmission interruption is an interruption triggered by the user, S103 is: after receiving the resume transmission instruction input by the user, determine the transmission interruption position according to the current transmission offset of the first mirror layer.
[0089] It should be understood that the method for determining a non-user-triggered interruption can refer to the following embodiments, and this application will not go into details here.
[0090] In some embodiments, the transmission offset of the first image layer is determined by the first node itself; or, it is determined by the second node and sent to the first node; or, in the case where the image file needs to be transparently transmitted to the second node through a third node, the transmission offset of the first image layer can also be determined by the third node. Please refer to the following for the detailed determination method, which will not be described here.
[0091] When the transmission of the first mirror layer is interrupted, the current transmission offset of the first mirror layer is determined, that is, the length of the currently successfully transmitted data is determined, and then the transmission interruption position representing the boundary position between the currently successfully transmitted data and the remaining data in the first mirror layer is determined.
[0092] The transmission offset of the first mirror layer is used to indicate the starting position of the target data in the first mirror layer. The starting position can be represented by at least one of the following parameters: the index value of the data in the first mirror layer that has been transmitted to the second node, and the data length corresponding to the data in the first mirror layer that has been transmitted to the second node. It should be understood that the above parameters used to indicate the starting position are only examples, and it is sufficient to indicate the starting position of the target data in the first mirror layer. In the event of an abnormal interruption in the first mirror layer, the transmission offset of the first mirror layer can also be understood as the offset of the breakpoint in the first mirror data relative to the starting point.
[0093] In some embodiments, each image layer included in the image file may correspond to a transmission offset. The relevant concept of the transmission offset of each image layer may refer to the above description of the transmission offset of the first image layer.
[0094] It should be noted that the existence of a transmission offset in the image layer in the image file does not necessarily mean that there is data in the image layer that has not been transmitted to the second node. For example, when the transmission offset of the second image layer includes the data length corresponding to the data in the second image layer that has been transmitted to the second node, if the data length corresponding to the data in the second image layer that has been transmitted to the second node is equal to the total data length of the image data corresponding to the second image layer, it means that the second image layer has been completely transmitted to the second node.
[0095] After obtaining the transmission offset of the first mirror layer, the boundary position between the currently successfully transmitted data and the remaining data in the first mirror layer can be determined according to the transmission offset. Specifically, the data position corresponding to the current transmission offset can be determined first, and then the boundary position after the data position and the next data is used as the transmission interruption position.
[0096] S104: Transmit the target mirror data in the first mirror layer to the second node at the transmission interruption position.
[0097] The target mirror data is located after the transmission interruption position and carries the first layer identifier.
[0098] In the case where the transmission of the first mirror layer is interrupted, it is necessary to complete the retransmission, so the target mirror data located after the transmission interruption position in the mirror data of the first mirror layer is determined and then resent to the second node.
[0099] It should be understood that since the image file includes multiple image layers, in order to facilitate the second node to store the image data, the target image data can carry the first layer identifier, so that when the second node receives the target image data, it can merge it with the already received data of the first image layer and store it.
[0100] It can be seen that in the transmission method provided by the embodiment of the present application, in the process of layered transmission of the first mirror layer in the mirror file to the second node, if the transmission is interrupted, the transmission interruption position is determined according to the current transmission offset of the first mirror layer. Among them, the current transmission offset is used to indicate the length of the data currently transmitted successfully. That is, the boundary position between the successfully transmitted data and the remaining data is determined according to the length of the data that has been successfully transmitted. Then, the target mirror data after the boundary position continues to be transmitted to the second node, and the effect of breakpoint resumption within the mirror layer is achieved. The scheme provided by the present application combines the setting of the transmission offset with the segmented transmission, so that the target data that has not been transmitted in the mirror layer can be accurately located, especially when data retransmission is required, the target data in the mirror layer can be quickly located for transmission; based on this, the reliability of file transmission and the retransmission efficiency are improved.
[0101] In some embodiments, the data volume of the first mirror layer may be large, and network interruption is likely to occur when data is directly transmitted, and it is difficult to determine the transmission offset in the huge data after the interruption. Therefore, the first mirror layer can be segmented and divided into multiple target data, and then one target data is transmitted to the second node in turn.
[0102] Then, after each transmission of the target data in the first mirror layer, the transmission offset is updated to determine whether the first mirror layer is completely transmitted; if it is not completed, the updated target data can be transmitted according to the updated transmission offset. Thus, it is ensured that all data in the first mirror layer is transmitted, and the reliability of file transmission is guaranteed.
[0103] Exemplarily, when the current target data is transmitted successfully, the current transmission offset can be determined based on the position of the current target data in the first mirror layer and the length of the target data; when the current target data is transmitted unsuccessfully, the transmission offset after the previous target data is transmitted can be directly used as the current transmission offset.
[0104] It should be understood that as a feasible implementation method, the first mirror layer can be segmented according to a preset number of segments, that is, the length of the target data is determined based on the length of the mirror data corresponding to the first mirror layer (also referred to as the data length of the first mirror layer in this application). For example, by default, each mirror layer is divided into N segments for transmission, N is a positive integer, and the length of the target data is determined based on the quotient of the length of the mirror data corresponding to the first mirror layer and N. Among them, the preset number of segments can be pre-set by the system, or it can be determined based on user instructions, so as to flexibly set the amount of target data, and the embodiments of the present application do not limit this. In a specific example, the preset number of segments can be 5 segments.
[0105] As another feasible implementation, the first image layer can be segmented according to a preset segment length, that is, the length of the target data is determined according to the preset segment length. The preset segment length can be pre-set by the system or determined based on a user instruction, so as to flexibly set the length of the target data, which is not limited in the embodiment of the present application. In a specific example, the preset segment length can be 128 megabytes (M).
[0106] As another feasible implementation manner, the length of the target data is randomly determined by the first node, as long as the length of the target data does not exceed the length of the data that has not been transmitted in the first mirror layer.
[0107] The transmission method provided in this embodiment can transmit the data in the mirror layer in segments. In this way, on the one hand, the use of data segment transmission avoids the loss of the data of the entire mirror layer when the transmission is abnormal; on the other hand, by combining the setting of the transmission offset with the segment transmission, the target data that has not been transmitted in the mirror layer can be accurately located, especially when data retransmission is required, the target data in the mirror layer can be quickly located for transmission; based on this, the reliability of file transmission and the retransmission efficiency are improved.
[0108] In some embodiments, after S102, the transmission method provided in the embodiment of the present application further includes: when the image data corresponding to the first image layer has been completely transmitted to the second node, transmitting other image layers in the image file except the first image layer to the second node. It should be understood that the transmission method of other image layers can refer to the above-mentioned first image layer, and will not be repeated. Based on this, it can be ensured that all image layers in the image file are completely transmitted, thereby improving the reliability of file transmission.
[0109] In some embodiments, there are two situations due to transmission interruption: one is that the transmission is interrupted before it is completed, and the other is that the transmission is interrupted after it is completed.
[0110] Based on this, the transmission method provided in the embodiment of the present application further includes: after starting to transmit the first mirror layer to the second node, obtaining the transmission offset of the first mirror layer, and detecting whether the transmission is interrupted. That is, the first node can determine whether the transmission is interrupted by obtaining the transmission offset from the second node or the third node.
[0111] Furthermore, during the process of transmitting the first mirror layer to the second node, the first node will successively receive the transmission offset of the first mirror layer returned by the third node at different time points. The first node can use the transmission offset returned at the most recent time point as the current transmission offset.
[0112] Further, S103 can be implemented as follows: determining whether the transmission of the first mirror layer is completed according to the current transmission offset of the first mirror layer and the data length of the first mirror layer; if the transmission of the first mirror layer is not completed, determining the transmission interruption position according to the current transmission offset of the first mirror layer; if the transmission of the first mirror layer is completed, sending the second mirror layer to the second node, and / or outputting a first prompt message, the first prompt message is used to prompt that the transmission of the first mirror layer has been completed.
[0113] That is, first determine whether the first mirror layer has been transmitted based on the current transmission offset of the first mirror layer and the data length of the first mirror layer. If the offset is less than the data length of the first mirror layer, it means that the transmission is interrupted before the transmission is completed, and it is necessary to continue the transmission. Therefore, the transmission interruption position is determined based on the current transmission offset of the first mirror layer. If the offset is equal to the data length of the first mirror layer, it means that the first mirror layer has been transmitted, and it is necessary to continue to send the second mirror layer (if it exists) to the second node, and / or output the first prompt information so that the user can know that the first mirror layer has been transmitted.
[0114] It can be seen that the solution provided by this embodiment takes into account the possibility that the transmission may have been completed when the transmission is interrupted. When the transmission is interrupted, it is first determined whether the transmission is completed. If the transmission is not completed, the transmission is further continued. In addition, in this embodiment, no additional parameters are used when determining the completion of the transmission, but the transmission offset parameter is used to determine whether the first image layer transmission is completed.
[0115] The embodiments of the present application do not limit the manner in which the first node determines that the first mirror layered transmission is interrupted. In other embodiments, the first node can determine the state of the connection by periodically sending a heartbeat message (or heartbeat packet). If the first node does not receive a heartbeat response from the recipient within a certain period of time, it can be considered that the connection has been interrupted, and then determine whether the transmission is completed. In some other embodiments, the first node can set a preset time during the data transmission process. If no confirmation message or data response from the recipient is received within the preset time after sending the data, the first node can consider that the connection has been interrupted, and then determine whether the transmission is completed.
[0116] In some embodiments, since the index value is usually associated with the physical location of the data in the file. In order to facilitate the management of the stored mirror layer, the second node usually calculates the index value of each received data segment. Through the index value, the transmission offset of the data can be directly calculated, so as to quickly locate the required data location. This reduces the time required to search for data in the data file and improves the efficiency of data access. Based on this, in the embodiment of the present application, the index value recorded in the second node can be directly used as the transmission offset.
[0117] Specifically, as a feasible implementation method, when the transmission offset is the index value generated after the second node successfully receives the mirror data in the first mirror layer, S103 determines the transmission interruption position according to the current transmission offset of the first mirror layer, including: determining the length of the data currently transmitted successfully in the first mirror layer according to the index value; determining the transmission interruption position according to the data length of the first mirror layer and the length of the data currently transmitted successfully.
[0118] It is understandable that the index value is generally used to identify or locate a specific element in a data set. In the embodiment of the present application, it refers to a certain identifier or value generated by the second node for subsequent access or management of the data after receiving and processing the first mirror layer. The index value can be a number, a string, or a data structure of a certain composite type generated by the second node according to a certain algorithm or rule after successfully receiving and processing the first mirror layer, and is used to uniquely identify or locate the data in the first mirror layer received by the second node.
[0119] After the first node obtains the index value generated by the second node, if the index value represents the end point of the transmitted data, then the length of the currently successfully transmitted data can be determined by calculating the distance between the index value and the starting point. If the index value represents the starting point of the transmitted data, and we know the length of each data block, then the length of the currently successfully transmitted data can be determined by accumulating the length of the data blocks from the starting point to the current index value.
[0120] The transmission interruption position can be determined by subtracting the length of the currently successfully transmitted data from the data length of the first mirroring layer. Specifically, the interruption position = the data length of the first mirroring layer - the length of the currently successfully transmitted data.
[0121] Furthermore, as a feasible implementation method, after determining the length of the successfully transmitted data in the first mirror layer according to the index value, the length of the successfully transmitted data can be compared with the data length of the first mirror layer. If the length of the successfully transmitted data is less than the data length of the first mirror layer, it is determined that the data in the first mirror layer has not been completely transmitted, and the transmission interruption position is determined to facilitate continued transmission; when the length of the successfully transmitted data is equal to the data length of the first mirror layer, it is determined that the data in the first mirror layer has been completely transmitted, and the transmission of the next mirror layer can be started.
[0122] It can be seen that in this embodiment, the first node can determine the length of the data that has been successfully transmitted by means of the index value recorded by the second node. Since the second node can conveniently manage the various parts of the data file through the index value when processing a large-scale data set, this helps to classify, organize and retrieve the data, thereby improving the efficiency of data management. The solution provided in this embodiment can determine the length of the data that has been successfully transmitted without using new parameters.
[0123] In some embodiments, since the transmission offset is used to characterize the length of the currently successfully transmitted data, based on this, the first node can determine the length of the successfully transmitted data by recording it itself, or by the second node or the third node.
[0124] Specifically, as a feasible implementation, the transmission offset of the first mirror layer is determined and recorded by the first node itself. After determining that a segment of data is successfully transmitted, the first node can determine the current transmission offset according to the data length of the segment of data and the existing transmission offset.
[0125] As another feasible implementation, since the third node is the proxy node of the second node, the transmission offset of the first mirror layer is determined and recorded by the third node. That is, the third node needs to record the transmission offset when successfully transparently transmitting data to the second node.
[0126] In one example, before obtaining the transmission offset each time, the first node sends a request message to the third node to request to obtain the transmission offset.
[0127] In another example, the third node sends the transmission offset to the first node once each time it determines it. In this way, on the one hand, the amount of data transmission is reduced; on the other hand, when the transmission of the first mirror layer is abnormally interrupted, the first node can determine whether an abnormal interruption has occurred based on the reception of the transmission offset; if the transmission offset sent by the second node cannot be received, it is determined that an abnormal interruption has occurred.
[0128] In this regard, the present application also provides a method for obtaining a transmission offset. For example, Figure 3 As shown, the above transmission method also includes the following steps S301 to S302:
[0129] S301: If the first mirror layered transmission is interrupted, send a first query request to a third node.
[0130] The first query request includes a layer identifier of the first image layer. It should be understood that the third node is a proxy node of the second node, and the third node is used to receive and store the transmission offset of the first image layer sent by the second node during the process of transmitting the first image layer from the first node to the second node.
[0131] It should be understood that in this embodiment, the first mirror layered transmission interruption may include but is not limited to at least one of the following: user-self-interruption of transmission, abnormal interruption caused by network connection failure, abnormal interruption caused by hardware failure, abnormal interruption caused by power outage, abnormal interruption caused by software error, and abnormal interruption caused by network congestion, etc. The embodiment of the present application does not impose any limitation on this.
[0132] S302: Receive the current transmission offset of the first mirror layer returned by the third node in response to the first query request.
[0133] After receiving the first query request, the third node queries the corresponding transmission offset according to the layer identifier in the first query request, and then sends it to the first node.
[0134] The transmission method provided by the present application can obtain the transmission offset of the first mirror layer from the third node by reporting the layer identifier of the first mirror layer to the third node through the first node. On the one hand, since the third node may be closer to the transmission receiving end of the mirror file, or the third node itself is the transmission receiving end of the mirror file, the third node can more accurately determine whether the target data is successfully received; therefore, the transmission offset on the third node side is more accurate, which can improve the reliability of file transmission; on the other hand, it is conducive to actively obtaining a more accurate transmission offset from the third node when an abnormal interruption occurs.
[0135] It can be seen that the above is a brief introduction to the transmission method provided by the present application mainly from the first node side, and the present application also provides a transmission method applied to the second node. The transmission method includes: receiving mirror data sent by the first node, and storing the mirror data based on the hierarchical identifier carried by the mirror data.
[0136] The second node is a warehouse end node, which is used to store the mirror data. After receiving the mirror data sent by the first node, it stores the mirror data according to the layer identification carried by the mirror data.
[0137] In some embodiments, after receiving the mirror data sent by the first node, the second node queries whether it has stored data corresponding to the layer identifier according to the layer identifier carried by the mirror data. If yes, the mirror data is merged with the existing mirror data for storage; if no, a new storage area can be added to store the mirror data corresponding to the layer identifier.
[0138] It can be seen that in the embodiment of the present application, data is directly transmitted between the first node and the second node, and there is no need to transfer the image file through other nodes. Especially when transmitting a large image file, it avoids occupying disk IO and space, reduces the transmission time, and improves the transmission efficiency.
[0139] In some embodiments, after receiving the mirrored data, the second node may also update and record the transmission offset of the first mirrored layer according to the reception status of the mirrored data.
[0140] As a possible implementation, see Figure 4 The method provided in the embodiment of the present application further includes the following steps S401-S402:
[0141] S401: The second node generates a transmission offset of a first mirroring layer according to the length of received mirroring data.
[0142] The first image layer is the image layer corresponding to the layer identifier carried by the image data.
[0143] The second node is the final storage party of the data, and it can determine the successfully stored data according to the data stored in itself, and then generate the transmission offset of the first mirror layer.
[0144] It should be understood that the transmission offset may be the length of the successfully stored data, or may be the length of all received first-image layered image data to determine the corresponding index value, which is not limited in this embodiment of the present application.
[0145] As a feasible implementation method, when the transmission offset is an index value, the second node can determine the corresponding index value according to the length of all received first-image layered image data each time it receives image data of a preset length; different index values correspond to different data lengths.
[0146] It should be understood that the index value, as a unique identifier of the data, can help the second node quickly locate the specific location of the received mirror data. In the subsequent data processing or access process, the second node can efficiently retrieve the required data through the index value. In order to facilitate data storage, the second node can generate an index value once each time it receives mirror data of a preset length.
[0147] S402: The second node returns the transmission offset of the first mirror layer to the first node.
[0148] The transmission offset is used by the first node to determine the transmission interruption position when the transmission of the first mirror layer is interrupted. The transmission interruption position indicates the boundary position between the currently successfully transmitted data and the remaining data in the first mirror layer.
[0149] Since the first node is the sender of the data, the second node itself may not know how much data the first node needs to send. Therefore, after determining the transmission offset, the second node needs to return the transmission offset of the first mirror layer to the first node so that the first node can determine the data that has been successfully transmitted and then determine whether to continue the transmission.
[0150] In some embodiments, since the third node is a proxy node of the second node, Figure 4 As shown, after obtaining the transmission offset, the second node can return the transmission offset of the first mirror layer to the third node. It should be understood that the third node is used to receive and store the transmission offset of the first mirror layer sent by the second node during the process of the first node transmitting the first mirror layer to the second node; the third node is also used to send the transmission offset of the first mirror layer to the first node.
[0151] It can be seen that in the solution provided by this embodiment, since the second node is the receiver of the data, the second node generates the transmission offset of the first mirror layer according to the length of the received mirror data, which can more accurately determine whether the data transmission of the first node is interrupted, thereby improving the efficiency of data transmission.
[0152] In some embodiments, when the transmission between the first node and the second node is interrupted, the first node determines the target mirror data of the first mirror layer according to the transmission offset after the interruption, and continues to transmit it to the second node.
[0153] Based on this, the transmission method provided in the embodiment of the present application also includes: receiving target mirror data, the target mirror data is data received after the mirror data transmission is interrupted; according to the layered identifier carried by the target mirror data, merging the target mirror data with the received mirror data with the same layered identifier carried by the target mirror data.
[0154] Since the target mirror data is the data received after the mirror data transmission is interrupted, the second node usually stores data belonging to the same mirror layer as the target mirror data. Therefore, the second node merges the target mirror data with the received mirror data with the same layer identifier carried by the target mirror data according to the layer identifier carried by the target mirror data.
[0155] If the layer identifier of the target image data is the same as the layer identifier of the image data that has been received and stored, the second node will regard the two parts of data as data of the same image layer and store them together, that is, store them together instead of repeatedly storing the same data.
[0156] In some embodiments, since the base layers of multiple image files may be the same, or a certain image file has been transmitted once, the corresponding image layer exists in the second node. Therefore, when transmitting data, it is possible to first query whether the same image layer exists on the second node, and if so, there is no need to continue the transmission.
[0157] Based on this, the transmission method provided by the embodiment of the present application also includes: receiving a query request sent by a third node, the query request including the layer identification or summary information of each image layer in the image file; determining the target layer from each image layer in the image file, the target layer being the image layer existing on the second node; and returning the target layer to the third node.
[0158] Before the first node transmits data to the second node, it can send a query request to the second node through the third node. The query request may include the layer identification or summary information of each image layer in the image file. After receiving the query request, the second node can determine the existing target layer in the image layer stored in itself according to the layer identification or summary information of each image layer, and return it to the third node, so that the third node forwards it to the first node. In this way, the first node can determine the image layer that needs to be continuously transmitted according to the existing target layer in the second node.
[0159] As a feasible implementation method, the query request includes the layer identifiers of each image layer in the image file. At this time, the second node can also send the transmission offset corresponding to each target layer to the third node, so that the first node can determine whether the target layer has been transmitted based on the transmission offset.
[0160] As another feasible implementation method, the query request includes summary information of each image layer in the image file. Since the summary information is used to describe the data content of the image layer, the second node can fully judge whether it has completely stored the image layer corresponding to the summary information. If it does, it indicates that the image layer may have been transmitted in the current image file, or there may be a layer with the same data content in other image files. At this time, the target layer is returned to the third node to avoid the first node from repeatedly transmitting the image layer that already exists in the second node, which can reduce the repetition rate of data transmission.
[0161] The present application also provides a transmission method, which is applied to a third node. Figure 5 , the transmission method comprises:
[0162] S501. In a process in which a first node transmits mirror data in a first mirror layer to a second node, a transmission offset of the first mirror layer generated by the second node is obtained.
[0163] The transmission offset of the first image layer is used to indicate the length of the data successfully transmitted in the first image layer; the first image layer is any image layer in the image file.
[0164] It can be understood that the third node is an agent node of the second node, used to manage and coordinate the second node. Therefore, after generating the transmission offset of the first mirror layer, the second node can send it to the third node so that the third node can manage it.
[0165] S502: each time a transmission offset of a first mirror layer is obtained, the transmission offset of the first mirror layer is returned to the first node; and / or, in response to a first query request sent by the first node, the transmission offset of the first mirror layer obtained most recently is returned to the first node.
[0166] It is understandable that the third node may return the transmission offset of the first mirror layer to the first node each time it receives the transmission offset sent by the second node, so that the first node can determine whether the transmission is interrupted according to the transmission offset.
[0167] The third node may also return the most recently acquired transmission offset of the first mirror layer to the first node when receiving the first query request sent by the first node, so as to facilitate subsequent processing by the first node.
[0168] In some embodiments, since the base layers of multiple image files may be the same, or a certain image file has been transmitted once, the corresponding image layer exists in the second node. Therefore, when transmitting data, it is possible to first query whether the same image layer exists on the second node, and if so, there is no need to continue the transmission.
[0169] Based on this, the transmission method provided by the embodiment of the present application also includes: receiving a second query request sent by the first node; the second query request includes a layer identifier or a summary letter of each image layer in the image file; querying the second node for the image layer that already exists on the second node and belongs to the image file according to the layer identifier or the summary letter of each image layer, and obtaining the target layer, which is the image layer existing on the second node; and returning the target layer to the first node.
[0170] That is, before transmitting data to the second node, the first node may send a query request to the third node, and the query request may include the layer identification or summary information of each image layer in the image file. After receiving the query request, the third node may query the second node for the image layer that already exists on the second node and belongs to the image file according to the layer identification or summary information of each image layer, and return it to the first node. In this way, the first node can determine the image layer that needs to be continuously transmitted according to the target layer already in the second node.
[0171] In some embodiments, after receiving the target data, the third node may also update and record the transmission offset of the first mirror layer according to the reception status of the target data. Please refer to the following description for the specific update method.
[0172] In some embodiments, the third node further receives summary information of the first image layer sent by the first node. The summary information of the first image layer may be sent via a header file of the image file where the first image layer is located.
[0173] In some embodiments, the above-mentioned first image layer is only an example, and the image file where the first image layer is located includes at least one image layer; after the image data corresponding to the first image layer is completely transmitted, the third node also receives the image data corresponding to other image layers except the first image layer in at least one image layer sent by the first node, and transmits it to the second node.
[0174] In some embodiments, the third node also records the universally unique identifier (UUID) of each image layer to distinguish different image layers.
[0175] In some embodiments, the third node further establishes at least one of the following: a correspondence between the summary information of each image layer and a transmission offset, wherein the summary information of each image layer corresponds to a transmission offset; a correspondence between the UUID of each image layer and a transmission offset, wherein the UUID of each image layer corresponds to a transmission offset; a correspondence between the summary information of each image layer and a UUID, wherein the summary information of each image layer corresponds to a UUID.
[0176] In some examples, the third node itself updates the transmission offset of the first mirroring layer. For example, the above step S202 is implemented as: updating the transmission offset of the first mirroring layer according to the length of the target data and the transmission offset of the first mirroring layer.
[0177] Further, the third node determines whether the second node successfully receives the target data; if it is determined that the second node successfully receives the target data, the third node updates the transmission offset of the first mirror layer according to the length of the target data and the transmission offset of the first mirror layer.
[0178] In some embodiments, the above method also includes the following steps: the third node receives a second query request sent by the first node; wherein the second query request is used to request query target summary information, and the target summary information is used to characterize the summary information of the image layer that has not been completely transmitted in the image file, the image file is the file where the first image layer is located, and the image file includes at least one image layer; the second query request includes the summary information of all image layers of the image file; the third node sends a second query response to the first node; wherein the second query response includes the target summary information.
[0179] Based on this, the first node can be assisted in determining the image layers that have not been completely transmitted in the image file, so as to filter out the image layers that have been completely transmitted, avoid repeated transmission of the same image layer, and improve transmission efficiency.
[0180] In order to more clearly illustrate the technical solution provided by this application, several specific examples are provided below.
[0181] (I) Example 1
[0182] like Figure 6 As shown, the transmission method includes the following steps:
[0183] S901: In response to an operation on an image file to be transmitted, a first node obtains the image file.
[0184] S902: The first node parses the image structure in the image file to obtain a header file; and obtains summary information of each image layer in the image file through the header file.
[0185] S903: The first node sends a second query request to the third node; the third node receives the second query request and forwards the second query request to the second node.
[0186] The second query request is used to request to query the target summary information, and the target summary information is used to represent the summary information of the image layer that has not been completely transmitted in the image file; the second query request includes the summary information of all the image layers of the image file.
[0187] S904: The second node sends a second query response to the third node; the third node receives the second query response and forwards the second query response to the first node.
[0188] The second query response includes target summary information.
[0189] S905: The first node determines at least one mirror layer from all mirror layers of the mirror file according to the target summary information, and mirror data corresponding to each mirror layer in the at least one mirror layer has not been completely transmitted to the third node.
[0190] S906: The first node divides each mirror layer into multiple segments of data based on a preset segment length. In a specific example, the preset segment length is 128M.
[0191] S907: When the target data of the first mirror layer in at least one mirror layer has not been transmitted to the second node, the first node transmits the target data to the second node according to the transmission offset of the first mirror layer. Correspondingly, the third node receives the target data transmitted by the first node according to the transmission offset of the first mirror layer.
[0192] The target data is part of the mirror data corresponding to the first mirror layer; and the transmission offset of the first mirror layer is used to indicate the starting position of the target data in the first mirror layer.
[0193] S908. The third node receives the response information fed back by the second node, where the response information is used to indicate whether the second node has successfully received the target data; when the response information indicates that the second node has successfully received the target data, the response information includes an updated transmission offset.
[0194] S909: The third node updates and records the transmission offset of the first mirror layer according to the updated transmission offset.
[0195] S910: The third node feeds back the updated transmission offset to the first node.
[0196] S911. The first node determines whether the mirror data corresponding to the first mirror layer is completely transmitted to the second node based on the updated transmission offset and the data length of the first mirror layer; if not, return to execute step S907. If it is completely transmitted, the first node transmits the other mirror layers in the mirror file except the first mirror layer to the second node until all mirror layers are completely transmitted.
[0197] S912: The first node sends an indication to the user indicating that the image file has been successfully transferred.
[0198] Based on this, the image file can be directly transferred to the second node via the web to improve the upload efficiency. Before uploading the image, the image structure is parsed first, and the second node is queried to see if the same image layer already exists, reducing the amount of data transmitted. In addition, the transmission offset of each image layer is recorded during uploading to provide data support for uploading from any endpoint in the event of an abnormal interruption, reducing the amount of data transmission in the event of an abnormal interruption and improving the retransmission efficiency.
[0199] (II) Example 2
[0200] like Figure 7 As shown, Figure 7 The corresponding scenario is an abnormal retransmission. Taking the abnormal interruption of the first mirror layer as an example, the transmission method includes the following steps:
[0201] S1001. In response to detecting an abnormal interruption during the transmission of a first mirroring layer, a first node sends a first query request to a third node, where the first query request is used to request to obtain a transmission offset of the first mirroring layer, and the first query request includes summary information of the first mirroring layer.
[0202] S1002: The first node receives a first query response sent by the third node, where the first query response includes a transmission offset of a first mirroring layer.
[0203] S1003: The first node transmits target data to the third node according to the transmission offset of the first mirroring layer. Correspondingly, the third node receives the target data transmitted by the first node according to the transmission offset of the first mirroring layer.
[0204] The target data is part of the mirror data corresponding to the first mirror layer; and the transmission offset of the first mirror layer is used to indicate the starting position of the target data in the first mirror layer.
[0205] S1004. The third node receives response information from the second node, where the response information is used to indicate whether the second node has successfully received the target data; when the response information indicates that the second node has successfully received the target data, the response information includes an updated transmission offset.
[0206] S1005. The third node updates and records the transmission offset of the first mirror layer according to the updated transmission offset.
[0207] S1006. The third node feeds back the updated transmission offset to the first node.
[0208] S1007. The first node determines whether the mirror data corresponding to the first mirror layer is completely transmitted to the second node based on the updated transmission offset and the data length of the first mirror layer; if not completely transmitted, return to step S1003; if completely transmitted, end the transmission of the first mirror layer.
[0209] Based on this, when an abnormal interruption occurs, the image layer is transmitted in segments and the transmission offset of the image layer is recorded to support the continued uploading of the image file from any breakpoint, which reduces the amount of data transmitted during the abnormality and improves the retransmission efficiency.
[0210] It can be seen that the above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, the embodiment of the present application provides a hardware structure and / or software module corresponding to each function. It should be easily appreciated by those skilled in the art that, in combination with the modules and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0211] In addition, an embodiment of the present application provides a first node, which is used to execute the transmission method provided by the present application. The first node includes: an acquisition module, a transmission module and a determination module.
[0212] Among them, the acquisition module is used to obtain the image file to be transmitted, the image file includes at least one image layer, and each image layer corresponds to a layer identifier; the transmission module is used to transmit the image data of the first image layer to the second node, and the image data carries the first layer identifier corresponding to the first image layer; the first image layer is any image layer in the image file to be transmitted; the determination module is used to determine the transmission interruption position according to the current transmission offset of the first image layer when the transmission of the first image layer is interrupted; wherein the current transmission offset is used to indicate the length of the data currently transmitted successfully; the transmission interruption position indicates the boundary position between the data currently transmitted successfully and the remaining data in the first image layer; the transmission module is also used to transmit the target image data in the first image layer to the second node at the transmission interruption position, the target image data is located after the transmission interruption position and carries the first layer identifier.
[0213] In some embodiments, the transmission offset is an index value generated after the second node successfully receives the mirror data in the first mirror layer; different index values represent different data lengths; the determination module is specifically used to determine the length of the data currently successfully transmitted in the first mirror layer according to the index value; and determine the transmission interruption position according to the data length of the first mirror layer and the length of the data currently successfully transmitted.
[0214] In some embodiments, the acquisition module is further used to, after starting to transmit the first mirror layer to the second node, acquire a transmission offset of the first mirror layer and detect whether the transmission is interrupted;
[0215] The determination module is specifically used to determine whether the first mirror layer has been transmitted according to the current transmission offset of the first mirror layer and the data length of the first mirror layer; if the first mirror layer has not been transmitted, determine the transmission interruption position according to the current transmission offset of the first mirror layer; if the first mirror layer has been transmitted, send the second mirror layer to the second node, and / or output a first prompt message, where the first prompt message is used to prompt that the first mirror layer has been transmitted.
[0216] In some embodiments, the determination module is specifically used to determine all image layers of the image file, and query the second node for the image layers that already exist on the second node; mark the image layers in the image file that do not exist on the second node as target image layers to be transmitted; the transmission module is specifically used to transmit the target image layers to the second node one by one, and the first image layer is any target image layer.
[0217] The embodiment of the present application also provides a second node, which is used to execute the transmission method provided by the present application. The second node includes: a receiving module, which is used to receive the mirror data sent by the first node, and store the mirror data based on the layer identification carried by the mirror data.
[0218] In some embodiments, the second node also includes: a determination module, which is used to generate a transmission offset of a first mirror layer according to the length of the received mirror data, and the first mirror layer is the mirror layer corresponding to the layer identifier carried by the mirror data; a sending module, which is used to return the transmission offset of the first mirror layer to the first node; the transmission offset is used by the first node to determine the transmission interruption position when the transmission of the first mirror layer is interrupted, and the transmission interruption position indicates the boundary position between the data currently successfully transmitted and the remaining data in the first mirror layer.
[0219] In some embodiments, the sending module is specifically used to return the transmission offset of the first mirror layer to the third node; the third node is a proxy node of the second node, and the third node is used to receive and store the transmission offset of the first mirror layer sent by the second node during the process of transmitting the first mirror layer from the first node to the second node; the third node is also used to send the transmission offset of the first mirror layer to the first node.
[0220] In some embodiments, the determination module is specifically configured to determine a corresponding index value according to the length of all received first-image layered image data each time image data of a preset length is received; different index values correspond to different data lengths.
[0221] In some embodiments, the receiving module is also used to receive target mirror data, which is data received after the mirror data transmission is interrupted; according to the layer identifier carried by the target mirror data, the target mirror data is merged with the received mirror data with the same layer identifier carried by the target mirror data.
[0222] In some embodiments, the receiving module is also used to receive a query request sent by a third node, wherein the query request includes a layer identifier or summary information of each image layer in the image file; wherein the summary information is used to describe the data content of the image layer; the second node also includes: a determination module, which is used to determine a target layer from each image layer in the image file, wherein the target layer is the image layer existing on the second node; and returns the target layer to the third node.
[0223] The embodiment of the present application also provides a third node for executing the transmission method provided by the present application. The third node includes: an acquisition module and a sending module. The acquisition module is used to acquire the transmission offset of the first mirror layer generated by the second node during the process of the first node transmitting the mirror data in the first mirror layer to the second node; the transmission offset of the first mirror layer is used to indicate the length of the data successfully transmitted in the first mirror layer; the first mirror layer is any mirror layer in the mirror file; the sending module is used to return the transmission offset of the first mirror layer to the first node each time the transmission offset of the first mirror layer is acquired; and / or, in response to the first query request sent by the first node, return the transmission offset of the first mirror layer acquired the most recently to the first node; wherein the transmission offset is used by the first node to determine the transmission interruption position when the transmission of the first mirror layer is interrupted, and the transmission interruption position indicates the boundary position between the currently successfully transmitted data and the remaining data in the first mirror layer.
[0224] In some embodiments, the third node also includes a receiving module for receiving a second query request sent by the first node; the second query request includes a layer identifier or summary information of each image layer in the image file; wherein the summary information is used to describe the data content of the image layer; according to the layer identifier or summary information of each image layer, the second node is queried for the image layer that already exists on the second node and belongs to the image file, and the target layer is obtained, and the target layer is the image layer existing on the second node; the sending module is also used to return the target layer to the first node.
[0225] It should be noted that the above division of modules is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, two or more functions may be integrated into one processing module. The above integrated modules may be implemented in the form of hardware or software function modules.
[0226] In the case of implementing the functions of the above-mentioned integrated modules in the form of hardware, the embodiment of the present application also provides a structural schematic diagram of an electronic device. Figure 8 As shown, the electronic device includes: a processor 1102 and a bus 1104. Optionally, the electronic device may further include a memory 1101; and optionally, the electronic device may further include a communication interface 1103.
[0227] The processor 1102 may be a processor that implements or executes various exemplary logic blocks, modules, and circuits described in conjunction with the present application. The processor 1102 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may be a processor that implements or executes various exemplary logic blocks, modules, and circuits described in conjunction with the present application. The processor 1102 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0228] The communication interface 1103 is used to connect with other devices via a communication network, such as Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0229] The memory 1101 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0230] As a possible implementation, the memory 1101 may exist independently of the processor 1102, and the memory 1101 may be connected to the processor 1102 via a bus 1104 for storing instructions or program codes. When the processor 1102 calls and executes the instructions or program codes stored in the memory 1101, the transmission method provided in the embodiment of the present application can be implemented.
[0231] In another possible implementation, the memory 1101 may also be integrated with the processor 1102 .
[0232] The bus 1104 may be an extended industry standard architecture (EISA) bus, etc. The bus 1104 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0233] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the electronic device can be divided into different functional modules to complete all or part of the functions described above.
[0234] The present application embodiment also provides a computer-readable storage medium. All or part of the processes in the above method embodiment can be completed by computer instructions to indicate the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it may include the processes of the above method embodiments. The computer-readable storage medium can be any of the above embodiments or memory. The above computer-readable storage medium can also be the above external storage device based on the electronic device, such as the plug-in hard disk equipped on the above electronic device, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. Further, the above computer-readable storage medium can also include both the internal storage unit and / or the external storage device of the above electronic device. In addition, the computer-readable storage medium can be used to store other programs and data required for the computer program product and the above electronic device. The above computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0235] An embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute any one of the transmission methods provided in the above embodiments.
[0236] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. The term "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in a claim. Certain measures are recorded in mutually different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0237] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0238] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A transmission method, characterized in that: Applied to the first node, the method comprises: Acquire an image file to be transmitted, wherein the image file includes at least one image layer, and each image layer corresponds to a layer identifier; Transmitting image data of a first image layer to a second node, wherein the image data carries a first layer identifier corresponding to the first image layer; the first image layer is any image layer in the image file to be transmitted; If the transmission of the first mirror layer is interrupted, the transmission interruption position is determined according to the current transmission offset of the first mirror layer; wherein the current transmission offset is used to indicate the length of the data currently successfully transmitted; and the transmission interruption position indicates the boundary position between the data currently successfully transmitted and the remaining data in the first mirror layer; The target mirror data in the first mirror layer is transmitted to the second node at the transmission interruption position, wherein the target mirror data is located after the transmission interruption position and carries the first layer identifier.
2. The method according to claim 1, characterized in that The transmission offset is an index value generated after the second node successfully receives the mirror data in the first mirror layer; Different index values represent different data lengths; The determining the transmission interruption position according to the current transmission offset of the first mirror layer includes: Determine, according to the index value, the length of the data currently successfully transmitted in the first mirror layer; The transmission interruption position is determined according to the data length of the first mirroring layer and the length of the currently successfully transmitted data.
3. The method according to claim 1, characterized in that The method further includes: after starting to transmit the first mirror layer to the second node, obtaining a transmission offset of the first mirror layer, and detecting whether the transmission is interrupted; If the transmission of the first mirror layer is interrupted, determining the transmission interruption position according to the current transmission offset of the first mirror layer includes: determining whether the transmission of the first mirror layer is completed according to the current transmission offset of the first mirror layer and the data length of the first mirror layer; If the first mirror layer is not completely transmitted, determining the transmission interruption position according to the current transmission offset of the first mirror layer; If the transmission of the first mirror layer is completed, the second mirror layer is sent to the second node, and / or first prompt information is output, where the first prompt information is used to prompt that the transmission of the first mirror layer is completed.
4. The method according to any one of claims 1 to 3, characterized in that: After obtaining the image file, the method further includes: Determine all image layers of the image file, and query the second node for image layers that already exist on the second node; Marking the image layer in the image file that does not exist on the second node as a target image layer to be transmitted; The transmitting the image file to the second node includes: The target image layers are transmitted to the second node one by one, wherein the first image layer is any of the target image layers.
5. A transmission method, characterized in that: Applied to the second node, the method comprises: Receiving mirrored data sent by the first node, and storing the mirrored data based on a layered identifier carried by the mirrored data; receiving target mirror data, wherein the target mirror data is data received after the mirror data transmission is interrupted; According to the layer identifier carried by the target image data, the target image data is merged with the received image data having the same layer identifier as that carried by the target image data.
6. The method according to claim 5, characterized in that The method further comprises: Determine a transmission offset of a first mirror layer according to the length of the received mirror data; the first mirror layer is a mirror layer corresponding to a layer identifier carried by the mirror data; Returning the transmission offset of the first mirror layer to a third node; the third node is a proxy node of the second node, and the third node is used to receive and store the transmission offset of the first mirror layer sent by the second node during the process of the first node transmitting the first mirror layer to the second node; the third node is also used to send the transmission offset of the first mirror layer to the first node.
7. The method according to claim 6, characterized in that The method further comprises: receiving a query request sent by the third node, wherein the query request includes a layer identifier or summary information of each image layer in the image file; wherein the summary information is used to describe the data content of the image layer; Determine a target layer from each image layer in the image file, wherein the target layer is the image layer existing on the second node; The target hierarchy is returned to the third node.
8. A transmission method, characterized in that: Applied to the third node, the method includes: In the process of transmitting the mirror data in the first mirror layer from the first node to the second node, the transmission offset of the first mirror layer generated by the second node is obtained; the transmission offset of the first mirror layer is used to indicate the length of the data successfully transmitted in the first mirror layer; the first mirror layer is any mirror layer in the mirror file; Each time the transmission offset of the first mirror layer is obtained, the transmission offset of the first mirror layer is returned to the first node; and / or, in response to a first query request sent by the first node, the transmission offset of the first mirror layer obtained most recently is returned to the first node; The transmission offset is used by the first node to determine a transmission interruption position when the transmission of the first mirror layer is interrupted, and the transmission interruption position indicates a boundary position between the currently successfully transmitted data and the remaining data in the first mirror layer.
9. The method according to claim 8, characterized in that The method further comprises: receiving a second query request sent by the first node; the second query request includes a layer identifier or summary information of each image layer in the image file; wherein the summary information is used to describe the data content of the image layer; According to the layer identifier or summary information of each image layer, query the second node for an image layer that already exists on the second node and belongs to the image file, to obtain a target layer, where the target layer is the image layer existing on the second node; The target hierarchy is returned to the first node.
10. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1-4, 5-7 or 8-9.