A file transfer apparatus and method
By combining the Electron framework with native processing units, the compatibility and performance issues of web applications are resolved, cross-platform file transfer compatibility and performance are improved, and development costs are reduced.
Patent Information
- Application Number
- CN202111397688.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2041-11-23
AI Technical Summary
Existing web applications suffer from compatibility and performance issues in file transfer, and pure native application development is costly and difficult to achieve cross-platform applications.
The rendering unit and main processing unit are constructed using the Electron framework. Combined with the native processing unit, cross-platform file transfer is achieved through an asynchronous communication module and a plugin layer. The Electron main process manages the transfer tasks, and disk read/write and file verification are performed through a C++ dynamic link library.
It achieves cross-platform file transfer compatibility and performance improvement, while reducing development costs and improving the efficiency and stability of file transfer.
Smart Images

Figure CN114116623B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of desktop applications, and more particularly to a file transmission device and method. BACKGROUND
[0002] With the development of Internet technology, network cloud disks are favored by more and more individuals, teams, enterprises and other groups due to the advantages of cross-terminal access to files anytime and anywhere, large storage capacity, and convenient sharing and collaboration. The key technology of network cloud disk is file transmission.
[0003] Users can perform file transmission through a web browser or a client. Among them, by entering an address in the address bar of the web browser, the user can directly use the web application for file transmission without the need to install an additional client, which is convenient to use. In addition, the web application has a short development iteration cycle and has natural cross-platform capabilities.
[0004] However, the web application is susceptible to browser compatibility limitations, and most browsers cannot support the enhanced functions of the web application, only specific browsers such as Chrome support the enhanced functions of the web application. In addition, large-scale file transmission through the web application is prone to performance problems. On the contrary, a pure native application client can effectively solve the compatibility and performance problems of the web end and provide better performance and more powerful file transmission capabilities. However, the pure native application client needs to be developed separately for different operating systems, which has a high development cost and a long development cycle, and is less efficient than the web application in terms of manpower cost and iteration efficiency for enterprises.
[0005] Therefore, a solution is needed that can have cross-platform application capabilities while solving compatibility and performance problems in web technology. SUMMARY
[0006] Therefore, the present application provides a file transmission device and method to solve the compatibility and performance problems in web technology while providing cross-platform application capabilities.
[0007] To achieve the above-mentioned purpose, the first aspect of the present application provides a file transmission device, comprising a rendering unit, a main processing unit and a native processing unit;
[0008] The rendering unit is in communication connection with the main processing unit through an asynchronous communication module, and the main processing unit is in communication connection with the native processing unit through a plug-in layer;
[0009] The rendering unit includes a window container rendering interface constructed through an Electron framework, which is used to provide a user interaction interface and directly manage cloud files;
[0010] The main processing unit is configured to respond to a file transmission operation initiated by the rendering unit through the Electron main process, feed back transmission conditions to the rendering unit, and manage transmission tasks;
[0011] The native processing unit is configured to cooperate with the main processing unit to implement disk read / write, file inspection, and data transmission.
[0012] Preferably, the process of managing transmission tasks by the main processing unit comprises:
[0013] Saving state information of each transmission task in a local database;
[0014] Performing addition, deletion, and / or modification operations of transmission tasks in the local database according to preset rules;
[0015] For a file reaching a preset file size, performing fragmented transmission according to a preset fragmentation rule.
[0016] Preferably, the process of performing addition, deletion, and / or modification operations of transmission tasks in the local database according to preset rules by the main processing unit comprises:
[0017] Performing addition, deletion, and / or modification operations of transmission tasks in the local database according to a preset priority rule;
[0018] Performing addition, deletion, and / or modification operations of transmission tasks after a preset condition is reached.
[0019] Preferably, the process of performing addition, deletion, and / or modification operations of transmission tasks by the main processing unit after a preset condition is reached comprises:
[0020] When the number of transmission tasks to be executed for the same type of operation reaches a preset number, or the waiting time of the transmission tasks to be executed reaches a preset waiting duration, the transmission tasks are executed;
[0021] The operations include addition, deletion, and / or modification.
[0022] Preferably, the process of performing addition, deletion, and / or modification operations of transmission tasks by the main processing unit after a preset condition is reached further comprises:
[0023] When the number of transmission tasks being executed for the same type of operation reaches a preset threshold, other operations are executed after the current operation is completed.
[0024] Preferably, the preset priority includes high, medium, and low priorities of addition, deletion, and modification of transmission tasks in the local database.
[0025] Preferably, the main processing unit performs the process of the file transmission according to the preset file splitting rule for the file reaching the preset file size, comprising:
[0026] For the file within 10M-9.7GB, the file is split and transmitted with 10MB as the size of the split file;
[0027] For the file within 9.7GB-19.5GB, the file is split and transmitted with 20MB as the size of the split file;
[0028] For the file within 19.5GB-97.6GB, the file is split and transmitted with 50MB as the size of the split file;
[0029] For the file exceeding 97.6GB, the file is split and transmitted with K as the size of the split file, wherein the calculation formula of K comprises:
[0030]
[0031] wherein S is the size of the file, represents the upward rounding operation on S / 20000.
[0032] Preferably, the process of the main processing unit saving the state information of each transmission task in the local database comprises:
[0033] Saving the transmission type, the breakpoint resume state information, the local information and the cloud information of the transmitted file of each transmission task in the local database;
[0034] wherein the local information comprises the MD5 value, the file name, the file size and the local storage directory of the transmitted file, and the cloud information comprises the cloud parent directory ID, the cloud file ID, the ID of the enterprise to which the transmitted file belongs and the folder ID of the collaboration space.
[0035] Preferably, the process of the main processing unit managing the transmission task further comprises:
[0036] Using the child process to batch-process the modification of the transmission task;
[0037] Creating an instance to process the ongoing transmission task and maintaining the callback of the ongoing transmission task and the native processing unit;
[0038] Destroying the instance of the transmission task in the waiting state and the suspended transmission task, and destroying the callback of the transmission task in the waiting state and the suspended transmission task and the native processing unit.
[0039] Preferably, the main processing unit adopts a process of batch processing modification of the transmission task by a sub-process, comprising:
[0040] dividing objects involved in the modification of the transmission task into at least one batch of objects according to a preset division rule;
[0041] for each batch of objects in the batches of objects, processing the batch of objects by a sub-process.
[0042] The second aspect of the present application provides a file transmission method, comprising:
[0043] constructing a window container rendering interface by an Electron framework, the rendering interface being used to provide a user interactive interface and manage cloud files;
[0044] responding to a file transmission operation initiated by the rendering interface by an Electron main process, feeding back transmission conditions to the rendering interface, and managing transmission tasks;
[0045] constructing a native processing interface in the form of a C++ dynamic link library, the native processing interface being used to implement disk reading and writing, file verification, and data transmission.
[0046] According to the above technical solution, the present application divides a client into a rendering unit, a main processing unit, and a native processing unit. The rendering unit includes a window container rendering interface constructed by an Electron framework, and is used to provide a graphical interactive interface for a user and manage cloud files. The main processing unit is used to respond to a file transmission operation initiated by the rendering unit by an Electron main process, feed back transmission conditions to the rendering unit, and manage transmission tasks. The main processing unit realizes platform-independent processing by an Electron main process. The native processing unit is used to implement disk reading and writing, file verification, and data transmission, so as to complete file change monitoring, folder traversal, and file transmission in cooperation with the main processing unit. The file transmission device of the present application combines Web technology and native development technology, can be used across platforms, achieves the effect of one development and multiple platform use, and can well call underlying interfaces by native development technology, thereby achieving good compatibility and ensuring file transmission performance to a certain extent. BRIEF DESCRIPTION OF DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings described below only are a part of the present application, and for those skilled in the art, other drawings can be obtained based on the provided drawings without creative labor.
[0048] Figure 1 The schematic diagram of the file transmission device disclosed by the embodiments of the present application;
[0049] Figure 2 The interaction schematic diagram of the rendering unit and the main processing unit disclosed by the embodiments of the present application;
[0050] Figure 3 The interaction schematic diagram of the main processing unit and the rendering unit and the native processing unit disclosed by the embodiments of the present application;
[0051] Figure 4 The schematic diagram of the file transmission method disclosed by the embodiments of the present application;
[0052] Figure 5 The schematic diagram of the file transmission device disclosed by the embodiments of the present application. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0054] The file transmission device provided by the embodiments of the present application will be introduced below. Please refer to Figures 1 to 3 The file transmission device provided by the embodiments of the present application can include a rendering unit 10, a main processing unit 20 and a native processing unit 30.
[0055] The rendering unit 10 is in communication connection with the main processing unit 20 through an asynchronous communication module, and the main processing unit 20 is in communication connection with the native processing unit 30 through a plug-in layer.
[0056] The rendering unit 10 includes a window container rendering interface constructed through an Electron framework, which is used to provide a user interactive interface and directly manage cloud files.
[0057] The main processing unit 20 is used to respond to the file transmission operation initiated by the rendering unit 10 through an Electron main process, feed back the transmission situation to the rendering unit 10, and manage the transmission task.
[0058] The native processing unit 30 is used to implement disk read / write, file inspection and data transmission in cooperation with the main processing unit 20.
[0059] The Electron is an open source framework for building desktop applications with web technologies such as JavaScript, HTML and CSS, which generally includes a single Electron main process and several Electron render processes in building desktop applications.
[0060] Specifically, the Electron main process is used as the entry point of the application, which runs in the Node.js environment, meaning that it has access to the Require.js module loading framework and all Node.js APIs. The plug-in layer is written in Node.js.
[0061] The Electron render process corresponds to each opened browser window of the application, responsible for rendering the content displayed by the browser window. The code running in the Electron render process must comply with the W3C web standards.
[0062] The native processing unit 30 can be in the form of a C++ dynamic link library, which performs disk read / write, file inspection and data transmission operations on the underlying layer, and provides an operation interface for the main processing unit 20.
[0063] The file inspection can be verified by the MD5 value to check whether the file is damaged.
[0064] The client is divided into a rendering unit 10, a main processing unit 20 and a native processing unit 30 in the embodiment. The rendering unit 10 includes a window container constructed by the Electron framework to render the interface, which is used to provide a graphical interface for user interaction and manage the cloud files. The main processing unit 20 is used to respond to the file transmission operation initiated by the rendering unit 10 through the Electron main process, feed back the transmission situation to the rendering unit 10, and manage the transmission task. The Electron main process realizes platform-independent processing. The native processing unit 30 is used to implement disk read / write, file inspection and data transmission to complete the file change monitoring, folder traversal and file transmission in cooperation with the main processing unit 20. The file transmission device of the embodiment combines web technology and native development technology, which can realize cross-platform use, achieve one-time development and multi-platform use, and can well call the underlying interface through the native development technology to achieve good compatibility and ensure the performance of file transmission to some extent.
[0065] In some embodiments of the present application, the process in which the main processing unit 20 manages the transmission tasks can include:
[0066] S1, save the state information of each transmission task in the local database.
[0067] The state of the transmission task is used to describe the transmission situation of the transmission task, and can specifically include in progress, in waiting, suspended, completed, etc. For the unfinished transmission task, i.e. for the transmission task in progress, in waiting, suspended, the state further includes the local information, cloud information, transmission progress, transmission breakpoint, etc. of the transmitted file.
[0068] By saving the state information of each transmission task in the local database, when the computer is restarted after power-off or power failure, the original state of the transmission task can be restored by reading the relevant information from the local database on the disk.
[0069] S2, perform the adding, deleting and / or modifying operation of the transmission task in the local database according to the preset rule.
[0070] The user newly creates a transmission task, which can cause the adding operation of the transmission task in the local database; the user deletes an existing transmission task, which can cause the deleting operation of the transmission task in the local database; when the state of the transmission task changes, for example, the transmission task changes from in progress to completed, or from in waiting to suspended, etc., which can cause the modifying operation of the transmission task in the local database.
[0071] The preset rule can include the timing of performing the adding, deleting and / or modifying operation of the transmission task in the local database. Experiments show that too frequent database operations can easily cause the application program to crash. In practice, not all database operations must be performed immediately. On the premise of not affecting the user experience, setting a rule to reduce database access can effectively avoid the application program crash caused by database access pressure.
[0072] S3, for the file reaching the preset file size, perform the split transmission according to the preset split rule.
[0073] On the one hand, directly uploading a large file can easily cause connection timeout; on the other hand, when an error occurs or the transmission is interrupted, the entire file needs to be re-uploaded, which can cause unnecessary loss. Therefore, generally, a large file can be split into individual fragments for transmission, which can avoid the loss of error retransmission, and for the interrupted transmission task, the uploading can be continued from the interrupted fragment, which improves the transmission efficiency.
[0074] In some embodiments of the present application, the process in which the main processing unit 20 saves the state information of each transmission task in the local database includes:
[0075] S11, save the transmission type, breakpoint resume state information, local information and cloud information of the transmitted file of each transmission task in the local database.
[0076] The local information includes MD5 value, file name, file size and local storage directory of the transmitted file, and the cloud information includes cloud parent directory ID, cloud file ID, ID of the enterprise to which the transmitted file belongs and folder ID of the collaboration space.
[0077] Since the rendering unit 10 and the main processing unit 20 are independent processes and run in respective process spaces, different data and data structures are used. Therefore, for the operation request transmitted by the rendering unit 10, such as the operation on a certain transmission task, the main processing unit 20 traverses the transmission queue in the local database in the process space of the main process according to the identification of the transmission task transmitted by the rendering unit 10, so as to find the target transmission task, extract the corresponding information of the target transmission task, and then perform the corresponding operation.
[0078] In some embodiments of the present application, the process of the main processing unit 20 performing the adding, deleting and / or modifying operation of the transmission task in the local database according to the preset rule can include:
[0079] S21, performing the adding, deleting and / or modifying operation of the transmission task in the local database according to the preset priority rule.
[0080] The preset priority rule is the priority set for adding, deleting and modifying respectively. For example, the priority of adding and deleting can be set to be higher than that of modifying, and the operation with high priority is performed first, so as to avoid invalid modifying operation.
[0081] S22, performing the adding, deleting and / or modifying operation of the transmission task after the preset condition is reached.
[0082] The preset condition can be a quantitative limit. For example, when the number of operations to be performed reaches a certain number, the operations are performed in batches to reduce the operation frequency on the database.
[0083] In some embodiments of the present application, the preset priority can include that the priority of adding, deleting and modifying of the transmission task in the local database is high, medium and low respectively.
[0084] Specifically, the adding operation is performed first, the deleting operation is performed second, and the modifying operation is performed last. For example, when there are three operations in the operation queue, which are adding task A, modifying task B, and deleting task B, the adding task A is performed first, then the deleting task B is performed, and finally the modifying task B is performed. At this time, since task B has been deleted, the operation of modifying task B is exempted from execution.
[0085] In some embodiments of the present application, the process of performing the adding, deleting, and / or modifying operation of the transmission task after the preset condition is reached by the main processing unit 20 can include:
[0086] S221, when the number of transmission tasks to be executed for the same type of operation reaches a preset number, or the waiting time of the transmission task to be executed reaches a preset waiting time, the transmission task is executed again;
[0087] The operation includes adding, deleting, and / or modifying. Specifically,
[0088] For example, the operation to be added of the transmission task reaches 10, and the 10 adding operations are batch executed to perform an operation on the local database. For another example, the operation to be added of the accumulated transmission task has not reached 10, but the waiting time of some of the transmission tasks to be added has reached 2 seconds, and these operations that have been waiting for timeout are executed to perform an operation on the local database.
[0089] In some embodiments of the present application, the process of performing the adding, deleting, and / or modifying operation of the transmission task after the preset condition is reached by the main processing unit 20 can include:
[0090] S222, when the number of transmission tasks of the same type of operation being executed reaches a preset threshold, the current operation is executed, and then other operations are executed.
[0091] For example, if the number of records being executed for modifying the local database has reached 100, the operation of the 100 records is ended, and then other operations on the local database are executed.
[0092] In some embodiments of the present application, the process of performing the adding, deleting, and / or modifying operation of the transmission task after the preset condition is reached by the main processing unit 20 can include:
[0093] S31, for a file of 10M-9.7GB, a file of 10MB is used as a slice size, and the file is sliced and transmitted;
[0094] S32, for a file of 9.7GB-19.5GB, a file of 20MB is used as a slice size, and the file is sliced and transmitted;
[0095] S33, for the file within 19.5GB~97.6GB, taking 50MB as the size of the slice, the file is sliced and transmitted;
[0096] S34, for the file more than 97.6GB, taking K as the size of the slice, the file is sliced and transmitted, wherein the calculation formula of K includes:
[0097]
[0098] wherein S is the size of the file, represents the upward rounding operation on S / 20000.
[0099] In some embodiments of the present application, the process of the main processing unit 20 managing the transmission task can further include:
[0100] S4, using a sub-process to batch process the modification of the transmission task.
[0101] Specifically, since the rendering unit 10 needs to constantly communicate with the main processing unit 20 between processes, if the main process of the main processing unit 20 is in a busy state at this time, the process of the rendering unit 10 will be blocked when communicating. By using a sub-process to batch process the modification of the transmission task, the process blocking caused by the long traversal of the main process of the main processing unit 20 is avoided, the communication between the rendering unit 10 and the main processing unit 20 remains smooth, and the user's use experience can be improved.
[0102] S5, creating an instance to process the ongoing transmission task and maintaining the callback of the ongoing transmission task and the native processing unit 30.
[0103] For the ongoing transmission task, a separate instance is created to process it, which can ensure the real-time communication between the main processing unit 20 and the native processing unit 30 and guarantee the smoothness of file transmission.
[0104] S6, destroying the instance of the transmission task in the waiting and the suspended transmission task, and destroying the callback of the transmission task in the waiting and the suspended transmission task and the native processing unit 30.
[0105] For the transmission task in the waiting and the suspended transmission task, the instance is destroyed, and the callback of the main processing unit 20 and the native processing unit 30 is also destroyed, which is beneficial to solve the crash caused by excessive memory occupation.
[0106] In some embodiments of the present application, the process of the main processing unit 20 using a sub-process to batch process the modification of the transmission task can include:
[0107] S41, objects involved in modification of the transmission task are divided into at least one batch of objects according to a preset division rule.
[0108] S42, for each batch of objects, a sub-process is used to process the batch of objects.
[0109] Specifically, the state of the transmission task can include in progress, waiting, and paused, and the three states are stored by three arrays respectively. The increase, pause, and deletion operations of the transmission task will simultaneously involve the increase and deletion operations between multiple arrays, and the operation amount involved can be relatively large. Therefore, the objects involved in the modification of the transmission task need to be processed in batches, and the batch is copied and delivered to the sub-process to alleviate the processing pressure of the process.
[0110] The file transmission method provided by the embodiment of the application will be described below. The file transmission method provided by the embodiment of the application corresponds to the file transmission device described above. Please refer to Figure 4 The file transmission method provided by the embodiment of the application can include the following steps:
[0111] Step S100, a window container is constructed by using an Electron framework to render an interface.
[0112] The rendered interface is used to provide a user interaction interface and manage cloud files.
[0113] Step S200, a file transmission operation initiated by the rendered interface is responded to by using an Electron main process, transmission conditions are fed back to the rendered interface, and transmission tasks are managed.
[0114] Step S300, a native processing interface is constructed in the form of a C++ dynamic link library.
[0115] The native processing interface is used to realize disk reading and writing, file verification, and data transmission by calling native capabilities.
[0116] In some embodiments of the application, the process of managing the transmission task by the step S200 described above can include:
[0117] S1, state information of each transmission task is saved in a local database;
[0118] S2, an increase, deletion, and / or modification operation of the transmission task in the local database is performed according to a preset rule;
[0119] S3, for a file reaching a preset file size, a fragmentation transmission is performed according to a preset fragmentation rule.
[0120] In some embodiments of the present application, the process of saving the state information of each transmission task in the local database by S1 can include:
[0121] S11, saving the transmission type, breakpoint resume state information, local information and cloud information of the transmitted file of each transmission task in the local database;
[0122] The local information includes the MD5 value, file name, file size and local storage directory of the transmitted file, and the cloud information includes the cloud parent directory ID, cloud file ID, ID of the enterprise to which the transmitted file belongs and folder ID of the collaboration space.
[0123] In some embodiments of the present application, the process of performing the adding, deleting and / or modifying operation of the transmission task in the local database according to the preset rule by S2 can include:
[0124] S21, performing the adding, deleting and / or modifying operation of the transmission task in the local database according to the preset priority rule;
[0125] S22, performing the adding, deleting and / or modifying operation of the transmission task after reaching the preset condition.
[0126] In some embodiments of the present application, the process of performing the adding, deleting and / or modifying operation of the transmission task after reaching the preset condition by S22 can include:
[0127] S221, when the number of transmission tasks to be executed for the same type of operation reaches a preset number, or the waiting time of the transmission task to be executed reaches a preset waiting time, the transmission task is executed again;
[0128] The operation includes adding, deleting and / or modifying.
[0129] In some embodiments of the present application, the process of performing the adding, deleting and / or modifying operation of the transmission task after reaching the preset condition by S22 can further include:
[0130] S222, when the number of transmission tasks being executed for the same type of operation reaches a preset threshold, the other operation is executed after the current operation is executed.
[0131] In some embodiments of the present application, the process of performing the slicing transmission according to the preset slicing rule for the file reaching the preset file size by S3 includes:
[0132] S31, for a file within 10M-9.7GB, taking 10MB as the slicing size to perform slicing transmission on the file;
[0133] S32, for a file within 9.7GB-19.5GB, taking 20MB as the size of the slice, the file is sliced and transmitted;
[0134] S33, for a file within 19.5GB-97.6GB, taking 50MB as the size of the slice, the file is sliced and transmitted;
[0135] S34, for a file more than 97.6GB, taking K as the size of the slice, the file is sliced and transmitted, wherein the calculation formula of K includes:
[0136]
[0137] wherein S is the size of the file, indicates the upward rounding operation of S / 20000.
[0138] In some embodiments of the present application, the process of step S200 for managing the transmission task can further include:
[0139] S4, using a sub-process to batch process the modification of the transmission task;
[0140] S5, creating an instance to process the ongoing transmission task and maintaining the callback of the ongoing transmission task and the native processing unit;
[0141] S6, destroying the instance of the transmission task in the waiting and the suspended transmission task, and destroying the callback of the transmission task in the waiting and the suspended transmission task and the native processing unit.
[0142] In some embodiments of the present application, the process of S4 using a sub-process to batch process the modification of the transmission task can include:
[0143] S41, dividing the objects involved in the modification of the transmission task into at least one batch of objects according to a preset division rule;
[0144] S42, for each batch of objects, using a sub-process to process the batch of objects.
[0145] The file transmission device provided by the embodiments of the present application can be applied to a file transmission device, such as a computer and the like. Optionally, Figure 5 The hardware structure block diagram of the file transmission device is shown, referring to Figure 5 The hardware structure of the file transmission device can include at least one processor 31, at least one communication interface 32, at least one memory 33 and at least one communication bus 34.
[0146] In the embodiments of the present application, the number of the processor 31, the communication interface 32, the memory 33 and the communication bus 34 is at least one, and the processor 31, the communication interface 32 and the memory 33 complete the communication with each other through the communication bus 34;
[0147] The processor 31 can be a central processing unit CPU, or an application specific integrated circuit ASIC, or one or more integrated circuits configured to implement the embodiments of the present application, etc.
[0148] The memory 32 can include a high-speed RAM memory, and can also include a non-volatile memory, such as at least one disk memory.
[0149] The memory 33 stores a program, and the processor 31 can invoke the program stored in the memory 33, and the program is used for:
[0150] The rendering interface is constructed by using an Electron framework to construct a window container, and the rendering interface is used to provide a user interaction interface and manage cloud files.
[0151] The Electron main process responds to a file transmission operation initiated by the rendering interface, feeds back transmission information to the rendering interface, and manages a transmission task.
[0152] A native processing interface is constructed in the form of a C++ dynamic link library, and is used to implement disk reading and writing, file verification and data transmission.
[0153] Optionally, the detailed functions and extended functions of the program can be referred to the description above.
[0154] The embodiments of the present application also provide a storage medium, which can store a program suitable for a processor to execute, and the program is used for:
[0155] The rendering interface is constructed by using an Electron framework to construct a window container, and the rendering interface is used to provide a user interaction interface and manage cloud files.
[0156] The Electron main process responds to a file transmission operation initiated by the rendering interface, feeds back transmission information to the rendering interface, and manages a transmission task.
[0157] A native processing interface is constructed in the form of a C++ dynamic link library, and is used to implement disk reading and writing, file verification and data transmission.
[0158] Optionally, the detailed functions and extended functions of the program can be referred to the description above.
[0159] In summary:
[0160] The client is divided into a rendering unit, a main processing unit and a native processing unit in the embodiment. The rendering unit includes a window container constructed by the Electron framework to render an interface, and is configured to provide a graphical interactive interface for a user and manage cloud files. The main processing unit is configured to respond to a file transmission operation initiated by the rendering unit through an Electron main process, feed back transmission information to the rendering unit, and manage a transmission task. The native processing unit is configured to implement disk reading and writing, file inspection and data transmission, so as to complete file change monitoring, folder traversal and file transmission in cooperation with the main processing unit. The file transmission device in the embodiment combines Web technology and native development technology, can be used cross-platform, achieves the effect of one development and multi-platform use, and can well call a bottom interface through the native development technology, achieves good compatibility and guarantees file transmission performance to a certain extent.
[0161] Finally, it should be noted that in this document, the terms“first” and“second” and the like are used merely to distinguish one entity or action from another, without necessarily requiring or implying any actual relationship or order between such entities or actions. Moreover, the terms“comprises,”“comprising,” or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by“comprises a” does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.
[0162] The various embodiments in the specification are described in a progressive manner, each embodiment focuses on the difference from other embodiments, and each embodiment can be combined as needed, and the same and similar parts are referred to each other.
[0163] The above description of the disclosed embodiments enables a person skilled in the art to implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A file transfer device, characterized in that, This includes rendering units, main processing units, and native processing units; The rendering unit communicates with the main processing unit through an asynchronous communication module, and the main processing unit communicates with the native processing unit through a plugin layer. The rendering unit includes a window container rendering interface constructed using the Electron framework, which provides a user interaction interface and allows direct management of cloud files; The main processing unit is used to respond to file transfer operations initiated by the rendering unit through the Electron main process, to feed back the transfer status to the rendering unit, and to manage the transfer tasks. The process by which the main processing unit manages transmission tasks includes: storing the status information of each transmission task in a local database; performing addition, deletion, and / or modification operations on transmission tasks in the local database according to preset rules, including performing addition, deletion, and / or modification operations on transmission tasks in the local database according to preset priority rules, wherein the preset priority rules are priorities set separately for addition, deletion, and modification; and performing fragmented transmission on files that reach a preset file size according to preset fragmentation rules. The native processing unit is used in conjunction with the main processing unit to perform disk read / write, file verification, and data transmission. The process of the main processing unit managing the transmission tasks also includes: using subprocesses to process the modifications of the transmission tasks in batches; creating instances to process the ongoing transmission tasks and maintaining the callbacks of the ongoing transmission tasks and the native processing unit; destroying instances of waiting and paused transmission tasks, as well as destroying the callbacks of waiting and paused transmission tasks and the native processing unit. The main processing unit uses subprocesses to process the modifications to the transmission task in batches, including: dividing the objects involved in the modification of the transmission task into at least one batch of objects according to a preset division rule; and using a subprocess to process each batch of objects.
2. The apparatus according to claim 1, characterized in that, The main processing unit executes the process of adding, deleting, and / or modifying transmission tasks in the local database according to preset rules, and further includes: The addition, deletion, and / or modification of transmission tasks will be performed only after the preset conditions are met.
3. The apparatus according to claim 2, characterized in that, The process by which the main processing unit performs the addition, deletion, and / or modification operations of transmission tasks after meeting preset conditions includes: The transmission task will be executed when the number of transmission tasks of the same type to be executed reaches a preset number, or when the waiting time of the transmission task to be executed reaches a preset waiting time. The operations include adding, deleting, and / or modifying.
4. The apparatus according to claim 3, characterized in that, The process by which the main processing unit performs the addition, deletion, and / or modification operations of transmission tasks after meeting preset conditions also includes: When the number of transmission tasks of the same type of operation being executed reaches a preset threshold, other operations will be executed only after the current operation is completed.
5. The apparatus according to claim 1, characterized in that, For files that reach a preset file size, the main processing unit performs a fragmented transmission process according to preset fragmentation rules, including: For files between 10MB and 9.7GB, the file is divided into segments of 10MB each for transmission. For files between 9.7GB and 19.5GB, the files are divided into segments of 20MB each for transmission. For files between 19.5GB and 97.6GB, the files are divided into chunks of 50MB for transmission. For files larger than 97.6GB, The file is divided into chunks for transmission, with K calculated using the following formula: ; in, The size of the file. Indicates to Round up.
6. The apparatus according to claim 1, characterized in that, The process by which the main processing unit saves the status information of each transmission task in a local database includes: The transmission type, breakpoint resume status information, local information and cloud information of the transmitted files are stored in the local database for each transmission task. The local information includes the MD5 value, file name, file size, and local storage directory of the transmitted file, while the cloud information includes the cloud parent directory ID, cloud file ID, the ID of the enterprise to which the file belongs, and the folder ID of the collaboration space.
7. A file transfer method, characterized in that, include: A window container rendering interface is constructed using the Electron framework. This rendering interface is used to provide a user interaction interface and manage cloud files. The Electron main process responds to file transfer operations initiated by the rendering interface, feeds back the transfer status to the rendering interface, and manages the transfer tasks. The process of managing transmission tasks includes: storing the status information of each transmission task in a local database; performing addition, deletion, and / or modification operations on transmission tasks in the local database according to preset rules, including performing addition, deletion, and / or modification operations on transmission tasks in the local database according to preset priority rules, wherein the preset priority rules are priorities set separately for addition, deletion, and modification; for files that reach a preset file size, performing fragmented transmission according to preset fragmentation rules; A native processing interface is constructed in the form of a C++ dynamic link library. This native processing interface is used to implement disk read / write, file verification, and data transmission. The process of managing the transmission tasks further includes: using subprocesses to process modifications to the transmission tasks in batches; creating instances to process ongoing transmission tasks and maintaining callbacks between ongoing transmission tasks and the native processing unit; destroying instances of waiting and paused transmission tasks, as well as destroying callbacks between waiting and paused transmission tasks and the native processing unit. The process of using subprocesses to process modifications to the transmission task in batches includes: dividing the objects involved in the modification of the transmission task into at least one batch of objects according to a preset division rule; and using a subprocess to process each batch of objects within each batch.
Citation Information
Patent Citations
Cloud rendering system without file transmission and method thereof
CN106254489A
Cloud desktop toolbar management method based on Electron technology
CN112463276A