A file breakpoint continuation method and device, computer equipment and storage medium
By differentiating transmission methods based on file size and combining instant transmission with slice transmission, the problem of automatic retransmission after file transmission is interrupted is solved, achieving efficient breakpoint resumption and reducing manual intervention and resource waste.
Patent Information
- Application Number
- CN202410644645.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-05-23
AI Technical Summary
Existing technologies cannot intelligently determine the file transfer method, nor can they automatically resume the transfer after a failure, resulting in manual intervention that is costly and time-consuming.
The file type is determined based on the file size and a preset threshold. Small files are transferred using a second-transfer logic, while large files are transferred in segments. The transfer progress is recorded through a configuration file to enable resumeable downloads.
Automated handling of file transfer interruptions reduces manual intervention, improves transfer efficiency and speed, and reduces resource waste.
Smart Images

Figure CN118509430B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of computer, and particularly relates to a file breakpoint resume method and device, computer equipment and storage medium. BACKGROUND
[0002] A data lake is a large warehouse for storing structured and unstructured data, which allows an organization to store a large amount of raw and unprocessed data. The data in the data lake is processed and used for log analysis, user behavior analysis, and batch file transmission.
[0003] At present, the file transmission mode of large data of a credit card in the industry is as follows: the data lake file is processed by a UDS unified data interaction application, and is transmitted to a downstream application after being decoded and split according to file transmission information by using ftp, etran or platform distribution. File transmission is performed at the beginning of the event date, and the file is moved to a backup directory after the file transmission is successful. If the transmission fails, different levels of batch alarms are generated according to the importance of the application, and then the application operation and maintenance personnel manually intervene to retransmit the file until the transmission is successful. This method cannot intelligently determine the file transmission mode, and cannot change the algorithm mode for retransmission after the file transmission fails.
[0004] When using the above method for file transmission, in addition to interruptions caused by the application itself (such as data lake server downtime, insufficient disk capacity, communication problems, etc.), file breakpoint resume is not currently supported, and manual intervention is required to start file transmission again, which consumes labor costs and may result in delayed manual processing. In addition, when batch large files are transmitted at the end of the day, it takes a long time. SUMMARY
[0005] To solve the problem that the prior art does not support file breakpoint resume and requires manual intervention, the embodiments of the present specification provide a file breakpoint resume method, device, computer equipment and storage medium.
[0006] The embodiments of the present specification provide a file breakpoint resume method, which comprises: determining the type of a to-be-transmitted file according to the size of the to-be-transmitted file and a preset threshold, wherein the type of the to-be-transmitted file comprises a first type file and a second type file; transmitting the first type file by calling a second transmission logic to obtain a second transmission result; transmitting the second type file after slicing to obtain a slicing transmission result of the second type file; and if the slicing transmission result is a failure, determining a position of a transmission failure of the second type file and retransmitting from the position.
[0007] According to an aspect of the embodiments of the present disclosure, the slicing and then transmitting the second type file to obtain a slicing transmission result of the second type file comprises: slicing the second type file according to a preset size to obtain a plurality of slice files of the same size; and sequentially uploading the slice files to obtain the slicing transmission result.
[0008] According to an aspect of the embodiments of the present disclosure, before determining the position of the second type file transmission failure, the method comprises: assigning a serial number to each slice file and determining the number of slice files; and creating a configuration file according to the number of slice files, wherein the length of the configuration file is equal to the total number of slices.
[0009] According to an aspect of the embodiments of the present disclosure, the method further comprises: during the slicing transmission of the second type file, writing preset data in the configuration file at a position corresponding to a successfully uploaded slice file; and determining the position of the second type file transmission failure according to the preset data recorded in the configuration file.
[0010] According to an aspect of the embodiments of the present disclosure, the method further comprises: when the seeding result is failure, slicing the first type file to obtain a plurality of first slice files of the same size; transmitting the plurality of first slice files respectively to obtain a first slice transmission result; and if the first slice transmission result is failure, recording the position of the first type file transmission failure and retransmitting from the position.
[0011] According to an aspect of the embodiments of the present disclosure, the retransmission from the position comprises: determining the untransmitted content of the second type file according to the position of the second type file transmission failure; and retransmitting the untransmitted content from the position.
[0012] According to an aspect of the embodiments of the present disclosure, the seeding logic is called to transmit the first type file to obtain a seeding result, which comprises: using a set method of redis to store the upload state of the first type file; when the upload state is upload complete, determining whether the server has the same file; if yes, entering the seeding logic; and if no, not performing the seeding.
[0013] The embodiment of the present specification provides a file breakpoint continuation transmission device, the device comprises: a file type determination unit, configured to determine the type of a to-be-transmitted file according to the size of the to-be-transmitted file and a preset threshold, wherein the type of the to-be-transmitted file comprises a first type file and a second type file; a second transmission unit, configured to transmit the first type file by calling a second transmission logic to obtain a second transmission result; a slice transmission result acquisition unit, configured to transmit the second type file after slicing to obtain a slice transmission result of the second type file; and a retransmission unit, configured to retransmit the second type file from a position where the transmission of the second type file fails if the slice transmission result is a failure.
[0014] The embodiment of the present specification provides a computer device, comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the file breakpoint continuation transmission method when executing the computer program.
[0015] The embodiment of the present specification also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the file breakpoint continuation transmission method.
[0016] The embodiment of the present specification also provides a computer program product, wherein the computer program product comprises a computer program, and the computer program is executed by a processor to implement the file breakpoint continuation transmission method.
[0017] The embodiment of the present specification establishes a second transmission and breakpoint continuation transmission implementation mechanism, so as to ensure that the file retransmission is automatically initiated after the transmission is interrupted due to external objective reasons in the scenario supporting retransmission, and reduce manual intervention and processing time. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or prior art description. Obviously, the drawings in the following description are only some embodiments of the present specification, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0019] Figure 1 A flowchart of a file breakpoint continuation transmission method according to an embodiment of the present specification is shown;
[0020] Figure 2 A flowchart of a method for obtaining a slice transmission result of a second type file according to an embodiment of the present specification is shown;
[0021] Figure 3 A flowchart of a method for creating a configuration file according to an embodiment of the present specification is shown;
[0022] Figure 4Fig. 1 shows a flow chart of a method for determining a failed position of a second type file transmission according to an embodiment of the present specification;
[0023] Figure 5 Fig. 2 shows a flow chart of a method for file resuming according to an embodiment of the present specification;
[0024] Figure 6 Fig. 3 shows a structural schematic diagram of a file resuming device according to an embodiment of the present specification;
[0025] Figure 7 Fig. 4 shows a specific structural schematic diagram of a file resuming device according to an embodiment of the present specification;
[0026] Figure 8 Fig. 5 shows a structural schematic diagram of a computer device according to an embodiment of the present specification.
[0027] List of symbols:
[0028] 601, file type determining unit;
[0029] 602, file resuming unit;
[0030] 603, slice transmission result obtaining unit;
[0031] 6031, slice module;
[0032] 6032, configuration file creating module;
[0033] 604, retransmission unit;
[0034] 802, computer device;
[0035] 804, processor;
[0036] 806, memory;
[0037] 808, driving mechanism;
[0038] 810, input / output module;
[0039] 812, input device;
[0040] 814, output device;
[0041] 816, presentation device;
[0042] 818, graphical user interface;
[0043] 820, network interface;
[0044] 822, communication link;
[0045] 824, communication bus. DETAILED DESCRIPTION
[0046] In order to make the technical solutions in the specification better understood by those skilled in the art, the technical solutions in the specification will be clearly and completely described below in combination with the drawings in the specification. Obviously, the described embodiments are only part of the embodiments of the specification, not all. Based on the embodiments in the specification, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the specification.
[0047] It should be noted that the terms "first", "second" and the like in the specification and claims of the specification and the above drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the specification described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, device, product or equipment including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or equipment.
[0048] The specification provides method operation steps as described in the embodiments or flowcharts, but can include more or less operation steps based on routine or non-creative labor. The order of steps listed in the embodiments is only one of the many execution orders of the steps, and does not represent the only execution order. In actual system or device product execution, the method order shown in the embodiments or drawings can be executed in sequence or in parallel.
[0049] It should be noted that the file resuming method of the specification can be used in the computer technology field, and can also be used in the financial technology field. The application field of the file resuming method and device of the specification is not limited.
[0050] Figure 1 The flowchart of the file resuming method of the embodiment of the specification is shown, which specifically includes the following steps:
[0051] Step 101, determining the type of the to-be-transmitted file according to the size of the to-be-transmitted file and the preset threshold, the type of the to-be-transmitted file including a first type file and a second type file.
[0052] In the embodiments of the present disclosure, in daily business processing, it is usually required to upload a local file of a user to a server. Batch files such as end-of-day files have different file sizes, and small files can be quickly transmitted using a second transmission mechanism, which can save transmission hard disk resources. However, for large files, if the second transmission logic is used for transmission, there is a high probability of transmission interruption risk during the transmission process. Therefore, for files of different sizes, different transmission methods need to be used for uploading.
[0053] In the embodiments of the present disclosure, the preset threshold for determining the type of the file to be transmitted can be adjusted according to actual conditions. For example, the preset threshold is 20 megabytes. The file to be transmitted with a file size greater than 20 megabytes is determined as a second type file, and the file to be transmitted with a file size less than 20 megabytes is determined as a first type file.
[0054] In step 102, the first type file is transmitted by calling the second transmission logic, and a second transmission result is obtained.
[0055] In the embodiments of the present disclosure, the second transmission can avoid uploading files with the same content. In the embodiments of the present disclosure, the hash value in the form of a fixed-length string is obtained by performing an encryption operation on the file content of the first type file, and the hash value is determined as the unique identifier of the first type file. Before the file is uploaded, the unique identifier of the first type file is sent to the server side. After receiving the hash value, the server side checks whether the file content corresponding to the hash value already exists in the server. If it exists, the file uploading operation is not required, and the second transmission function can be directly performed. In this step, by calling the data lake data transmission interface, Hadoop encrypts, copies and temporarily stores the first type file initiating the transmission request in the scene transmission program for caching, and waits for the server side to determine whether the hash value exists, and determines whether to perform the second transmission according to the determination result.
[0056] In the embodiments of the present disclosure, the hash value calculated from the same file content is the same, and the hash value calculated from different file content is different. Therefore, if the server side already exists the file content corresponding to the same hash value, it means that the server side has received the same file, and therefore the second transmission can be directly performed on the current first type file. Specifically, only the hash value and file information of the first type file need to be transmitted. If the server side does not exist the hash value, the uploading process of the first type file needs to be performed.
[0057] Using the second transmission mechanism can improve the file transmission speed and efficiency, reduce unnecessary network transmission operations, save bandwidth resources, and improve the overall network performance.
[0058] In step 103, the second type file is transmitted after being sliced, and a second type file slicing transmission result is obtained.
[0059] In the embodiment of the present specification, for the second type of file with large memory, such as log, customer information, etc., the slicing algorithm is used for slicing and transmission, and the slicing transmission result of the second type of file is obtained. It can be understood that the second type of file occupies a large resource, so the second type of file is divided into multiple parts and transmitted respectively. Therefore, the resource occupied by each part of the second type of file in the transmission process is relatively uniform, and it is not easy to cause transmission failure.
[0060] In step 104, if the slicing transmission result is failure, the position of the second type of file transmission failure is determined, and the retransmission is performed from the position.
[0061] In the embodiment of the present specification, the retransmission from the position includes: determining the untransmitted content of the second type of file according to the position of the second type of file transmission failure; and retransmitting the untransmitted content from the position. During the uploading of the second type of file, if the uploading is interrupted due to abnormal factors such as system crash or network interruption, the client needs to record the progress of the uploading of the second type of file. When supporting re-uploading of the remaining file thereafter, the uploading can be continued from the place where the uploading of the second type of file was interrupted last time. In order to avoid the problem that the progress data after uploading of the client is deleted and the uploading from the beginning is restarted, the server can also provide a corresponding interface to facilitate the client to query the sliced data of the second type of file which has been uploaded, so that the client learns the sliced file of the second type of file which has been uploaded, and continues to upload from the next sliced file.
[0062] In the present specification, when encountering abnormal conditions such as server interruption and system crash, the file transmission is completed by breakpoint resume when supporting re-uploading, which avoids manual intervention.
[0063] In the embodiment of the present specification, the first type of file is transmitted by calling the second transmission logic, and the second transmission result is obtained.
[0064] The upload state of the first type of file is stored by using the set method of redis;
[0065] When the upload state is upload complete, it is judged whether the server exists the same file;
[0066] If yes, the second transmission logic is entered;
[0067] If no, the second transmission is not performed.
[0068] In the embodiment of the present application, the uploading state is in the form of a key-value pair. The key is the hash value calculated by encrypting the first type file, and the value is a flag indicating whether the uploading is completed. According to the flag, it is determined whether the uploading of the first type file is completed. If yes, it is further determined whether the server already has the hash value of the first type file. If yes, it indicates that the server already has the same file, and the second type file is uploaded by the second type file uploading method. If no, the second type file is not uploaded by the second type file uploading method.
[0069] Figure 2 Fig. 1 shows a flow chart of a method for obtaining a slice transmission result of a second type file according to an embodiment of the present application. The method comprises the following steps:
[0070] In step 201, the second type file is sliced according to a preset size to obtain a plurality of slice files with the same size. In the embodiment of the present application, the second type file is divided into a plurality of slice files with the same size according to a fixed size. For example, the size of the second type file is 100 megabytes, and the second type file is sliced according to a size of 1 megabyte per slice to obtain 100 slice files, each with a file size of 1 megabyte.
[0071] In step 202, the slice files are uploaded in sequence to obtain a slice transmission result. In this step, the sliced files are uploaded in sequence according to the order or number to realize the transmission of the second type file.
[0072] In the embodiment of the present application, during the transmission of the slice files of the second type file, when an abnormal situation such as server interruption or system crash occurs, the transmission of the slice files is interrupted, and the slice transmission result is failure or abnormal. When the second type file is supported to be uploaded again, the remaining second type file is continued to be transmitted from the place where the transmission is interrupted by breakpoint continuation, avoiding manual intervention.
[0073] Figure 3 Fig. 3 shows a flow chart of a method for creating a configuration file according to an embodiment of the present application. The method comprises the following steps:
[0074] In step 301, a serial number is allocated to each slice file to determine the number of slice files.
[0075] In the foregoing step, after the second type file is sliced, a plurality of slice files are obtained. Further, all the slice files are numbered according to the slice order or slice time, so as to allocate a serial number to each slice file. For example, the size of the second type file is 100 megabytes, and the second type file is sliced according to a size of 1 megabyte per slice to obtain 100 slice files.
[0076] At step 302, a configuration file is created according to the number of slices of a slice file, and the length of the configuration file is equal to the total number of slices. In this specification, a configuration file is constructed for each second-type file by the server, for recording the position of each slice file. The length of each configuration file is the same as the number of slices of the corresponding second-type file. For example, a second-type file with a file size of 100 megabytes is constructed with a configuration file with a size of 100 slice files. In this embodiment of this specification, the transmission progress of each second-type file in the transmission process can be determined through the configuration file. Specifically, the current slice file to which the second-type transmission file is transmitted can be determined, and the number of slice files remaining in the second-type transmission file that have not been transmitted can be determined when the transmission fails.
[0077] Figure 4 A flow chart of a method for determining the position of a second-type file transmission failure is shown in this embodiment of this specification, and specifically includes the following steps:
[0078] At step 401, during the slice transmission process of a second-type file, a preset data is written in the configuration file at the position corresponding to the slice file after each slice file is successfully uploaded.
[0079] In this embodiment of this specification, a value, for example, Byte.MAX_VALUE 127, is written in the configuration file corresponding to the second-type file after each chunk slice file is uploaded. The position corresponding to the slice file that has not been uploaded in the configuration file is 0 by default.
[0080] At step 402, the position of the second-type file transmission failure is determined according to the preset data recorded in the configuration file.
[0081] In this embodiment of this specification, an abnormal slice transmission result is obtained after the slice transmission of a second-type file. The server can determine the transmission progress of the second-type file according to the preset data recorded in the configuration file. Specifically, the position of the configuration file recording the preset data indicates that the corresponding slice file has been successfully transmitted. The position of the configuration file recording 0 indicates that the corresponding slice file has not been transmitted. Therefore, according to the data recorded in the configuration file, it can be determined which slice files of the second-type file are currently transmitted, how many slice files of the second-type file are transmitted, and how many slice files of the second-type file remain to be transmitted.
[0082] In some other embodiments of this specification, the server calculates the start position of the second-type file breakpoint resume according to the sequence number of the slice file and the size of each slice file.
[0083] Figure 5A flow chart of a file breakpoint resume method is shown, and specifically includes the following steps:
[0084] Step 501, when the second transmission result is failure, slice the first type file to obtain a plurality of first slice files with the same size.
[0085] In the embodiment of the present specification, when the first type file with small file size fails in the second transmission, the same slicing method as the second type file is performed on the first type file. Specifically, the slicing method described above is called to slice the first type file according to a fixed size. The fixed size for slicing the first type file is not necessarily the same as the fixed size for slicing the second type file, and can be adjusted according to the file size.
[0086] Step 502, the plurality of first slice files are transmitted respectively to obtain a first slice transmission result. In this step, each slice file in the first slice file is transmitted in sequence. If all the first slice files in the first type file are transmitted at one time, the first slice transmission result is success; if there is a slice file in the first type file that fails to be transmitted at one time, the first slice transmission result is failure or exception.
[0087] Step 503, if the first slice transmission result is failure, record the position of the first type file transmission failure, and retransmit from the position.
[0088] In this step, if the slicing transmission process of the first type file also occurs interruption or exception, the configuration file constructed in advance for the first type file is also used to determine the file position of the first type file transmission failure. In the next new file transmission, the remaining untransmitted files of the first type file are retransmitted from the file position of the last transmission failure of the first type file.
[0089] In the embodiment of the present specification, the core code of the write operation is as follows:
[0090] RandomAccessFile implementation
[0091] @UploadMode(mode=UploadModeEnum.RANDOM_ACCESS)
[0092] @Slf4j
[0093] public class RandomAccessUploadStrategy extends SliceUploadTemplate{
[0094] @Autowired
[0095] private FilePathUtil filePathUtil;
[0096] @Value("${upload.chunkSize}")
[0097] private long defaultChunkSize;
[0098] @Override
[0099] public boolean upload(FileUploadRequestDTO param){
[0100] RandomAccessFile accessTmpFile=null;
[0101] try{
[0102] String uploadDirPath=filePathUtil.getPath(param);
[0103] File tmpFile=super.createTmpFile(param);
[0104] accessTmpFile=new RandomAccessFile(tmpFile,"rw");
[0105] / / This must match the value set on the front end.
[0106] long chunkSize=Objects.isNull(param.getChunkSize())? defaultChunkSize*1024*1024
[0107] :param.getChunkSize();
[0108] long offset=chunkSize*param.getChunk();
[0109] / / Offset to locate this fragment
[0110] accessTmpFile.seek(offset);
[0111] / / Write data to this fragment
[0112] accessTmpFile.write(param.getFile().getBytes());
[0113] boolean isOk = super.checkAndSetUploadProgress(param, uploadDirPath);
[0114] return isOk;
[0115] }catch(IOException e){
[0116] log.error(e.getMessage(), e);
[0117] }finally{
[0118] FileUtil.close(accessTmpFile);
[0119] }
[0120] return false;
[0121] }
[0122] }
[0123] As Figure 6 shown is a structural schematic diagram of a file breakpoint resume transmission device according to an embodiment of the present specification, and the basic structure of the operation guiding device is described in the diagram, wherein the functional units and modules can be implemented in a software manner, or can be implemented by using general chips or specific chips to implement file breakpoint resume transmission, and the device specifically comprises:
[0124] a file type determining unit 601 configured to determine the type of a to-be-transmitted file according to the size of the to-be-transmitted file and a preset threshold value, wherein the type of the to-be-transmitted file comprises a first type file and a second type file;
[0125] a second transmission unit 602 configured to call a second transmission logic to transmit the second type file, and obtain a second transmission result of the second type file;
[0126] a slice transmission result obtaining unit 603 configured to transmit the second type file after slicing, and obtain a slice transmission result of the second type file;
[0127] a retransmission unit 604 configured to determine a position of a transmission failure of the second type file if the slice transmission result is a failure, and retransmit from the position.
[0128] As an embodiment of the present specification, reference can also be made to Figure 7The figure shows a specific structural schematic diagram of the file breakpoint continuation device of the embodiment.
[0129] As an embodiment of the specification, the slice transmission result acquisition unit 603 further includes:
[0130] The slice module 6031 is configured to slice the second type file according to the preset size to obtain a plurality of slice files with the same size.
[0131] The configuration file creation module 6032 is configured to create a configuration file according to the slice quantity of the slice file.
[0132] As shown in the figure, Figure 8 The figure shows a schematic diagram of a computer device provided by the embodiment of the specification, and the file breakpoint continuation described in the specification can be executed by the computer device. The computer device 802 can include one or more processors 804, such as one or more central processing units (CPUs), each of which can implement one or more hardware threads. The computer device 802 can also include any memory 806 for storing any kind of information such as code, settings, data, etc. Without limitation, for example, the memory 806 can include any one or a combination of the following: any type of RAM, any type of ROM, a flash memory device, a hard disk, an optical disk, etc. More generally, any memory can store information using any technology. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 802. In one case, the computer device 802 can perform any operation of the associated instructions when the processor 804 executes the associated instructions stored in any memory or combination of memories. The computer device 802 also includes one or more drive mechanisms 808 for interacting with any memory, such as a hard disk drive mechanism, an optical disk drive mechanism, etc.
[0133] The computer device 802 can also include an input / output module 810 (I / O) for receiving various inputs (via input devices 812) and for providing various outputs (via output devices 814). One specific output mechanism can include a presentation device 816 and an associated graphical user interface (GUI) 818. In other embodiments, the input / output module 810 (I / O), the input devices 812, and the output devices 814 can also not be included, just as a computer device in a network. The computer device 802 can also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the above-described components together.
[0134] The communication links 822 can be implemented in any manner, such as through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication links 822 can include any combination of hardwired links, wireless links, routers, gateway functionality, name servers, etc., governed by any protocol or combination of protocols.
[0135] Corresponding to the method in Figures 1 to 5 The embodiments of the present specification also provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the steps of the above method.
[0136] The embodiments of the present specification also provide a computer readable instruction, wherein when the processor executes the instruction, the program therein causes the processor to perform the method as shown in Figures 1 to 5 .
[0137] The embodiments of the present specification also provide a computer program product, which comprises a computer program, and the computer program is executed by a processor to perform the method as shown in Figures 1 to 5 .
[0138] It should be understood that the size of the sequence number of the above-mentioned processes in various embodiments of the present specification does not mean the order of execution, and the execution order of the processes should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present specification.
[0139] It should also be understood that in the embodiments of the present specification, the term "and / or" is only to describe the association relationship of the associated objects, which means that there can be three relationships. For example, A and / or B can represent three cases of A alone, A and B together, and B alone. In addition, the character " / " in the present specification generally represents an "or" relationship between the front and rear associated objects.
[0140] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the present specification can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been described in general terms in the above description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present specification.
[0141] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0142] In several embodiments provided in the present specification, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the described device embodiments are merely schematic. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be electric, mechanical or in other forms.
[0143] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present specification.
[0144] In addition, each functional unit in the various embodiments of the present specification can be integrated in one processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.
[0145] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present specification essentially, or the part that contributes to the prior art, or all or a part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present specification. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various other media that can store program codes.
[0146] The principles and implementation manners of the present specification are described by using specific examples in the present specification, and the above example descriptions are only used to help understand the method and core idea of the present specification; meanwhile, for those skilled in the art, according to the idea of the present specification, the specific implementation manners and application ranges will have changes, and the above, the content of the present specification should not be understood as the limitation of the present specification.
Claims
1. A method for resuming a file transfer, the method comprising: The method comprises: determining the type of the file to be transmitted according to the size of the file to be transmitted and a preset threshold, wherein the type of the file to be transmitted comprises a first type of file and a second type of file; transmitting the first type of file by calling a second transmission logic to obtain a second transmission result; transmitting the second type of file after slicing to obtain a slicing transmission result of the second type of file; if the slicing transmission result is a failure, determining a position of a transmission failure of the second type of file and retransmitting from the position; the method further comprises: in the slicing transmission process of the second type of file, writing preset data in a configuration file at a position corresponding to a successfully uploaded slice file; determining the position of the transmission failure of the second type of file according to the preset data recorded in the configuration file; the method further comprises: when the second transmission result is a failure, slicing the first type of file to obtain a plurality of first slice files with the same size; transmitting the plurality of first slice files respectively to obtain a first slicing transmission result; if the first slicing transmission result is a failure, recording a position of a transmission failure of the first type of file and retransmitting from the position; transmitting the first type of file by calling a second transmission logic to obtain a second transmission result comprises: storing an upload state of the first type of file by using a set method of redis; when the upload state is upload completed, judging whether the server exists a same file; if yes, entering the second transmission logic; if no, not performing the second transmission.
2. The file resuming method of claim 1, wherein, the slicing transmission result of the second type of file comprises: slicing the second type of file according to a preset size to obtain a plurality of slice files with the same size; uploading the slice files in sequence to obtain a slicing transmission result.
3. The file resuming method of claim 2, wherein, before determining the position of the transmission failure of the second type of file, the method comprises: allocating serial numbers to the slice files to determine the number of the slice files; creating a configuration file according to the number of the slice files, wherein the length of the configuration file is equal to the total number of the slice files.
4. The file resuming method of claim 1, wherein, retransmitting from the position comprises: determining the untransmitted content of the second type of file according to the position of the transmission failure of the second type of file; retransmitting the untransmitted content from the position.
5. A file resuming apparatus, characterized by comprising: The device for executing the method of any one of claims 1-4 comprises: a file type determination unit configured to determine the type of the file to be transmitted according to the size of the file to be transmitted and a preset threshold, wherein the type of the file to be transmitted comprises a first type of file and a second type of file; a second transmission unit configured to transmit the first type of file by calling a second transmission logic to obtain a second transmission result; a slicing transmission result acquisition unit configured to transmit the second type of file after slicing to obtain a slicing transmission result of the second type of file; a retransmission unit configured to determine a position of a transmission failure of the second type of file and retransmit from the position if the slicing transmission result is a failure.
6. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method of any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method of any one of claims 1-4.
8. A computer program product, characterised in that, The computer program product comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
File slice uploading method and device, electronic equipment and storage medium
CN116708415A
File transmission method and device, equipment and storage medium
CN117459523A