WO2023083367A1 - 文件后台续传方法、装置、存储介质及电子设备 - Google Patents

文件后台续传方法、装置、存储介质及电子设备 Download PDF

Info

Publication number
WO2023083367A1
WO2023083367A1 PCT/CN2022/131895 CN2022131895W WO2023083367A1 WO 2023083367 A1 WO2023083367 A1 WO 2023083367A1 CN 2022131895 W CN2022131895 W CN 2022131895W WO 2023083367 A1 WO2023083367 A1 WO 2023083367A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
offset
unuploaded
offset range
target
Prior art date
Application number
PCT/CN2022/131895
Other languages
English (en)
French (fr)
Inventor
邸卫光
王剑
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2023083367A1 publication Critical patent/WO2023083367A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/27Server based end-user applications
    • H04N21/274Storing end-user multimedia data in response to end-user request, e.g. network recorder
    • H04N21/2743Video hosting of uploaded data from client
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments

Definitions

  • the present disclosure relates to the technical field of file transmission, and in particular, to a method, device, storage medium, and electronic device for background continuous file transfer.
  • the foreground upload interface provided by the third-party private network library to realize the foreground upload of files, but once the application switches to the background, for some special operating systems, the background provided by the specified network library must be used.
  • the upload interface is used to upload in the background, but the above-mentioned private network library cannot be used to upload when running in the background, such as the iOS system.
  • the iOS system has strict restrictions on the background activities of the application. Under normal circumstances, when the application is switched to the background, it will be suspended by the iOS system in a very short time and the execution of related codes will be stopped. However, in order to satisfy some background activities of the application For upload requirements, such as uploading large files, the iOS system still provides relevant interfaces for long-term uploads in the background.
  • the application background wants to continue uploading after being suspended, it must use the above-mentioned interfaces provided by the iOS system.
  • this interface has a limitation, that is, each upload will start from the starting position of the file, and it cannot be resumed based on the upload progress of the foreground, so the application will start uploading from the beginning after switching to the background, resulting in resources and time. waste.
  • the present disclosure provides a method for continuing file transfer in the background, which is applied to the sending end, including:
  • the present disclosure provides a method for continuing file transfer in the background, which is applied to the receiving end, including:
  • the present disclosure provides a device for file background continuous transmission, which is configured at the sending end, including:
  • the first offset request sending module is used to send the first offset request to the receiving end for the target data uploaded by the foreground interruption of the application in response to the application changing from the foreground to the background during the process of uploading the target file by the application.
  • a first offset range acquisition module configured to acquire a first unuploaded offset range returned by the receiving end according to the first offset query request, the first unuploaded offset range being the target data The offset range corresponding to the unuploaded data;
  • a data copy and upload module configured to copy data within the first unuploaded offset range from the target file to generate temporary data, and upload the temporary data to the receiving end through the background upload interface provided by the operating system.
  • the present disclosure provides a device for continuing file transfer in the background, which is configured at the receiving end, including:
  • the first offset request acquisition module is used to obtain the target file uploaded by the application program of the sending end, and obtain the foreground information for the application program sent by the sending end in response to the application program changing from the foreground to the background operation. Interrupting the first offset query request of the uploaded target data;
  • the first offset range query module is configured to determine the offset range corresponding to the unuploaded data in the target data according to the first offset query request, obtain the first unuploaded offset range, and send to the sending end return the first unuploaded offset range;
  • the background data receiving module is used to receive the temporary data uploaded by the sending end through the background upload interface provided by the operating system; wherein, the temporary data is that the sending end copies the first unuploaded partial data from the target file After the data within the range is moved, it is generated based on the copied data.
  • the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the method described in the first aspect or the second aspect are implemented.
  • an electronic device including:
  • One or more processing devices configured to execute the one or more computer programs in the storage device, so as to implement the steps of the method of the first aspect or the second aspect.
  • the sending end when the application at the sending end switches to the background, the sending end first sends a first offset query request to the receiving end to query the offset corresponding to the unuploaded data of the target data interrupted by the application switching to the background.
  • the receiving end returns the first unuploaded offset range to the sending end after querying, and then the sending end copies the data within the first unuploaded offset range from the source file of the target file to generate temporary data, and the background specified by the system
  • the upload interface starts from the starting position of the temporary data and uploads the temporary data to the receiving end. Since the starting position of the temporary data is the interrupted position where the foreground interrupts the upload, the effect of continuing the upload from the interrupted position in the foreground can be achieved.
  • this solution can effectively solve the problem that due to the limitation of the background upload interface of the system, the application program cannot continue uploading based on the progress of the foreground upload after switching to the background, and reduce the waste of resources and time caused by uploading from scratch in the background.
  • FIG. 1 is a flow chart of a method for file background resume transmission provided by an embodiment of the present disclosure
  • Fig. 2 is another flow chart of the method for file background resume upload provided by the embodiment of the present disclosure
  • Fig. 3 is a flow chart of a specific embodiment showing a method for continuing file transfer in the background according to an embodiment of the present disclosure
  • FIG. 4 is a flow chart of a method for continuing file transfer in the background provided by an embodiment of the present disclosure when the application program is switched back to the foreground from the background;
  • Fig. 5 is a schematic diagram of a device for continuing file upload in the background provided by an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of another device for file background continuous upload provided by an embodiment of the present disclosure.
  • Fig. 7 is a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one further embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • Cronet is a network module provided in Google's open source code, which can be compiled into a network library for application programs. Because of its rich functions, simple, stable and efficient code, many Internet companies develop and customize their own private network libraries based on Cronet. Cronet is usually compiled into a dynamic library or a static library, which is called by each component of the application in the form of a library file to complete some network requests of the application in the foreground, including uploading/downloading resource files.
  • the embodiment of the present disclosure provides a method for file uploading in the background, which aims to describe the process of uploading the target file from the sending end to the receiving end through the application program.
  • the function in an optional embodiment, it can also have other business functions, such as video clipping function, for example, the application program can be "Snipping APP", and the user installs “Snipping APP” on the mobile client, and through "Clipping APP” APP” to upload large video files to the server.
  • the sending end can be a smart phone, tablet computer or other electronic device equipped with an iOS system
  • the receiving end can be a network node, server or other electronic device that is communicatively connected to the sending end.
  • Fig. 1 shows a flowchart of a method for file background resume transmission provided by an embodiment of the present disclosure. Please refer to Fig. 1, the method includes the following steps:
  • the sending end sends to the receiving end a first offset query request for the target data uploaded by the interruption of the application program in the foreground.
  • the receiving end determines the offset range corresponding to the unuploaded data in the target data according to the first offset query request, obtains the first unuploaded offset range, and returns the first unuploaded offset range to the sending end.
  • the sending end copies the data within the first unuploaded offset range from the target file to generate temporary data, and uploads the temporary data to the receiving end through the background upload interface provided by the operating system.
  • the sending end when the application program of the sending end switches to the background, the sending end first sends a first offset query request to the receiving end to query the offset corresponding to the unuploaded data of the target data interrupted by the application program switching to the background Range, the receiving end returns the first unuploaded offset range to the sending end after querying, and then the sending end copies the data within the first unuploaded offset range from the source file of the target file to generate temporary data, and then the iOS system specifies
  • the background upload interface starts from the starting position of the temporary data, and uploads the temporary data to the receiving end. It is understandable that the starting position of the temporary data is the interruption position of the foreground interrupt upload, so that the interrupt position from the foreground can be achieved. The effect of the continuation.
  • this solution can effectively solve the problem that due to the limitation of the background upload interface of the system, the application program cannot continue uploading based on the progress of the foreground upload after switching to the background, and reduce the waste of resources and time caused by uploading from scratch in the background.
  • the method when the application program is running in the foreground, the method includes:
  • the sending end In response to the file upload task for the target file, the sending end sends a second offset query request for the target file to the receiving end.
  • the receiving end determines the offset range corresponding to the unuploaded data of the target file according to the second offset query request, obtains the second unuploaded offset range, and returns the second unuploaded offset range to the sending end.
  • the second offset query request carries the second offset range corresponding to the target file and the unique identifier of the target file.
  • the receiving end judges whether there is already uploaded data of the target file in the receiving end according to the unique identifier of the target file; The offset range corresponding to the data, determine the offset range as the second unuploaded offset range, if there is no upload data of the target file, then determine the second offset range corresponding to the target file as the second unuploaded offset range , and then return the second unuploaded offset range to the sender.
  • the target file may be uploaded for the first time or not (for example, the sending end has uploaded part of the data of the target file to the receiving end before), due to the sending The uploaded tasks will not be persisted locally on the end, and the sender does not know whether the data of the target file has been uploaded before and the progress of the upload. Therefore, when the application is running in the foreground, when the file uploaded After the task, in response to the file upload task, the sending end sends a second offset query request for the target file to the receiving end to query and obtain the offset range corresponding to the unuploaded data of the target file, that is, the second unuploaded offset shift range.
  • the sending end determines the target data according to the data within the second unuploaded offset range of the target file, and uploads the target data to the receiving end through the foreground upload interface provided by the private network library.
  • the sender can upload data through the foreground upload interface provided by the third-party private network library.
  • the foreground upload interface does not have the above-mentioned limitations of the background upload interface of the iOS system, so the target data can be Pass in the foreground upload interface, and upload directly to the receiving end through the foreground upload interface without additional operations.
  • Fig. 3 is a flow chart of a specific embodiment provided according to the file background resume method, please refer to Fig. 3, the specific embodiment includes the following steps:
  • the sending end sends a second offset query request for the target file to the receiving end in response to the file upload task for the target file.
  • the sending end sends the second offset for the target file to the receiving end in response to the file upload task for the target file query request.
  • the second offset query request carries the second offset range corresponding to the target file and the unique identifier of the target file, and the unique identifier may be the MD5 code of the target file.
  • the receiving end determines the second unuploaded offset range according to the second offset query request, and returns the second unuploaded offset range to the sending end.
  • the second unuploaded offset range represents the offset range corresponding to the unuploaded data of the target file.
  • the receiving end judges whether there is uploaded data of the target file in the receiving end according to the unique identifier of the target file. If the uploading data of the target file already exists in the receiving end, it indicates that the sending end has uploaded data for the target file before, then The end determines the second unuploaded offset range according to the offset range corresponding to the remaining unuploaded data of the target file. If there is no uploaded data of the target file in the receiving end, it means that the sending end has not uploaded data for the target file before, then the receiving end will The second offset range carried in the second offset query request is determined as the second unuploaded offset range. After determining the second unuploaded offset range, the receiving end returns the second unuploaded offset range to the sending end.
  • the sending end prepares to upload a target file with a size of 1G to the receiving end.
  • the sending end sends a second offset query request for the target file to the receiving end, and the second offset query request carries the MD5 code of the target file and a second offset range of 0-1G.
  • the receiving end searches whether there is corresponding file upload data in the receiving end according to the MD5 of the target file; Upload offset range, for example, the target file has uploaded data within the offset range of 0-500M, then determine that the second unuploaded offset range is 501M-1G. If no corresponding file upload data is found, it is determined that the second unuploaded offset ranges from 0 to 1G.
  • the sending end determines the target data according to the data within the second unuploaded offset range of the target file, and uploads the target data to the receiving end through the foreground upload interface provided by the private network library.
  • the sender supports concurrent uploading of multiple fragments to improve upload performance.
  • the sending end determines multiple data fragments according to the data within the second unuploaded offset range of the target file, and each data fragment is used as a target data, and the sending end receives sequentially or in parallel through the foreground upload interface provided by the private network library
  • the terminal uploads the plurality of data fragments.
  • the receiving end is a network node in a CDN (Content Delivery Network, content distribution network)
  • the CDN node has a length limit for the uploaded data
  • the sending end sends the target file to
  • the data within the second unuploaded offset range is divided into multiple data fragments, and the sending end uploads multiple data fragments concurrently or sequentially through the foreground upload interface provided by a private network library (such as Cronet network library).
  • the sending end can also dynamically determine the data fragmentation. The sending end first determines a data fragmentation from the data within the second unuploaded offset range of the target file according to the maximum allowable length of the uploaded data at the receiving end.
  • the data fragmentation piece as a target data, and then upload the data piece to the receiving end through the foreground upload interface provided by the private network library (such as Cronet network library). Then determine a data fragment from the data within the second unuploaded offset range, and then upload the data fragment to the receiving end through the foreground upload interface provided by the private network library, and repeat the above-mentioned "fragment-upload" steps continuously.
  • the private network library such as Cronet network library
  • the data within the second unuploaded offset range of the target file is the target data.
  • the second unuploaded offset obtained by the sending end is in the range of 0-1G, and the sending end will set the target file's offset within the range of 0-1G according to the maximum allowable length of the uploaded data at the receiving end.
  • the data is divided into three data fragments, and each data fragment is used as a target data.
  • target data 1 carries data with an offset range of 0 to 400M in the target file
  • target data 2 carries data with an offset range of 401M in the target file.
  • the target data 3 carries the data in the target file with an offset range of 801M ⁇ 1G.
  • the sending end uploads the target data 1 to 3 to the receiving end concurrently through the foreground upload interface provided by the private network library.
  • the sending end sends to the receiving end a first offset query request for the target data uploaded by the interruption of the application in the foreground.
  • the receiving end determines the first unuploaded offset range according to the first offset query request, and returns the first unuploaded offset range to the sending end.
  • the first unuploaded offset range is an offset range corresponding to unuploaded data in the target data.
  • the foreground upload task is interrupted, so the upload of the target data originally uploaded in the foreground will be interrupted, and then the sender sends to the receiver the first offset query for the target data uploaded in the foreground interruption of the application Request to query the offset range corresponding to the unuploaded data in the target data from the receiving end.
  • the sending end uploads multiple target data to the receiving end through the foreground upload interface, the sending end will send a first offset query request for each target data to query the offset range corresponding to the unuploaded data of each target data.
  • the first offset query request carries the first offset range corresponding to the target data and the unique identifier of the target file.
  • the receiving end finds the file upload data of the target file according to the unique identifier of the target file, and searches the historical upload data corresponding to the target data from the file upload data of the target file according to the first offset range corresponding to the target data, so as to obtain the Obtain the first unuploaded offset range corresponding to the unuploaded data of the target data, and return the first unuploaded offset range to the sending end.
  • the sending end sends the first offset query request for the target data 2 to the receiving end, and the first offset query request carries the first offset range corresponding to the target data 2 (ie 401M ⁇ 800M) and the MD5 code of the target file.
  • the receiving end finds the file upload data of the target file according to the MD5 code of the target file, and searches for data within this offset range from the file upload data of the target file according to the first offset range 401M to 800M of target data 2, for example , when the application program switches to the background, the target data 2 has already uploaded data in the range of 401M to 550M, so the receiving end determines that the offset range of the unuploaded data is 551M to 800M, thereby determining that the first unuploaded offset range is 551M to 800M , and return the first unuploaded offset range to the sender.
  • the sending end copies data within the first unuploaded offset range from the target file to generate temporary data, and uploads the temporary data to the receiving end through a background upload interface provided by the operating system.
  • the sending end copies the data within the first unuploaded offset range from the target file, generates a temporary data file according to the copied data, then transfers the temporary data file to the background upload interface specified by the iOS system, and uploads the data through the background upload interface to The receiving end uploads the temporary data.
  • the sending end when the application program of the sending end is switched to running in the background, first, the sending end sends a first offset query request to the receiving end to query the unuploaded data of the target data that was interrupted by the program switching to the background
  • the corresponding offset range that is, the first unuploaded offset range.
  • the sender copies the data within the first unuploaded offset range from the source file of the target file to generate temporary data.
  • the background interface specified by the iOS system starts from The initial position of the temporary data starts, and the temporary data is uploaded to the receiving end. Since the initial position of the temporary data is the interrupted position of the foreground interrupted upload, the effect of continuing the transmission from the interrupted position of the foreground is achieved.
  • the method also includes:
  • the sending end sends to the receiving end a third offset query request for target data uploaded by interrupting the application in the background.
  • the receiving end determines the offset range corresponding to the unuploaded data in the target data according to the third offset query request, obtains the third unuploaded offset range, and returns the third unuploaded offset range to the sending end.
  • the third offset query request carries the first offset range corresponding to the target data and the unique identifier of the target file.
  • the receiving end determines the offset range corresponding to the unuploaded data in the target data according to the first offset range and the unique identifier of the target file, and obtains the third unuploaded data. Offset range, and return the third unuploaded offset range to the sender. For the manner in which the receiving end determines the third unuploaded offset range, reference may be made to the related description of the first unuploaded offset range.
  • the sending end uploads the data within the third unuploaded offset range in the target data to the receiving end through the foreground upload interface provided by the private network library.
  • the upload task in the background is interrupted, so that the upload of the target data originally uploaded in the background will be interrupted, and then the sending end sends a third offset query request for the current target data to the receiving end to obtain from The receiving end queries the offset range corresponding to the unuploaded data of the target data, that is, the third unuploaded offset range.
  • the sender can directly continue uploading the unuploaded part of the target data from the interrupted position of the background through the foreground upload interface .
  • the sending end sends the first offset query request for the target data to the receiving end immediately after the application program switches to the background and copies the temporary data according to the first unuploaded offset range returned by the receiving end,
  • the sender will immediately switch to the foreground upload interface of the private network library to continue uploading, then the temporary data copied before will be meaningless, especially in the case of copying a lot of temporary data In some cases, it will seriously affect the performance of the sender. Therefore, when the sending end detects that the application is running from the foreground to the background, it will not send the first offset query request for the target data to the receiving end, but wait for the preset delay time first.
  • the application program switches back to the foreground within the delay time, and the sending end will continue to upload the target data to the receiving end through the foreground upload interface of the private network library. If the application program has not switched back to the foreground when the preset delay time ends, then Only then does the sending end send to the receiving end the first offset query request for the uploaded target data interrupted by the foreground of the application program.
  • the preset delay time can be freely and flexibly configured, for example, it is set to 15 seconds.
  • the sender copies the temporary data from the target file and uploads the temporary data to the receiver
  • the sender repeatedly executes "copy data from the uncopied data within the first unuploaded offset range of the target file according to the preset copy size, generate this temporary data according to the copied data, and provide it through the operating system.
  • the background upload interface uploads this temporary data to the receiving end” process until all the data within the first unuploaded offset range has been uploaded or the application program changes from the background to the foreground.
  • the pre-configured copy size of the sending end is 10M.
  • the sending end first copies 10M data from the first unuploaded offset range of the target file to obtain this temporary data.
  • the sending end uploads the data to the receiving end through the background upload interface provided by the operating system.
  • the end uploads this temporary data.
  • the sending end continues to copy 10M data from the remaining uncopied data in the first unuploaded offset range to obtain this temporary data, and through the operation
  • the background upload interface provided by the system uploads this temporary data to the receiving end, and repeats the above "copy-upload" process until the data within the first unuploaded offset range is copied and uploaded or the application switches back to the foreground.
  • the remaining uncopied data is directly copied to obtain the current temporary data. Because it is uploaded in multiple copies, and only a small range of data is copied for upload each time, it can avoid the waste of resources caused by the application switching back to the foreground in a short time, and at the same time reduce the impact of one-time copying of large data on device performance. .
  • this technical solution uses offset-based copying of file fragments to solve the problem that due to the limitation of the background upload interface of the system, it cannot be compatible with the Cronet network library (or other third-party network libraries) to achieve resuming uploads from breakpoints, reaching the background Based on the purpose of resuming the upload progress at the foreground, it solves the problem that the cross-network library on the iOS system cannot directly resume the file.
  • the private network library includes but is not limited to the Cronet network library listed above, and may also be other third-party network libraries used, that is, the foreground upload of the application It is not necessary to use the Cronet network library, and the same effect can still be achieved by using other third-party network libraries that can run on the iOS system.
  • the embodiment of the present disclosure provides a device for file background continuation, the device is configured at the sending end of file upload, please refer to Figure 5, the device 500 includes: a first offset request sending module 510, a first offset range An acquisition module 520 and a data copy and upload module 530 .
  • the first offset request sending module 510 is configured to send to the receiving end a request for interrupting the uploaded target data for the application program in the foreground in response to the application program changing from the foreground to the background operation during the process of uploading the target file by the application program The first offset query request.
  • the first offset range acquisition module 520 is configured to acquire the first unuploaded offset range returned by the receiving end according to the first offset query request, the first unuploaded offset range is in the target data The offset range corresponding to the unuploaded data.
  • a data copy upload module 530 configured to copy data within the first unuploaded offset range from the target file to generate temporary data, and upload the temporary data to the receiving end through the background upload interface provided by the operating system .
  • the data copy and upload module 530 is configured to repeatedly execute copying data from the uncopied data within the first unuploaded offset range of the target file according to the preset copy size, and generate the copy data according to the data copied this time. Second temporary data, upload the current temporary data to the receiving end through the background upload interface provided by the operating system, until the data within the first unuploaded offset range has been uploaded or the application program is transferred from the background to The foreground runs.
  • the first offset request sending module 510 is configured to wait for a preset delay time when it detects that the application is running from the foreground to the background, and when the preset delay time ends When the application program is not turned to run in the foreground, send to the receiving end a first offset query request for the target data that is interrupted and uploaded by the application program in the foreground.
  • the device also includes:
  • a second offset request sending module configured to send a second offset for the target file to the receiving end in response to a file upload task for the target file when the application program is running in the foreground query request;
  • the second offset range acquisition module is configured to acquire the second unuploaded offset range returned by the receiving end according to the second offset query request, the second unuploaded offset range being the unuploaded offset range of the target file The offset range corresponding to the uploaded data;
  • the first foreground upload module is configured to determine the target data according to the data within the second unuploaded offset range of the target file, and upload the target data to the receiving end through the foreground upload interface provided by the private network library .
  • the first foreground upload module is specifically configured to determine a plurality of data fragments according to the data within the second unuploaded offset range of the target file, and each data fragment serves as a target data , uploading the multiple data fragments to the receiving end sequentially or in parallel through the foreground upload interface provided by the private network library.
  • the device also includes:
  • the third offset request sending module is configured to send the request to the receiving end to the receiving end after the temporary data is uploaded to the receiving end through the background upload interface provided by the operating system in response to the application program changing from the background to the foreground.
  • a third offset range acquiring module configured to acquire a third unuploaded offset range returned by the receiving end according to the third offset query request, the third unuploaded offset range being the target data The offset range corresponding to the unuploaded data;
  • the second foreground upload module is configured to upload data within the third unuploaded offset range of the target data to the receiving end through the foreground upload interface provided by the private network library.
  • an embodiment of the present disclosure provides a device for continuing file upload in the background.
  • the device is configured at the receiving end of file upload. Please refer to FIG. 6 .
  • the device 600 includes: a first offset request acquisition module 610, a first offset range A query module 620 and a background data receiving module 630 .
  • the first offset request obtaining module 610 is configured to obtain the target file uploaded by the application program of the sending end, and obtain the target file for the application program sent by the sending end in response to the application program changing from the foreground to the background operation.
  • the foreground interrupts the first offset query request of the uploaded target data.
  • the first offset range query module 620 is configured to determine the offset range corresponding to the unuploaded data in the target data according to the first offset query request, obtain the first unuploaded offset range, and send the end returns the first unuploaded offset range.
  • the background data receiving module 630 is configured to receive the temporary data uploaded by the sending end through the background upload interface provided by the operating system; wherein, the temporary data is that the sending end copies the first unuploaded data from the target file. After offsetting the data within the range, it is generated based on the copied data.
  • the device also includes:
  • a second offset request acquisition module configured to acquire a second offset query request sent by the sending end in response to the file upload task for the target file when the application program is running in the foreground;
  • the second offset range query module is configured to determine the offset range corresponding to the unuploaded data of the target file according to the second offset query request, obtain a second unuploaded offset range, and return to the sending end the second non-uploaded offset range;
  • the first foreground data receiving module is configured to obtain the target data uploaded by the sending end through the foreground upload interface provided by the private network library; wherein, the target data is the second future data of the sending end according to the target file The data within the upload offset range is determined.
  • the device also includes:
  • the third offset request obtaining module is used to obtain the temporary data uploaded by the sending end through the background upload interface provided by the operating system, and obtain the data sent by the sending end in response to the change of the application from the background to the foreground after receiving the temporary data uploaded by the sending end.
  • a third offset range acquisition module configured to determine an offset range corresponding to unuploaded data in the target data according to the third offset query request, obtain a third unuploaded offset range, and send the data to the sending end return the third unuploaded offset range;
  • the second foreground data receiving module is configured to obtain data within the third unuploaded offset range in the target data uploaded by the sending end through the foreground upload interface provided by the private network library.
  • an embodiment of the present disclosure provides a computer-readable medium on which a computer program is stored.
  • the program is executed by a processing device, the functions performed by the sending end or the receiving end in the method for file background resume transmission provided by the foregoing embodiments are implemented. step.
  • the first offset query request carries the first offset range corresponding to the target data and the unique identifier of the target file; the first offset range query module 620 is specifically configured to: according to the unique identifier of the target file Identify the file upload data that finds the target file, and search for the historical upload data corresponding to the target data from the file upload data of the target file according to the first offset range corresponding to the target data, and obtain the unuploaded data corresponding to the target data Offset range, get the first unuploaded offset range.
  • the second offset query request carries the second offset range corresponding to the target file and the unique identifier of the target file;
  • the second offset range query module is specifically configured to: according to the target file's Determine whether there is uploaded data of the target file by unique identification; if there is uploaded data of the target file, determine the offset range corresponding to the remaining unuploaded data of the target file, and determine the offset range as the second unuploaded offset range ; If there is no uploaded data of the target file, then determine the second offset range corresponding to the target file as the second unuploaded offset range.
  • an electronic device including:
  • One or more processing devices are configured to execute the one or more computer programs in the storage device, so as to implement the steps performed by the sending end or the receiving end in the method for file background continuous upload provided in the foregoing embodiments.
  • the electronic device when the electronic device is the sending end of the file upload, such as a smart phone, tablet computer or other electronic device equipped with an iOS system, one or more processing devices execute one or more computer programs in the storage device , so as to realize the steps performed by the sender in the file background resume method provided by the foregoing embodiments;
  • a processing device executes one or more computer programs in the storage device, so as to realize the steps performed by the receiving end in the method for file background upload provided by the foregoing embodiments
  • FIG. 7 it shows a schematic structural diagram of an electronic device (such as a sending end device or a receiving end device) 700 suitable for implementing an embodiment of the present disclosure.
  • the electronic device shown in FIG. 7 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.
  • an electronic device 700 may include a processing device (such as a central processing unit, a graphics processing unit, etc.)
  • Various appropriate actions and processes are executed by programs in the memory (RAM) 703 .
  • RAM 703 In the RAM 703, various programs and data necessary for the operation of the electronic device 700 are also stored.
  • the processing device 701, ROM 702, and RAM 703 are connected to each other through a bus 704.
  • An input/output (I/O) interface 705 is also connected to the bus 704 .
  • I/O input/output
  • the following devices can be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 707 such as a computer; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709.
  • the communication means 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. While FIG. 7 shows electronic device 700 having various means, it should be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 709, or from storage means 708, or from ROM 702.
  • the processing device 701 When the computer program is executed by the processing device 701, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
  • the sending end and the receiving end can use any currently known or future developed network protocols such as HTTP (HyperText Transfer Protocol) to communicate, and can communicate with any form or medium of digital Data communication (eg, communication network) interconnections.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include local area networks ("LANs”), wide area networks (“WANs”), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: in the process of uploading the target file by the application program, in response to the application program being executed by the foreground Turn to background operation, send to the receiving end the first offset query request for the target data uploaded by the application foreground interruption; obtain the first unuploaded offset returned by the receiving end according to the first offset query request Range, the first unuploaded offset range is the offset range corresponding to the unuploaded data in the target data; copy the data within the first unuploaded offset range from the target file to generate temporary data , uploading the temporary data to the receiving end through the background upload interface provided by the operating system.
  • the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: in the process of receiving the target file uploaded by the application program at the sending end, acquires all The first offset query request sent by the sending end for the target data uploaded by the foreground interruption of the application program in response to the application program changing from the foreground to the background operation; determine the target according to the first offset query request The offset range corresponding to the unuploaded data in the data, obtain the first unuploaded offset range, and return the first unuploaded offset range to the sending end; receive the background upload provided by the sending end through the operating system The temporary data uploaded by the interface; wherein, the temporary data is generated according to the copied data after the sender copies the data within the first unuploaded offset range from the target file.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as "C" or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer may be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, using an Internet service provider to connected via the Internet).
  • LAN local area network
  • WAN wide area network
  • Internet service provider for example, using an Internet service provider to connected via the Internet.
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • the modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the module does not constitute a limitation on the module itself under certain circumstances.
  • the first offset request sending module can also be described as "sending to the receiving end the A module for an offset query request".
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs System on Chips
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • Example 1 provides a method for file background resume upload, which is applied to the sending end, including:
  • Example 2 provides the method of Example 1, the copying the data within the first unuploaded offset range from the target file to generate temporary data, provided by the operating system
  • the background upload interface uploads the temporary data to the receiving end, including:
  • Example 3 provides the method of Example 1, wherein in response to the application changing from the foreground to running in the background, sending to the receiving end the target data for interrupting the upload of the application in the foreground
  • the first offset query request including:
  • the terminal When it is detected that the application is running from the foreground to the background, wait for the preset delay time, and when the preset delay time is over, if the application does not turn to the foreground, send a notification to the receiving party
  • the terminal sends a first offset query request for the target data uploaded by the application foreground interruption.
  • Example 4 provides the method of Example 1, further comprising:
  • Example 5 provides the method of Example 4, further comprising:
  • the third unuploaded offset range being the offset range corresponding to the unuploaded data in the target data
  • Example 6 provides a method for file background resume upload, which is applied to the receiving end, including:
  • Example 7 provides the method of Example 6, further comprising:
  • the target data is determined by the sending end according to the data within the second unuploaded offset range of the target file.
  • Example 8 provides the method of Example 7, further comprising:
  • Example 9 provides a device for file background continuous upload, configured at the sending end, including:
  • the first offset request sending module is used to send the first offset request to the receiving end for the target data uploaded by the foreground interruption of the application in response to the application changing from the foreground to the background during the process of uploading the target file by the application.
  • a first offset range acquisition module configured to acquire a first unuploaded offset range returned by the receiving end according to the first offset query request, the first unuploaded offset range being the target data The offset range corresponding to the unuploaded data;
  • a data copy and upload module configured to copy data within the first unuploaded offset range from the target file to generate temporary data, and upload the temporary data to the receiving end through the background upload interface provided by the operating system.
  • Example 10 provides the device of Example 9, and the data copy upload module is used to repeatedly perform uncopying within the offset range from the first unuploaded target file according to the preset copy size. Copy data in the data, generate this temporary data according to the data copied this time, upload the temporary data to the receiving end through the background upload interface provided by the operating system, until the first unuploaded offset range The data has been uploaded or the application program is turned from the background to the foreground.
  • Example 11 provides the device of Example 9, the first offset request sending module is configured to wait for a preset delay when it detects that the application is running from the foreground to the background time, and when the preset delay time expires, if the application program does not turn to the foreground, send to the receiving end a first offset query request for the target data that is interrupted and uploaded by the application program in the foreground.
  • Example 12 provides the device of Example 9, further comprising:
  • a second offset request sending module configured to send a second offset for the target file to the receiving end in response to a file upload task for the target file when the application program is running in the foreground query request;
  • the second offset range acquisition module is configured to acquire the second unuploaded offset range returned by the receiving end according to the second offset query request, the second unuploaded offset range being the unuploaded offset range of the target file The offset range corresponding to the uploaded data;
  • the first foreground upload module is configured to determine the target data according to the data within the second unuploaded offset range of the target file, and upload the target data to the receiving end through the foreground upload interface provided by the private network library .
  • Example 13 provides the device of Example 12, further comprising:
  • the third offset request sending module is configured to send the request to the receiving end to the receiving end after the temporary data is uploaded to the receiving end through the background upload interface provided by the operating system in response to the application program changing from the background to the foreground.
  • a third offset range acquiring module configured to acquire a third unuploaded offset range returned by the receiving end according to the third offset query request, the third unuploaded offset range being the target data The offset range corresponding to the unuploaded data;
  • the second foreground upload module is configured to upload data within the third unuploaded offset range of the target data to the receiving end through the foreground upload interface provided by the private network library.
  • Example 14 provides a device for file background continuous upload, which is configured at the receiving end, including:
  • the first offset request acquisition module is used to obtain the target file uploaded by the application program of the sending end, and obtain the foreground information for the application program sent by the sending end in response to the application program changing from the foreground to the background operation. Interrupting the first offset query request of the uploaded target data;
  • the first offset range query module is configured to determine the offset range corresponding to the unuploaded data in the target data according to the first offset query request, obtain the first unuploaded offset range, and send to the sending end return the first unuploaded offset range;
  • the background data receiving module is used to receive the temporary data uploaded by the sending end through the background upload interface provided by the operating system; wherein, the temporary data is that the sending end copies the first unuploaded partial data from the target file After the data within the range is moved, it is generated based on the copied data.
  • Example 15 provides the device of Example 14, further comprising:
  • a second offset request acquisition module configured to acquire a second offset query request sent by the sending end in response to the file upload task for the target file when the application program is running in the foreground;
  • the second offset range query module is configured to determine the offset range corresponding to the unuploaded data of the target file according to the second offset query request, obtain a second unuploaded offset range, and return to the sending end the second non-uploaded offset range;
  • the first foreground data receiving module is configured to obtain the target data uploaded by the sending end through the foreground upload interface provided by the private network library; wherein, the target data is the second future data of the sending end according to the target file The data within the upload offset range is determined.
  • Example 16 provides the device of Example 15, further comprising:
  • the third offset request obtaining module is used to obtain the temporary data uploaded by the sending end through the background upload interface provided by the operating system, and obtain the data sent by the sending end in response to the change of the application from the background to the foreground after receiving the temporary data uploaded by the sending end.
  • a third offset range acquisition module configured to determine an offset range corresponding to unuploaded data in the target data according to the third offset query request, obtain a third unuploaded offset range, and send the data to the sending end return the third unuploaded offset range;
  • the second foreground data receiving module is configured to obtain data within the third unuploaded offset range in the target data uploaded by the sending end through the foreground upload interface provided by the private network library.
  • Example 17 provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, any one of Examples 1-5 or Example 6- The method described in any of the examples in 8.
  • Example 18 provides an electronic device, comprising:
  • One or more processing means for executing the one or more computer programs in the storage means to implement the method described in any one of examples 1-5 or any one of examples 6-8 .

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本公开涉及一种文件后台续传方法、装置、存储介质及电子设备,其中,应用于发送端的方法包括:在应用程序上传目标文件的过程中,响应于应用程序由前台转为后台运行,向接收端发送针对应用程序前台中断上传的目标数据的第一偏移查询请求;获取接收端根据第一偏移查询请求返回的第一未上传偏移范围;从目标文件中拷贝第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向接收端上传该临时数据。

Description

文件后台续传方法、装置、存储介质及电子设备
本公开要求于2021年11月15日提交的,申请名称为“文件后台续传方法、装置、存储介质及电子设备”的、中国专利申请号为“202111348516.1”的优先权,该中国专利申请的全部内容通过引用结合在本公开中。
技术领域
本公开涉及文件传输技术领域,具体地,涉及一种文件后台续传方法、装置、存储介质及电子设备。
背景技术
目前相关技术多是通过第三方的私有网络库提供的前台上传接口实现文件的前台上传,但一旦应用程序切后台,对于一些特殊的操作系统而言,必须使用其指定的网络库所提供的后台上传接口来进行后台上传,而无法在后台运行时使用上述私有网络库进行上传,如iOS系统。iOS系统对应用程序的后台活动有严格限制,正常情况下,当应用程序切后台后,会在极短时间内被iOS系统挂起,并停止相关代码的执行,但为了满足应用程序的一些后台上传需求,如大文件上传,iOS系统仍然提供了可供后台长时间上传的相关接口,应用程序后台如果想在被挂起后继续上传,必须使用iOS系统提供的上述接口。但该接口具有一个限制,即每次上传都会从文件的起始位置开始上传,无法直接基于前台上传进度进行断点续传,所以应用程序切后台后又将会从头开始上传,造成资源和时间的浪费。
发明内容
提供该部分内容以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该部分内容并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
第一方面,本公开提供一种文件后台续传方法,应用于发送端,包括:
在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
第二方面,本公开提供一种文件后台续传方法,应用于接收端,包括:
在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围;
接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
第三方面,本公开提供一种文件后台续传装置,配置于发送端,包括:
第一偏移请求发送模块,用于在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
第一偏移范围获取模块,用于获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
数据拷贝上传模块,用于从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
第四方面,本公开提供一种文件后台续传装置,配置于接收端,包括:
第一偏移请求获取模块,用于在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
第一偏移范围查询模块,用于根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围;
后台数据接收模块,用于接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
第五方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现第一方面或第二方面所述方法的步骤。
第六方面,本公开提供一种电子设备,包括:
存储装置,其上存储有一个或多个计算机程序;
一个或多个处理装置,用于执行所述存储装置中的所述一个或多个计算机程序,以实现第一方面或第二方面所述方法的步骤。
在本技术方案中,当发送端的应用程序切后台后,发送端首先向接收端发送第一偏移查询请求,以查询被应用程序切后台所中断上传的目标数据的未上传数据所对应的偏移范围,接收端在查询后向发送端返回第一未上传偏移范围,然后发送端从目标文件的源文件中拷贝第一未上传偏移范围内的数据,生成临时数据,系统指定的后台上传接口从该临时数据的起始位置开始,向接收端进行临时数据的上传,由于该临时数据的起始位置即为前台中断上传的中断位置,从而可以达到从前台中断位置续传的效果。因此,本方案可以有效解决由于系统后台上传接口限制,导致应用程序切后台后无法基于前台上传进度进行断点续传的问题,减少由于后台从头开始上传导致的资源和时间的浪费。
本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:
图1是本公开实施例提供的文件后台续传方法的流程图;
图2是本公开实施例提供的文件后台续传方法的又一流程图;
图3是根据本公开实施例提供的文件后台续传方法示出的一种具体实施例的流程图;
图4是本公开实施例提供的文件后台续传方法在应用程序从后台切回前台的情况下的流程图;
图5是本公开实施例提供的文件后台续传装置的示意图;
图6是本公开实施例提供的另一文件后台续传装置的示意图;
图7是本公开实施例提供的电子设备的示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
如前文所述,相关技术多是通过私有网络库提供的前台上传接口实现文件的上传,如Cronet网络库。Cronet是谷歌开源代码中提供的网络模块,可单独编译成网络库供应用程序使用,由于其功能丰富,代码简洁、稳定、高效,众多互联网公司都基于Cronet开发定制自己的私有网络库。Cronet通常被编译成动态库或者静态库,以库文件的方式供应用程序各组件方调用,来完成应用程序在前台的一些网络请求,包括上传/下载资源文件。但在iOS系统中,无论前台使用何种网络库,一旦应用程序由前台转为后台运行,应用程序将仅能使用iOS指定网络库所提供的后台上传接口进行文件的后台上传,而由于该后台上传接口每次上传都必须从文件或数据的起始位置开始上传,这意味着后台无法直接基于前台的上传进度进行断点续传,并且,后台上传的数据将会覆盖前台上传的数据,这使得前台之前上传的数据失去意义。由此,本公开实施例提供一种文件后台续传方法,该方法旨在描述发送端通过应用程序向接收端上传目标文件的过程,特意说明的是,本实施例中的应用程序具备文件上传功能,在可选的实施例中,还可具有其他业务功能,如视频剪辑功能,例如应用程序可以是“剪映APP”,用户在手机客户端安装“剪映APP”,并通过“剪映APP”向服务器上传视频大文件。发送端可以是搭载有iOS系统的智能手机、平板电脑或其他电子设备,接收 端可以是与发送端通信连接的网络节点、服务器或其他电子设备。
图1示出了本公开实施例提供的文件后台续传方法的流程图,请参照图1,该方法包括如下步骤:
S110,在应用程序上传目标文件的过程中,发送端响应于应用程序由前台转为后台运行,向接收端发送针对应用程序前台中断上传的目标数据的第一偏移查询请求。
S120,接收端根据该第一偏移查询请求确定目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向发送端返回第一未上传偏移范围。
S130,发送端从目标文件中拷贝第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向接收端上传该临时数据。
在上述过程中,当发送端的应用程序切后台后,发送端首先向接收端发送第一偏移查询请求,以查询被应用程序切后台所中断上传的目标数据的未上传数据所对应的偏移范围,接收端在查询后向发送端返回第一未上传偏移范围,然后发送端从目标文件的源文件中拷贝第一未上传偏移范围内的数据,以生成临时数据,然后iOS系统指定的后台上传接口从该临时数据的起始位置开始,向接收端进行临时数据的上传,可以理解的,该临时数据的起始位置即为前台中断上传的中断位置,从而可以达到从前台中断位置续传的效果。因此,本方案可以有效解决由于系统后台上传接口限制,导致应用程序切后台后无法基于前台上传进度进行断点续传的问题,减少由于后台从头开始上传导致的资源和时间的浪费。
在一些实施例中,请参照图2,在应用程序处于前台运行的情况下,该方法包括:
S210,发送端响应于针对目标文件的文件上传任务,向接收端发送针对该目标文件的第二偏移查询请求。
S220,接收端根据第二偏移查询请求确定目标文件的未上传数据对应的偏移范围,获得第二未上传偏移范围,并向发送端返回第二未上传偏移范围。
在一些实施方式中,第二偏移查询请求中携带该目标文件对应的第二偏移范围和目标文件的唯一标识。接收端在收到第二偏移查询请求后,根据其中目标文件的唯一标识判断接收端内是否已有目标文件的上传数据;若已有目标文件的上传数据,则确定目标文件的剩余未上传数据对应的偏移范围,将该偏移范围确定为第二未上传偏移范围,若没有目标文件的上传数据,则将目标文件对应的第二偏移范围确定为第二未上传偏移范围,然后向发送端返回第二未上传偏移范围。
需要说明的是,当发送端的应用程序准备向接收端上传目标文件时,目标文件可能是初次上传也可能是非初次上传(例如发送端之前已向接收端上传过目标文件的部分数据),由于发送端本地不会持久化保存上传过的任务情况,发送端并不知晓之前是否上传过目标文件的数据以及上传进度,因此在应用程序处于前台运行时,当获取到针对某一目标文件的文件上传任务后,发送端响应于该文件上传任务,向接收端发送针对该目标文件的第二偏移查询请求,以查询获得该目标文件的未上传数据对应的偏移范围,即第二未上传偏移范围。
S230,发送端根据目标文件的第二未上传偏移范围内的数据确定目标数据,并通过私有网络库提供的前台上传接口向接收端上传目标数据。
在应用程序处于前台运行的情况下,发送端可以通过第三方私有网络库提供的前台上传接口进行数据上传,该前台上传接口并不具有iOS系统的后台上传接口的上述限制,因此可 以将目标数据传入该前台上传接口,并通过该前台上传接口直接向接收端进行上传,而不需要进行额外操作。
下文对本公开实施例提供的文件后台续传方法进行详细说明。图3是根据该文件后台续传方法提供的一种具体实施例的流程图,请参照图3,该具体实施例包括如下步骤:
S310,在应用程序处于前台运行的情况下,发送端响应于针对目标文件的文件上传任务,向接收端发送针对该目标文件的第二偏移查询请求。
在应用程序处于前台运行的情况下,当获取到针对某一目标文件的文件上传任务后,发送端响应于针对该目标文件的文件上传任务,向接收端发送针对该目标文件的第二偏移查询请求。其中,该第二偏移查询请求中携带目标文件对应的第二偏移范围和目标文件的唯一标识,该唯一标识可以是目标文件的MD5码。
S320,接收端根据第二偏移查询请求确定第二未上传偏移范围,并向发送端返回第二未上传偏移范围。其中,第二未上传偏移范围表征目标文件的未上传数据对应的偏移范围。
具体的,接收端根据目标文件的唯一标识判断接收端内是否已有目标文件的上传数据,如果接收端内已有目标文件的上传数据,表明发送端之前已针对目标文件上传过数据,那么接收端根据目标文件的剩余未上传数据对应的偏移范围确定第二未上传偏移范围,如果接收端内没有目标文件的上传数据,表明发送端之前未针对目标文件上传过数据,那么接收端将第二偏移查询请求中携带的第二偏移范围确定为第二未上传偏移范围。在确定第二未上传偏移范围后,接收端向发送端返回该第二未上传偏移范围。
示例性的,发送端准备向接收端上传大小为1G的目标文件。首先,发送端向接收端发送针对该目标文件的第二偏移查询请求,第二偏移查询请求中携带目标文件的MD5码和第二偏移范围0~1G。然后,接收端根据目标文件的MD5查找接收端内是否有对应的文件上传数据,若查找到对应的文件上传数据,则根据目标文件的未上传数据在目标文件中的偏移范围确定第二未上传偏移范围,例如目标文件已上传0~500M偏移范围内的数据,则确定第二未上传偏移范围为501M~1G。如果未查找到对应的文件上传数据,则确定第二未上传偏移范围为0~1G。
特意说明的是,此处示出的偏移范围仅是为了举例说明,在实际应用中,本方案中提及的所有偏移范围可以精确到字节。
S330,发送端根据目标文件的第二未上传偏移范围内的数据确定目标数据,并通过私有网络库提供的前台上传接口向接收端上传目标数据。
在一些实施方式中,发送端支持多分片并发上传,以提升上传性能。发送端根据目标文件的第二未上传偏移范围内的数据确定出多个数据分片,每个数据分片作为一个目标数据,发送端通过私有网络库提供的前台上传接口依次或并行向接收端上传该多个数据分片。
例如,当接收端为CDN(Content Delivery Network,内容分发网络)中的网络节点时,通常CDN节点对于上传数据设有长度限制,因此发送端根据接收端对上传数据的最大允许长度,将目标文件的第二未上传偏移范围内的数据分为多个数据分片,发送端通过私有网络库(如Cronet网络库)提供的前台上传接口对多个数据分片进行并发上传或依次上传。或者,发送端也可以动态确定数据分片,发送端首先根据接收端对上传数据的最大允许长度从目标文件的第二未上传偏移范围内的数据中确定出一个数据分片,该数据分片作为一个目标 数据,然后通过私有网络库(如Cronet网络库)提供的前台上传接口向接收端上传该数据分片,在该数据分片上传完成后,发送端根据该最大允许长度从目标文件的第二未上传偏移范围内的数据中再确定出一个数据分片,然后通过私有网络库提供的前台上传接口再向接收端上传数据分片,不断重复上述“分片-上传”步骤。
在一些实施例中,当目标文件的大小未超过接收端的最大允许长度时,此时不需要对目标文件进行分片,目标文件的第二未上传偏移范围内的数据即为目标数据。
在一种示例中,假设目标文件为初次上传,发送端获得的第二未上传偏移范围为0~1G,发送端根据接收端对上传数据的最大允许长度将目标文件的0~1G范围内的数据分成三个数据分片,每个数据分片作为一个目标数据,其中,目标数据1承载目标文件中偏移范围在0~400M的数据,目标数据2承载目标文件中偏移范围在401M~800M的数据,目标数据3承载目标文件中偏移范围在801M~1G的数据。发送端通过私有网络库提供的前台上传接口并发向接收端上传目标数据1~3。
S340,发送端响应于应用程序由前台转为后台运行,向接收端发送针对应用程序前台中断上传的目标数据的第一偏移查询请求。
S350,接收端根据第一偏移查询请求确定第一未上传偏移范围,并向发送端返回第一未上传偏移范围。其中,第一未上传偏移范围为目标数据中的未上传数据对应的偏移范围。
当应用程序由前台转为后台运行后,前台上传任务中断,从而原本在前台上传的目标数据将中断上传,然后发送端向接收端发送针对应用程序前台中断上传的目标数据的第一偏移查询请求,以从接收端查询该目标数据中的未上传数据对应的偏移范围。如果发送端通过前台上传接口并发向接收端上传多个目标数据,发送端将针对每个目标数据分别发送第一偏移查询请求,以查询每个目标数据的未上传数据对应的偏移范围。其中,第一偏移查询请求中携带目标数据对应的第一偏移范围和目标文件的唯一标识。然后接收端根据目标文件的唯一标识查找到目标文件的文件上传数据,并根据目标数据对应的第一偏移范围从目标文件的文件上传数据中查找该目标数据对应的历史上传数据,从而获得该目标数据的未上传数据所对应的偏移范围,获得第一未上传偏移范围,并向发送端返回第一未上传偏移范围。
以上述目标数据2为例,发送端向接收端发送针对目标数据2的第一偏移查询请求,第一偏移查询请求中携带目标数据2对应的第一偏移范围(即401M~800M)和目标文件的MD5码。接收端根据目标文件的MD5码查找到目标文件的文件上传数据,并根据目标数据2的第一偏移范围401M~800M从目标文件的文件上传数据中查找这一偏移范围内的数据,例如,在应用程序切后台时目标数据2已经上传了401M~550M范围内的数据,于是接收端确定未上传数据的偏移范围为551M~800M,从而确定第一未上传偏移范围为551M~800M,并向发送端返回该第一未上传偏移范围。
S360,发送端从目标文件中拷贝第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向接收端上传该临时数据。
发送端从目标文件中拷贝该第一未上传偏移范围内的数据,根据拷贝的数据生成临时数据文件,然后将该临时数据文件传入iOS系统指定的后台上传接口,通过该后台上传接口向接收端上传该临时数据。
在上述步骤S310~S360中,当发送端的应用程序转为后台运行后,首先,发送端向接收 端发送第一偏移查询请求,以查询被程序切后台所中断上传的目标数据的未上传数据对应的偏移范围,即第一未上传偏移范围,然后,发送端从目标文件的源文件中拷贝第一未上传偏移范围内的数据,以生成临时数据,iOS系统指定的后台接口从该临时数据的起始位置开始,向接收端上传该临时数据,由于该临时数据的起始位置即为前台中断上传的中断位置,从而达到从前台中断位置续传的效果。
在应用程序从后台切回前台的情况下,请参照图4,该方法还包括:
S410,发送端响应于应用程序由后台转为前台运行,向接收端发送针对应用程序后台中断上传的目标数据的第三偏移查询请求。
S420,接收端根据第三偏移查询请求确定目标数据中的未上传数据对应的偏移范围,获得第三未上传偏移范围,并向发送端返回第三未上传偏移范围。
其中,第三偏移查询请求中携带目标数据对应的第一偏移范围和目标文件的唯一标识。接收端在收到发送端发送的第三偏移查询请求后,根据其中的第一偏移范围和目标文件的唯一标识确定目标数据中的未上传数据对应的偏移范围,获得第三未上传偏移范围,并向发送端返回第三未上传偏移范围。接收端确定第三未上传偏移范围的方式可以参考第一未上传偏移范围的有关描述。
S430,发送端通过私有网络库提供的前台上传接口向接收端上传目标数据中的第三未上传偏移范围内的数据。
当应用程序由后台切回前台的情况下,后台上传任务中断,从而原本在后台上传的目标数据将中断上传,然后发送端向接收端发送针对当前目标数据的第三偏移查询请求,以从接收端查询该目标数据的未上传数据对应的偏移范围,即第三未上传偏移范围。在获得第三未上传偏移范围后,由于应用程序正在前台运行,且前台上传接口支持基于文件偏移上传,因此发送端可以通过前台上传接口直接从后台中断位置继续上传目标数据的未上传部分。
进一步的,在上述步骤中,如果发送端在应用程序在切后台后立刻向接收端发送针对目标数据的第一偏移查询请求并根据接收端返回的第一未上传偏移范围拷贝临时数据,一旦应用程序在较短时间内又切回前台,发送端将立刻转为通过私有网络库的前台上传接口继续上传,那么之前所拷贝的临时数据将没有意义,尤其在拷贝的临时数据较多的情况下,还会严重影响发送端的性能。因此,发送端在检测到应用程序由前台转为后台运行时,先暂不向接收端发送针对目标数据的第一偏移查询请求,而是先等待预设的延时时间,如果在预设的延时时间内应用程序切回前台,则发送端将通过私有网络库的前台上传接口继续向接收端上传目标数据,如果在预设的延时时间结束时应用程序仍未切回前台,则发送端才向接收端发送针对应用程序前台中断上传的目标数据的第一偏移查询请求。
其中,预设的延时时间可以自由灵活配置,例如设置为15秒。
对于应用程序在切后台后可能在短时间内切回前台的场景,为改善拷贝操作给发送端所带来的性能影响,在发送端从目标文件中拷贝获得临时数据并向接收端上传临时数据的过程中,发送端重复执行“根据预设拷贝大小从目标文件的第一未上传偏移范围内的未拷贝数据中拷贝数据,根据本次拷贝的数据生成本次临时数据,通过操作系统提供的后台上传接口向接收端上传该本次临时数据”的过程,直至第一未上传偏移范围内的数据均已上传或者应用程序由后台转为前台运行。
例如,发送端预先配置的拷贝大小为10M,发送端先从目标文件的第一未上传偏移范围内拷贝出10M数据,获得本次临时数据,发送端通过操作系统提供的后台上传接口向接收端上传本次临时数据,在10M的本次临时数据上传完成后,发送端再从第一未上传偏移范围的剩余未拷贝数据中继续拷贝出10M数据,获得本次临时数据,并通过操作系统提供的后台上传接口向接收端上传本次临时数据,不断重复上述“拷贝-上传”过程,直至第一未上传偏移范围内的数据均已拷贝并上传完成或者应用程序切回前台。需要注意的是,当最终剩余的未拷贝数据的大小小于10M时,直接拷贝剩余的未拷贝数据以获得本次临时数据。由于是分多次拷贝上传,且每次只拷贝小范围的数据进行上传,可以避免应用程序短时间内切回前台而产生的资源浪费,同时减少一次性拷贝较大数据对设备性能造成的影响。
综上所述,本技术方案以基于偏移的文件碎片拷贝方式,解决了由于系统后台上传接口限制,无法和Cronet网络库(或其他三方网络库)兼容实现断点续传的问题,达到后台基于前台上传进度断点续传的目的,解决了iOS系统上跨网络库无法直接断点续传文件的难题。需要说明的是,在本公开实施例提供的上述文件后台续传方法中,私有网络库包括但不限于上述列举的Cronet网络库,也可能是使用的其他第三方网络库,即应用程序前台上传时不一定使用Cronet网络库,使用其他可运行在iOS系统上的第三方网络库仍然可以达到相同效果。
基于同一构思,本公开实施例提供一种文件后台续传装置,该装置配置于文件上传的发送端,请参照图5,装置500包括:第一偏移请求发送模块510、第一偏移范围获取模块520和数据拷贝上传模块530。
第一偏移请求发送模块510,用于在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求。
第一偏移范围获取模块520,用于获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围。
数据拷贝上传模块530,用于从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
在一些实施例中,数据拷贝上传模块530用于重复执行根据预设拷贝大小从所述目标文件的第一未上传偏移范围内的未拷贝数据中拷贝数据,根据本次拷贝的数据生成本次临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述本次临时数据,直至所述第一未上传偏移范围内的数据均已上传或者所述应用程序由后台转为前台运行。
在一些实施例中,第一偏移请求发送模块510用于在检测到所述应用程序由前台转为后台运行时,等待预设的延时时间,并在所述预设的延时时间结束时所述应用程序未转为前台运行的情况下,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求。
在一些实施例中,该装置还包括:
第二偏移请求发送模块,用于在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务,向所述接收端发送针对所述目标文件的第二偏移查询请求;
第二偏移范围获取模块,用于获取所述接收端根据所述第二偏移查询请求返回的第二未上传偏移范围,所述第二未上传偏移范围为所述目标文件的未上传数据对应的偏移范围;
第一前台上传模块,用于根据所述目标文件的所述第二未上传偏移范围内的数据确定目标数据,并通过私有网络库提供的前台上传接口向所述接收端上传所述目标数据。
在一些实施例中,第一前台上传模块,具体用于根据所述目标文件的所述第二未上传偏移范围内的数据确定出多个数据分片,每个数据分片作为一个目标数据,通过私有网络库提供的前台上传接口依次或并行向接收端上传该多个数据分片。
在一些实施例中,该装置还包括:
第三偏移请求发送模块,用于在通过操作系统提供的后台上传接口向所述接收端上传所述临时数据之后,响应于所述应用程序由后台转为前台运行,向接收端发送针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
第三偏移范围获取模块,用于获取所述接收端根据所述第三偏移查询请求返回的第三未上传偏移范围,所述第三未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
第二前台上传模块,用于通过所述私有网络库提供的所述前台上传接口向所述接收端上传所述目标数据中的所述第三未上传偏移范围内的数据。
基于同一构思,本公开实施例提供一种文件后台续传装置,该装置配置于文件上传的接收端,请参照图6,装置600包括:第一偏移请求获取模块610、第一偏移范围查询模块620和后台数据接收模块630。
第一偏移请求获取模块610,用于在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求。
第一偏移范围查询模块620,用于根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围。
后台数据接收模块630,用于接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
在一些实施例中,该装置还包括:
第二偏移请求获取模块,用于获取所述发送端在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务所发送的第二偏移查询请求;
第二偏移范围查询模块,用于根据所述第二偏移查询请求确定所述目标文件的未上传数据对应的偏移范围,获得第二未上传偏移范围,并向所述发送端返回所述第二未上传偏移范围;
第一前台数据接收模块,用于获取所述发送端通过私有网络库提供的前台上传接口上传的目标数据;其中,所述目标数据是所述发送端根据所述目标文件的所述第二未上传偏移范围内的数据确定。
在一些实施例中,该装置还包括:
第三偏移请求获取模块,用于在接收所述发送端通过操作系统提供的后台上传接口上传 的临时数据之后,获取所述发送端响应于所述应用程序由后台转为前台运行所发送的针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
第三偏移范围获取模块,用于根据所述第三偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第三未上传偏移范围,并向所述发送端返回所述第三未上传偏移范围;
第二前台数据接收模块,用于获取所述发送端通过所述私有网络库提供的所述前台上传接口上传的所述目标数据中的所述第三未上传偏移范围内的数据。
基于同一构思,本公开实施例提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现前述实施例提供的文件后台续传方法中发送端或接收端所执行的步骤。
在一些实施例中,所述第一偏移查询请求中携带目标数据对应的第一偏移范围和目标文件的唯一标识;第一偏移范围查询模块620,具体用于:根据目标文件的唯一标识查找到目标文件的文件上传数据,并根据目标数据对应的第一偏移范围从目标文件的文件上传数据中查找该目标数据对应的历史上传数据,获得该目标数据的未上传数据所对应的偏移范围,获得第一未上传偏移范围。
在一些实施例中,所述第二偏移查询请求中携带该目标文件对应的第二偏移范围和目标文件的唯一标识;第二偏移范围查询模块,具体用于:根据其中目标文件的唯一标识判断是否已有目标文件的上传数据;若已有目标文件的上传数据,则确定目标文件的剩余未上传数据对应的偏移范围,将该偏移范围确定为第二未上传偏移范围;若没有目标文件的上传数据,则将目标文件对应的第二偏移范围确定为第二未上传偏移范围。
基于同一构思,本公开实施例提供一种电子设备,包括:
存储装置,其上存储有一个或多个计算机程序;
一个或多个处理装置,用于执行所述存储装置中的所述一个或多个计算机程序,以实现前述实施例提供的文件后台续传方法中发送端或接收端所执行的步骤。
其中,当电子设备为文件上传的发送端时,如电子设备为搭载有iOS系统的智能手机、平板电脑或其他电子设备,则一个或多个处理装置执行存储装置中的一个或多个计算机程序,以实现前述实施例提供的文件后台续传方法中发送端所执行的步骤;当电子设备为文件上传的接收端时,如电子设备为CDN节点、服务器或其他电子设备时,则一个或多个处理装置执行存储装置中的一个或多个计算机程序,以实现前述实施例提供的文件后台续传方法中接收端所执行的步骤
下面参考图7,其示出了适于用来实现本公开实施例的电子设备(例如发送端设备或接收端设备)700的结构示意图。图7示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。如图7所示,电子设备700可以包括处理装置(例如中央处理器、图形处理器等)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储装置708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM 703中,还存储有电子设备700操作所需的各种程序和数据。处理装置701、ROM 702以及RAM 703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。
通常,以下装置可以连接至I/O接口705:包括例如触摸屏、触摸板、键盘、鼠标、摄 像头、麦克风、加速度计、陀螺仪等的输入装置706;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置707;包括例如磁带、硬盘等的存储装置708;以及通信装置709。通信装置709可以允许电子设备700与其他设备进行无线或有线通信以交换数据。虽然图7示出了具有各种装置的电子设备700,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置709从网络上被下载和安装,或者从存储装置708被安装,或者从ROM 702被安装。在该计算机程序被处理装置701执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,发送端、接收端可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;从所述目标文件中拷贝所述第 一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
或者,上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围;接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定,例如,第一偏移请求发送模块还可以被描述为“向接收端发送针对应用程序前台中断上传的目标数据的第一偏移查询请求的模块”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁 性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,示例1提供了一种文件后台续传方法,应用于发送端,包括:
在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
根据本公开的一个或多个实施例,示例2提供了示例1的方法,所述从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据,包括:
重复执行根据预设拷贝大小从所述目标文件的第一未上传偏移范围内的未拷贝数据中拷贝数据,根据本次拷贝的数据生成本次临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述本次临时数据,直至所述第一未上传偏移范围内的数据均已上传或者所述应用程序由后台转为前台运行。
根据本公开的一个或多个实施例,示例3提供了示例1的方法,所述响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求,包括:
在检测到所述应用程序由前台转为后台运行时,等待预设的延时时间,并在所述预设的延时时间结束时所述应用程序未转为前台运行的情况下,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求。
根据本公开的一个或多个实施例,示例4提供了示例1的方法,还包括:
在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务,向所述接收端发送针对所述目标文件的第二偏移查询请求;
获取所述接收端根据所述第二偏移查询请求返回的第二未上传偏移范围,所述第二未上传偏移范围为所述目标文件的未上传数据对应的偏移范围;
根据所述目标文件的所述第二未上传偏移范围内的数据确定目标数据,并通过私有网络库提供的前台上传接口向所述接收端上传所述目标数据。
根据本公开的一个或多个实施例,示例5提供了示例4的方法,还包括:
在通过操作系统提供的后台上传接口向所述接收端上传所述临时数据之后,响应于所述应用程序由后台转为前台运行,向接收端发送针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
获取所述接收端根据所述第三偏移查询请求返回的第三未上传偏移范围,所述第三未上 传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
通过所述私有网络库提供的所述前台上传接口向所述接收端上传所述目标数据中的所述第三未上传偏移范围内的数据。
根据本公开的一个或多个实施例,示例6提供了一种文件后台续传方法,应用于接收端,包括:
在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围;
接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
根据本公开的一个或多个实施例,示例7提供了示例6的方法,还包括:
获取所述发送端在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务所发送的第二偏移查询请求;
根据所述第二偏移查询请求确定所述目标文件的未上传数据对应的偏移范围,获得第二未上传偏移范围,并向所述发送端返回所述第二未上传偏移范围;
获取所述发送端通过私有网络库提供的前台上传接口上传的目标数据;其中,所述目标数据是所述发送端根据所述目标文件的所述第二未上传偏移范围内的数据确定。
根据本公开的一个或多个实施例,示例8提供了示例7的方法,还包括:
在接收所述发送端通过操作系统提供的后台上传接口上传的临时数据之后,获取所述发送端响应于所述应用程序由后台转为前台运行所发送的针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
根据所述第三偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第三未上传偏移范围,并向所述发送端返回所述第三未上传偏移范围;
获取所述发送端通过所述私有网络库提供的所述前台上传接口上传的所述目标数据中的所述第三未上传偏移范围内的数据。
根据本公开的一个或多个实施例,示例9提供了一种文件后台续传装置,配置于发送端,包括:
第一偏移请求发送模块,用于在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
第一偏移范围获取模块,用于获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
数据拷贝上传模块,用于从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
根据本公开的一个或多个实施例,示例10提供了示例9的装置,数据拷贝上传模块用 于重复执行根据预设拷贝大小从所述目标文件的第一未上传偏移范围内的未拷贝数据中拷贝数据,根据本次拷贝的数据生成本次临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述本次临时数据,直至所述第一未上传偏移范围内的数据均已上传或者所述应用程序由后台转为前台运行。
根据本公开的一个或多个实施例,示例11提供了示例9的装置,第一偏移请求发送模块用于在检测到所述应用程序由前台转为后台运行时,等待预设的延时时间,并在所述预设的延时时间结束时所述应用程序未转为前台运行的情况下,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求。
根据本公开的一个或多个实施例,示例12提供了示例9的装置,还包括:
第二偏移请求发送模块,用于在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务,向所述接收端发送针对所述目标文件的第二偏移查询请求;
第二偏移范围获取模块,用于获取所述接收端根据所述第二偏移查询请求返回的第二未上传偏移范围,所述第二未上传偏移范围为所述目标文件的未上传数据对应的偏移范围;
第一前台上传模块,用于根据所述目标文件的所述第二未上传偏移范围内的数据确定目标数据,并通过私有网络库提供的前台上传接口向所述接收端上传所述目标数据。
根据本公开的一个或多个实施例,示例13提供了示例12的装置,还包括:
第三偏移请求发送模块,用于在通过操作系统提供的后台上传接口向所述接收端上传所述临时数据之后,响应于所述应用程序由后台转为前台运行,向接收端发送针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
第三偏移范围获取模块,用于获取所述接收端根据所述第三偏移查询请求返回的第三未上传偏移范围,所述第三未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
第二前台上传模块,用于通过所述私有网络库提供的所述前台上传接口向所述接收端上传所述目标数据中的所述第三未上传偏移范围内的数据。
根据本公开的一个或多个实施例,示例14提供了一种文件后台续传装置,配置于接收端,包括:
第一偏移请求获取模块,用于在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
第一偏移范围查询模块,用于根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围;
后台数据接收模块,用于接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
根据本公开的一个或多个实施例,示例15提供了示例14的装置,还包括:
第二偏移请求获取模块,用于获取所述发送端在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务所发送的第二偏移查询请求;
第二偏移范围查询模块,用于根据所述第二偏移查询请求确定所述目标文件的未上传数 据对应的偏移范围,获得第二未上传偏移范围,并向所述发送端返回所述第二未上传偏移范围;
第一前台数据接收模块,用于获取所述发送端通过私有网络库提供的前台上传接口上传的目标数据;其中,所述目标数据是所述发送端根据所述目标文件的所述第二未上传偏移范围内的数据确定。
根据本公开的一个或多个实施例,示例16提供了示例15的装置,还包括:
第三偏移请求获取模块,用于在接收所述发送端通过操作系统提供的后台上传接口上传的临时数据之后,获取所述发送端响应于所述应用程序由后台转为前台运行所发送的针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
第三偏移范围获取模块,用于根据所述第三偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第三未上传偏移范围,并向所述发送端返回所述第三未上传偏移范围;
第二前台数据接收模块,用于获取所述发送端通过所述私有网络库提供的所述前台上传接口上传的所述目标数据中的所述第三未上传偏移范围内的数据。
根据本公开的一个或多个实施例,示例17提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现示例1-5中的任一示例或示例6-8中的任一示例所述的方法。
根据本公开的一个或多个实施例,示例18提供了一种电子设备,包括:
存储装置,其上存储有一个或多个计算机程序;
一个或多个处理装置,用于执行所述存储装置中的所述一个或多个计算机程序,以实现示例1-5中的任一示例或示例6-8中的任一示例所述的方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。

Claims (15)

  1. 一种文件后台续传方法,其应用于发送端,包括:
    在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
    获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
    从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
  2. 根据权利要求1所述的方法,其中,所述从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据,包括:
    重复执行根据预设拷贝大小从所述目标文件的第一未上传偏移范围内的未拷贝数据中拷贝数据,根据本次拷贝的数据生成本次临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述本次临时数据,直至所述第一未上传偏移范围内的数据均已上传或者所述应用程序由后台转为前台运行。
  3. 根据权利要求1所述的方法,其中,所述响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求,包括:
    在检测到所述应用程序由前台转为后台运行时,等待预设的延时时间,并在所述预设的延时时间结束时所述应用程序未转为前台运行的情况下,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求。
  4. 根据权利要求1所述的方法,其中,所述方法还包括:
    在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务,向所述接收端发送针对所述目标文件的第二偏移查询请求;
    获取所述接收端根据所述第二偏移查询请求返回的第二未上传偏移范围,所述第二未上传偏移范围为所述目标文件的未上传数据对应的偏移范围;
    根据所述目标文件的所述第二未上传偏移范围内的数据确定目标数据,并通过私有网络库提供的前台上传接口向所述接收端上传所述目标数据。
  5. 根据权利要求4所述的方法,其中,所述方法还包括:
    在通过操作系统提供的后台上传接口向所述接收端上传所述临时数据之后,响应于所述应用程序由后台转为前台运行,向接收端发送针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
    获取所述接收端根据所述第三偏移查询请求返回的第三未上传偏移范围,所述第三未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
    通过所述私有网络库提供的所述前台上传接口向所述接收端上传所述目标数据中的所述第三未上传偏移范围内的数据。
  6. 根据权利要求4所述的方法,其中,所述根据所述目标文件的所述第二未上传偏移范围内的数据确定目标数据,并通过私有网络库提供的前台上传接口向所述接收端上传所述目标数据,包括:
    根据所述目标文件的所述第二未上传偏移范围内的数据确定出多个数据分片,每个数据分片作为一个目标数据,通过私有网络库提供的前台上传接口依次或并行向接收端上传该多个数据分片。
  7. 一种文件后台续传方法,其中,应用于接收端,包括:
    在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
    根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围;
    接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
  8. 根据权利要求7所述的方法,其中,所述方法还包括:
    获取所述发送端在所述应用程序处于前台运行的情况下,响应于针对所述目标文件的文件上传任务所发送的第二偏移查询请求;
    根据所述第二偏移查询请求确定所述目标文件的未上传数据对应的偏移范围,获得第二未上传偏移范围,并向所述发送端返回所述第二未上传偏移范围;
    获取所述发送端通过私有网络库提供的前台上传接口上传的目标数据;其中,所述目标数据是所述发送端根据所述目标文件的所述第二未上传偏移范围内的数据确定。
  9. 根据权利要求8所述的方法,其中,所述方法还包括:
    在接收所述发送端通过操作系统提供的后台上传接口上传的临时数据之后,获取所述发送端响应于所述应用程序由后台转为前台运行所发送的针对所述应用程序后台中断上传的所述目标数据的第三偏移查询请求;
    根据所述第三偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第三未上传偏移范围,并向所述发送端返回所述第三未上传偏移范围;
    获取所述发送端通过所述私有网络库提供的所述前台上传接口上传的所述目标数据中的所述第三未上传偏移范围内的数据。
  10. 根据权利要求7所述的方法,其中,所述第一偏移查询请求中携带目标数据对应的第一偏移范围和目标文件的唯一标识;
    所述根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,包括:
    根据目标文件的唯一标识查找到目标文件的文件上传数据,并根据目标数据对应的第一偏移范围从目标文件的文件上传数据中查找该目标数据对应的历史上传数据,获得该目标数据的未上传数据所对应的偏移范围,获得第一未上传偏移范围。
  11. 根据权利要求8所述的方法,其中,所述第二偏移查询请求中携带该目标文件对应的第二偏移范围和目标文件的唯一标识;
    所述根据所述第二偏移查询请求确定所述目标文件的未上传数据对应的偏移范围,获得第二未上传偏移范围,包括:
    根据其中目标文件的唯一标识判断是否已有目标文件的上传数据;若已有目标文件的上传数据,则确定目标文件的剩余未上传数据对应的偏移范围,将该偏移范围确定为第二未上传偏移范围;若没有目标文件的上传数据,则将目标文件对应的第二偏移范围确定为第二未上传偏移范围。
  12. 一种文件后台续传装置,其配置于发送端,包括:
    第一偏移请求发送模块,用于在应用程序上传目标文件的过程中,响应于所述应用程序由前台转为后台运行,向接收端发送针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
    第一偏移范围获取模块,用于获取所述接收端根据所述第一偏移查询请求返回的第一未上传偏移范围,所述第一未上传偏移范围为所述目标数据中的未上传数据对应的偏移范围;
    数据拷贝上传模块,用于从所述目标文件中拷贝所述第一未上传偏移范围内的数据以生成临时数据,通过操作系统提供的后台上传接口向所述接收端上传所述临时数据。
  13. 一种文件后台续传装置,其配置于接收端,包括:
    第一偏移请求获取模块,用于在接收发送端的应用程序上传的目标文件的过程中,获取所述发送端响应于所述应用程序由前台转为后台运行所发送的针对所述应用程序前台中断上传的目标数据的第一偏移查询请求;
    第一偏移范围查询模块,用于根据所述第一偏移查询请求确定所述目标数据中的未上传数据对应的偏移范围,获得第一未上传偏移范围,并向所述发送端返回所述第一未上传偏移范围;
    后台数据接收模块,用于接收所述发送端通过操作系统提供的后台上传接口上传的临时数据;其中,所述临时数据是所述发送端从所述目标文件中拷贝所述第一未上传偏移范围内的数据后,根据拷贝数据生成。
  14. 一种计算机可读介质,其上存储有计算机程序,其中,该程序被处理装置执行时实现权利要求1-6任一项或7-11任一项所述方法的步骤。
  15. 一种电子设备,其包括:
    存储装置,其上存储有一个或多个计算机程序;
    一个或多个处理装置,用于执行所述存储装置中的所述一个或多个计算机程序,以实现权利要求1-6任一项或7-11任一项所述方法的步骤。
PCT/CN2022/131895 2021-11-15 2022-11-15 文件后台续传方法、装置、存储介质及电子设备 WO2023083367A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111348516.1 2021-11-15
CN202111348516.1A CN114051024A (zh) 2021-11-15 2021-11-15 文件后台续传方法、装置、存储介质及电子设备

Publications (1)

Publication Number Publication Date
WO2023083367A1 true WO2023083367A1 (zh) 2023-05-19

Family

ID=80209094

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/131895 WO2023083367A1 (zh) 2021-11-15 2022-11-15 文件后台续传方法、装置、存储介质及电子设备

Country Status (2)

Country Link
CN (1) CN114051024A (zh)
WO (1) WO2023083367A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114051024A (zh) * 2021-11-15 2022-02-15 北京字节跳动网络技术有限公司 文件后台续传方法、装置、存储介质及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103401914A (zh) * 2013-07-26 2013-11-20 浪潮电子信息产业股份有限公司 一种文件上传断点续传的方法
CN106921682A (zh) * 2015-12-24 2017-07-04 百度在线网络技术(北京)有限公司 文件上传方法和装置
US20180191806A1 (en) * 2016-12-30 2018-07-05 Facebook, Inc. Systems and methods for resumable uploading of data in a social networking system
CN110944034A (zh) * 2019-10-21 2020-03-31 量子云未来(北京)信息科技有限公司 一种网页端断点续传方法、装置、电子设备及存储介质
CN114051024A (zh) * 2021-11-15 2022-02-15 北京字节跳动网络技术有限公司 文件后台续传方法、装置、存储介质及电子设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8935671B2 (en) * 2011-10-11 2015-01-13 Apple Inc. Debugging a graphics application executing on a target device
CN108566417A (zh) * 2018-03-22 2018-09-21 四川长虹电器股份有限公司 一种基于安卓系统的多线程断点续传下载系统及方法
CN113395353B (zh) * 2021-06-30 2022-08-02 北京字节跳动网络技术有限公司 文件下载方法、装置、存储介质及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103401914A (zh) * 2013-07-26 2013-11-20 浪潮电子信息产业股份有限公司 一种文件上传断点续传的方法
CN106921682A (zh) * 2015-12-24 2017-07-04 百度在线网络技术(北京)有限公司 文件上传方法和装置
US20180191806A1 (en) * 2016-12-30 2018-07-05 Facebook, Inc. Systems and methods for resumable uploading of data in a social networking system
CN110944034A (zh) * 2019-10-21 2020-03-31 量子云未来(北京)信息科技有限公司 一种网页端断点续传方法、装置、电子设备及存储介质
CN114051024A (zh) * 2021-11-15 2022-02-15 北京字节跳动网络技术有限公司 文件后台续传方法、装置、存储介质及电子设备

Also Published As

Publication number Publication date
CN114051024A (zh) 2022-02-15

Similar Documents

Publication Publication Date Title
CN110609872B (zh) 用于同步节点数据的方法和装置
US9712631B2 (en) Push notification via file sharing service synchronization
CN113395353B (zh) 文件下载方法、装置、存储介质及电子设备
WO2023279891A1 (zh) 投屏设备的发现方法、装置、电子设备和存储介质
WO2020248745A1 (zh) 用户界面中字符的显示方法、装置、电子设备及存储介质
WO2023202276A1 (zh) 域名解析请求的处理方法、装置、设备、介质和程序产品
WO2020026018A1 (zh) 文件的下载方法、装置、设备/终端/服务器及存储介质
WO2023083367A1 (zh) 文件后台续传方法、装置、存储介质及电子设备
WO2023000888A1 (zh) 云应用的实现方法、装置、电子设备和存储介质
CN114637703B (zh) 数据访问装置、方法、可读介质和电子设备
CN112015816A (zh) 数据同步方法、装置、介质及电子设备
CN111163336A (zh) 视频资源推送方法、装置、电子设备及计算机可读介质
WO2024055819A1 (zh) 页面展示方法、装置、存储介质和电子设备
CN111309366B (zh) 一种管理注册核心的方法、装置、介质和电子设备
WO2023207788A1 (zh) 信息处理方法、装置、电子设备和存储介质
WO2020135485A1 (zh) 一种结果获取方法、装置及设备
US20240069991A1 (en) Abnormal request processing method and apparatus, electronic device and storage medium
CN112418389A (zh) 数据处理方法、装置、电子设备及计算机可读存储介质
CN116244234A (zh) 数据传输方法、装置、电子设备及存储介质
CN112910855B (zh) 一种样例报文处理方法及装置
CN113742376A (zh) 一种同步数据的方法、第一服务器以及同步数据的系统
CN112131181A (zh) 存储路径的展示方法、装置以及电子设备
CN111367590A (zh) 中断事件处理方法及其装置
CN111176679A (zh) 一种应用程序更新方法和装置
CN111309367A (zh) 一种管理服务发现的方法、装置、介质和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22892159

Country of ref document: EP

Kind code of ref document: A1