File online preview method and system, computer equipment, and readable storage medium
By caching and verifying temporary files in the online document collaboration system and using message queues to ensure the timing of file rendering, the problem that the document rendering conversion process consumes computer resources and the documents seen by users are not the latest, real-time synchronous conversion rendering and reducing economic losses are achieved.
Patent Information
- Application Number
- CN202111128055.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-26
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-09-26
AI Technical Summary
In online document collaboration, the document rendering and conversion process consumes computer resources and is slow, resulting in the documents seen by users being not the latest version, causing economic losses.
By receiving the document data entered by the user, sending it to the online editing server, cache temporary files to the solid state drive, verifying them, and selectively storing them to the file server. The first message queue is introduced, the ID and storage timestamp of the temporary file are sent, and the files are rendered in sequence through the second message queue.
Real-time synchronous conversion and rendering of online files is realized, ensuring that the files seen by users are the latest version, reducing users' economic losses, and meeting the requirements of high-frequency file updates and online previews.
Smart Images

Figure CN113919283B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of online documents, and in particular to a method and system for online previewing of files, a computer device, and a readable storage medium. Background Art
[0002] With the development of online office, online document collaboration and document preview are becoming more and more popular, and more and more users are using online documents for editing and display.
[0003] However, the document rendering and conversion process is very computer resource-intensive and slow. During the high-frequency update of documents, if the document cannot be rendered in time after the update, most users will not see the latest version of the document. At the same time, the incorrect display of intermediate information will also cause certain economic losses to users. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0005] To this end, the first aspect of the present invention is to provide a file online preview method.
[0006] A second aspect of the present invention is to provide a file online preview system.
[0007] A third aspect of the present invention is to provide a computer device.
[0008] A fourth aspect of the present invention is to provide a readable storage medium.
[0009] In view of this, according to a first aspect of the present invention, a method for online previewing of files is proposed, comprising: receiving document data input by a user, and sending the document data to an online editing server; caching a temporary file generated in the online editing server to a solid state drive; verifying the temporary file, and storing the temporary file to the file server according to the verification result; the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to a first message queue, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file; the synchronization server processes the first message queue according to the storage timestamp to obtain a second message queue; and the document conversion rendering server generates an HTML online file according to the file message rendering in the second message queue.
[0010] The file online preview method provided by the present invention receives document data input by a user, sends the document data to an online editing server, and then caches the temporary files generated in the online editing server to a solid state hard disk, verifies the temporary files, and stores the temporary files to the file server according to the verification results. In the process of high-frequency file updates, a large number of file intermediate versions, i.e., temporary files, are generated. The present invention avoids storing all temporary files to the file server by caching the temporary files to the solid state hard disk and then verifies and selectively stores the temporary files. While preventing useless temporary files from occupying the memory resources of the file server, it can also realize the timed update and synchronous storage of temporary files, ensuring that the temporary files stored to the file server are the latest versions of the files.
[0011] Further, in the online file preview method provided by the present invention, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file. When multiple users edit and update the same file at the same time, due to problems such as network bandwidth delay, the timing of the final storage of the file will change, resulting in the final rendered file not being the latest version of the file. The present invention introduces the first message queue, sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue, and associates the ID of the temporary file with the physical storage network address of the temporary file, thereby pressing the storage time of the temporary file into the first message queue. In this way, when processing the temporary file stored in the file server, the latest version of the temporary file can be directly selected according to the storage time indicated by the storage timestamp, and then the corresponding file entity is obtained through the association between the ID of the temporary file and the physical storage network address of the temporary file. In this way, it is ensured that the processed file is the latest version of the file, the real-time performance of the file processing is ensured, and the requirements for high-frequency file updates are met.
[0012] Furthermore, in the method for online previewing of files provided by the present invention, the synchronization server processes the first message queue according to the storage timestamp to obtain the second message queue, and then the document conversion and rendering server generates an HTML online file according to the file message rendering in the second message queue. The storage timestamp indicates the storage time of the temporary file. By processing the first message queue to obtain the second message queue with the storage timestamp, the timing of the processing of the first message queue can be guaranteed, thereby ensuring the timing of the file messages in the second message queue. On this basis, the HTML online file is generated based on the file message rendering in the second message queue, which can ensure the timing of the file rendering, thereby ensuring that the rendered file is the latest file, realizing the real-time synchronous conversion and rendering of the online file, ensuring that the file seen by the user is the latest version, reducing the economic loss of the user, and meeting the requirements of high-frequency file updates and online previews.
[0013] Therefore, the file online preview method provided by the present invention caches and verifies temporary files, selectively stores temporary files on a file server, and then introduces a first message queue and a second message queue, and renders files in sequence based on the second message queue, thereby realizing real-time synchronous conversion and rendering of online files, ensuring that the files seen by users are the latest versions, reducing the economic losses of users, and meeting the requirements of high-frequency file updates and online previews.
[0014] The above-mentioned online file preview method according to the present invention may also have the following technical features:
[0015] In the above technical solution, preferably, after the step of storing the temporary file in the file server according to the verification result, it also includes: generating a physical storage network address and a storage timestamp for the temporary file stored in the file server.
[0016] In this technical solution, after the temporary file is stored in the file server, an entity storage network address and a storage timestamp are generated for the temporary file stored in the file server. The entity storage network address indicates the storage address of the file entity, and the corresponding file entity can be obtained through the entity storage network address. The storage timestamp indicates the storage time of the temporary file, and the file is processed based on the time indicated by the storage timestamp, which ensures the time sequence of file processing and meets the requirements of high-frequency file update and processing.
[0017] In any of the above technical solutions, preferably, the temporary file is verified, and the step of storing the temporary file in the file server according to the verification result specifically includes: comparing the Hash value of the current version of the temporary file with the previous version; if the Hash values are different, the temporary file is stored in the file server, and if the Hash values are the same, the storage of the temporary file is abandoned.
[0018] In this technical solution, the temporary file is verified, and the Hash value of the current version of the temporary file is compared with the previous version. When the Hash values of the two are different, the temporary file of the current version is stored in the file server, and when the Hash values of the two are the same, the storage of the temporary file of the current version is abandoned. The Hash value is a numerical value obtained through logical operation based on the content of the file. Different files (even with the same file name) have different Hash values, so the Hash value can be used as the "identity card" of the file. For files with the same Hash value, their contents must be exactly the same. Therefore, by storing temporary files with different Hash values between the current version and the previous version in the file server, it can be ensured that the files are stored only when they are updated, avoiding the storage of unchanged temporary files in the file server and occupying the memory resources of the file server. At the same time, it is also possible to realize the timed update and synchronous storage of temporary files, ensuring that the temporary files stored in the file server are the latest versions of the files.
[0019] In any of the above technical solutions, preferably, the step of the synchronization server processing the first message queue according to the storage timestamp to obtain the second message queue specifically includes: reading the file message in the first message queue to the third message queue; sending the latest file message in the third message queue to the second message queue at a preset time interval according to the storage timestamp; and / or sending the latest file message in the third message queue to the second message queue at a preset number of intervals according to the storage timestamp.
[0020] In this technical solution, the synchronization server reads the file message in the first message queue into the third message queue, and then sends the latest file message in the third message queue to the second message queue according to the storage timestamp and at a preset time interval. The file message in the first message queue indicates a temporary file stored in the file server. During the high-frequency update process of the file, a large number of temporary files will be generated. Even if the temporary files are selectively stored in the file server through screening, the number of temporary files stored in the file server is still large. The storage time of temporary files in the same time period is relatively close. When previewing the file, there is no need to process each temporary file. It is only necessary to process the last temporary file within the preset time interval according to the storage order of the temporary files. Therefore, by reading the file message in the first message queue into the third message queue, and then sending the latest file message in the third message queue to the second message queue at a preset time interval, the file message in the first message queue can be screened, reducing the number of rendering times and saving memory resources.
[0021] Furthermore, in this technical solution, the latest file message in the third message queue can be sent to the second message queue according to the storage timestamp and at a preset number of intervals. The storage time of temporary files in the same batch is relatively close. In order to reduce resource waste, when previewing files, the last temporary file of the same batch can be processed at a preset number of intervals. Therefore, by reading the file messages in the first message queue to the third message queue, and then sending the latest file messages in the third message queue to the second message queue at a preset number of intervals, the file messages in the first message queue can also be screened, reducing the number of renderings and saving memory resources.
[0022] In any of the above technical solutions, preferably, the step of generating an HTML online file by the document conversion rendering server according to the file message rendering in the second message queue specifically includes: obtaining the file entity from the file server according to the file message in the second message queue; obtaining the CPU usage rate, comparing the CPU usage rate with a preset threshold, and rendering the file entity according to the comparison result; if the CPU usage rate is less than the preset threshold, increasing the frequency of rendering the file entity, and if the CPU usage rate is greater than the preset threshold, reducing the frequency of rendering the file entity.
[0023] In this technical solution, the file entity is obtained from the file server according to the file message in the second message queue. The file message in the second message queue is a filtered file message, which contains the ID of the temporary file stored in the file server and the storage timestamp. The ID of the temporary file is associated with the physical storage network address of the temporary file. In this way, the file messages in the second message queue are processed in sequence based on the storage timestamp, and the ID of the corresponding temporary file is obtained, and then the corresponding file entity is obtained from the file server based on the association between the ID of the temporary file and the physical storage network address. In this way, the sequentiality and selectivity of the acquisition of the file entity are guaranteed, and while the real-time rendering of the file entity is guaranteed, memory resources are saved.
[0024] Furthermore, in this technical solution, before rendering the file entity, the CPU usage rate is obtained, the CPU usage rate is compared with a preset threshold, and the file entity is rendered according to the comparison result. When the CPU usage rate is less than the preset threshold, that is, the CPU usage rate is low, the frequency of rendering the file entity is increased, and multiple rendering operations are performed. When the CPU usage rate is greater than the preset threshold, that is, the CPU usage rate is high, the frequency of rendering the file entity is reduced. Specifically, the queuing time of the file entity rendering queue is increased, and after squeezing out a certain amount of file entities, the latest version of the file entity is selected for rendering. In this way, an on-demand dynamic rendering mechanism is adopted, and the frequency of rendering operations can be flexibly changed according to the CPU usage, thereby avoiding the conversion and rendering of too many unnecessary files, reducing unnecessary file rendering overhead, saving CPU memory resources, and ensuring the high availability of the document conversion and rendering server.
[0025] According to a second aspect of the present invention, a file online preview system is proposed, comprising: a receiving unit, for receiving document data input by a user, and sending the document data to an online editing server; a caching unit, for caching a temporary file generated in the online editing server to a solid state drive; a verification unit, for verifying the temporary file, and storing the temporary file to the file server according to the verification result; a first processing unit, for the online editing server to send the ID and storage timestamp of the temporary file stored in the file server to a first message queue, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file; a second processing unit, for the synchronization server to process the first message queue according to the storage timestamp to obtain a second message queue; and a rendering unit, for the document conversion rendering server to render and generate an HTML online file according to the file message in the second message queue.
[0026] The file online preview system provided by the present invention receives document data input by a user through a receiving unit, sends the document data to an online editing server, and then caches the temporary files generated in the online editing server to a solid state hard disk through a cache unit, and verifies the temporary files through a verification unit, and stores the temporary files to the file server according to the verification results. In the process of high-frequency file updates, a large number of intermediate versions of files, namely temporary files, are generated. The present invention uses a cache unit to cache temporary files to a solid state hard disk and then verifies and selectively stores the temporary files, avoiding storing all temporary files to the file server. While preventing useless temporary files from occupying the memory resources of the file server, it can also realize the timed update and synchronous storage of temporary files, ensuring that the temporary files stored to the file server are the latest versions of the files.
[0027] Further, in the file online preview system provided by the present invention, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue through the first processing unit, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file. When multiple users edit and update the same file at the same time, due to problems such as network bandwidth delay, the timing of the final storage of the file will change, resulting in the final rendered file not being the latest version of the file. The present invention uses the first processing unit to introduce the first message queue, sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue, and associates the ID of the temporary file with the physical storage network address of the temporary file, thereby pressing the storage time of the temporary file into the first message queue. In this way, when processing the temporary file stored in the file server, the latest version of the temporary file can be directly selected according to the storage time indicated by the storage timestamp, and then the corresponding file entity is obtained through the association between the ID of the temporary file and the physical storage network address of the temporary file. In this way, it is ensured that the processed file is the latest version of the file, the real-time performance of the file processing is ensured, and the requirements for high-frequency file updates are met.
[0028] Furthermore, the file online preview system provided by the present invention enables the synchronization server to process the first message queue according to the storage timestamp to obtain the second message queue through the second processing unit, and then enables the document conversion rendering server to generate an HTML online file according to the file message rendering in the second message queue through the rendering unit. The storage timestamp indicates the storage time of the temporary file. The first message queue is processed based on the storage timestamp to obtain the second message queue, which can ensure the timing of the processing of the first message queue, thereby ensuring the timing of the file messages in the second message queue. On this basis, the HTML online file is generated based on the file message rendering in the second message queue, which can ensure the timing of the file rendering, thereby ensuring that the rendered file is the latest file, realizing real-time synchronous conversion and rendering of online files, ensuring that the files seen by users are the latest versions, reducing the economic losses of users, and meeting the requirements of high-frequency file updates and online previews.
[0029] Therefore, the file online preview system provided by the present invention caches temporary files through a cache unit, verifies temporary files through a verification unit, selectively stores temporary files on a file server, and then introduces a first message queue through a first processing unit, introduces a second message queue through a second processing unit, and renders files in sequence through a rendering unit based on the second message queue, thereby realizing real-time synchronous conversion and rendering of online files, ensuring that the files seen by users are the latest versions, reducing the economic losses of users, and meeting the requirements of high-frequency file updates and online previews.
[0030] The above-mentioned file online preview system according to the present invention may also have the following technical features:
[0031] In the above technical solution, preferably, the system further comprises: a generating unit, configured to generate a physical storage network address and a storage timestamp for the temporary file stored in the file server.
[0032] In this technical solution, a physical storage network address and a storage timestamp are generated for a temporary file stored in a file server by a generation unit. The physical storage network address indicates the storage address of the file entity, and the corresponding file entity can be obtained through the physical storage network address. The storage timestamp indicates the storage time of the temporary file, and the file is processed based on the time indicated by the storage timestamp, which ensures the time sequence of file processing and meets the requirements of high-frequency file update and processing.
[0033] In any of the above technical solutions, preferably, the verification unit is specifically used to compare the Hash value of the current version of the temporary file with the previous version; if the Hash values are different, the temporary file is stored in the file server; if the Hash values are the same, the temporary file is abandoned.
[0034] In this technical solution, the temporary file is verified by the verification unit, and the Hash value of the current version of the temporary file is compared with the previous version. When the Hash values of the two are different, the temporary file of the current version is stored in the file server, and when the Hash values of the two are the same, the temporary file of the current version is abandoned. The Hash value is a numerical value obtained by logical operation based on the content of the file. Different files (even with the same file name) have different Hash values, so the Hash value can be used as the "identity card" of the file. For files with the same Hash value, their contents must be exactly the same. Therefore, the Hash value of the current version of the temporary file is compared with the previous version by the verification unit, and the temporary file with different Hash values of the current version and the previous version is stored in the file server, which can ensure that the file is stored only when it is updated, avoiding the storage of unchanged temporary files in the file server and occupying the memory resources of the file server. At the same time, the timed update and synchronous storage of temporary files can also be realized, ensuring that the temporary files stored in the file server are the latest versions of the files.
[0035] In any of the above technical solutions, preferably, the second processing unit is specifically used to read the file message in the first message queue to the third message queue; send the latest file message in the third message queue to the second message queue at a preset time interval based on the storage timestamp; and / or send the latest file message in the third message queue to the second message queue at a preset number of intervals based on the storage timestamp.
[0036] In this technical solution, the file message in the first message queue is read into the third message queue by the second processing unit, and then the latest file message in the third message queue is sent to the second message queue according to the preset time interval based on the storage timestamp. The file message in the first message queue indicates the temporary file stored in the file server. During the high-frequency update process of the file, a large number of temporary files will be generated. Even if the temporary files are selectively stored in the file server through screening, the number of temporary files stored in the file server is still large. The storage time of temporary files in the same time period is relatively close. When previewing the file, it is not necessary to process each temporary file. It is only necessary to process the last temporary file within the preset time interval according to the storage order of the temporary files. Therefore, the file message in the first message queue is read into the third message queue by the second processing unit, and then the latest file message in the third message queue is sent to the second message queue according to the preset time interval, which can play a role in screening the file messages in the first message queue, reduce the number of rendering times, and save memory resources.
[0037] Furthermore, in this technical solution, the second processing unit can also be used to send the latest file message in the third message queue to the second message queue according to the storage timestamp and at a preset number of intervals. The storage time of temporary files in the same batch is relatively close. In order to reduce resource waste, when previewing files, the last temporary file of the same batch can be processed at a preset number of intervals. Therefore, the file messages in the first message queue are read to the third message queue by the second processing unit, and then the latest file messages in the third message queue are sent to the second message queue at a preset number of intervals. This can also play a role in screening the file messages in the first message queue, reducing the number of rendering times and saving memory resources.
[0038] In any of the above technical solutions, preferably, the rendering unit includes: a first acquisition unit, used to obtain the file entity from the file server according to the file information in the second message queue; a second acquisition unit, used to obtain the CPU usage rate; a third processing unit, used to compare the CPU usage rate with a preset threshold value, and render the file entity according to the comparison result; the third processing unit is specifically used to increase the frequency of rendering the file entity if the CPU usage rate is less than the preset threshold value, and reduce the frequency of rendering the file entity if the CPU usage rate is greater than the preset threshold value.
[0039] In this technical solution, the first acquisition unit acquires the file entity from the file server according to the file message in the second message queue. The file message in the second message queue is a filtered file message, which contains the ID of the temporary file stored in the file server and the storage timestamp. The ID of the temporary file is associated with the physical storage network address of the temporary file. In this way, the file messages in the second message queue are processed in sequence based on the storage timestamp to acquire the ID of the corresponding temporary file, and then the corresponding file entity is acquired from the file server based on the association between the ID of the temporary file and the physical storage network address. In this way, the sequentiality and selectivity of the acquisition of the file entity are guaranteed, and while the real-time rendering of the file entity is guaranteed, memory resources are saved.
[0040] Furthermore, in this technical solution, before rendering the file entity, the CPU usage rate is also obtained through the second acquisition unit, and the CPU usage rate is compared with the preset threshold value through the third processing unit, and the file entity is rendered according to the comparison result. When the CPU usage rate is less than the preset threshold value, that is, the CPU usage rate is low, the frequency of rendering the file entity is increased, and multiple rendering operations are performed. When the CPU usage rate is greater than the preset threshold value, that is, the CPU usage rate is high, the frequency of rendering the file entity is reduced. Specifically, the queuing time of the file entity rendering queue is increased, and after squeezing a certain amount of file entities, the latest version of the file entity is selected for rendering. In this way, an on-demand dynamic rendering mechanism is adopted, and the frequency of rendering work is flexibly changed according to the CPU usage, thereby avoiding the conversion and rendering of too many unnecessary files, reducing unnecessary file rendering overhead, saving CPU memory resources, and ensuring the high availability of the document conversion and rendering server.
[0041] According to a third aspect of the present invention, the present invention provides a computer device, comprising: a file online preview system in any of the above technical solutions; a memory, on which a computer program is stored; and a processor, which implements the steps of the file online preview method in any of the above technical solutions when executing the computer program.
[0042] The computer device provided by the present invention includes the online file preview system in any of the above technical solutions. Therefore, it has all the beneficial effects of the online file preview system in any of the above technical solutions, which will not be repeated here.
[0043] Furthermore, the computer device provided by the present invention includes a memory and a processor, and the memory stores a computer program executable by the processor, and when the computer program is executed by the processor, the steps of the online file preview method in any of the above technical solutions can be implemented. Therefore, the computer device has all the beneficial effects of the online file preview method in any of the above technical solutions, which will not be repeated here.
[0044] According to a fourth aspect of the present invention, the present invention provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the file online preview method in any of the above technical solutions are implemented.
[0045] The readable storage medium provided by the present invention stores a computer program thereon, and when the computer program is executed by a processor, the steps of the online file preview method in any of the above technical solutions are implemented. Therefore, the readable storage medium has all the beneficial effects of the online file preview method in any of the above technical solutions, which will not be repeated here.
[0046] Additional aspects and advantages of the present invention will become apparent from the following description or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0048] Figure 1 One of the flowcharts of the method for online previewing of a file according to an embodiment of the present invention is shown;
[0049] Figure 2 A second flowchart of a method for online previewing of a file according to an embodiment of the present invention is shown;
[0050] Figure 3 A third flowchart of a method for online previewing of a file according to an embodiment of the present invention is shown;
[0051] Figure 4 A fourth flowchart of a method for online previewing of a file according to an embodiment of the present invention is shown;
[0052] Figure 5 A fifth flowchart of a method for online previewing of a file according to an embodiment of the present invention is shown;
[0053] Figure 6 One of the schematic block diagrams of a file online preview system according to an embodiment of the present invention is shown;
[0054] Figure 7 A second schematic block diagram of a file online preview system according to an embodiment of the present invention is shown;
[0055] Figure 8 A schematic block diagram of a computer device according to an embodiment of the present invention is shown;
[0056] Fig. 9 A schematic flow chart of a method for online previewing of a file according to a specific embodiment of the present invention is shown. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above aspects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0059] Refer to the following Figures 1 to 9 A method and system for online previewing of a file, a computer device, and a readable storage medium according to some embodiments of the present invention are described.
[0060] Example 1
[0061] The embodiment of the first aspect of the present invention provides a method for online preview of a file. Figure 1 A flowchart of a method for online previewing of a file according to an embodiment of the present invention is shown. The method for online previewing of a file includes:
[0062] Step S102, receiving document data input by the user, and sending the document data to the online editing server;
[0063] Step S104, caching the temporary files generated in the online editing server to the solid state drive;
[0064] Step S106, verifying the temporary file, and storing the temporary file in the file server according to the verification result;
[0065] Step S108, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue;
[0066] Step S110, the synchronization server processes the first message queue according to the stored timestamp to obtain a second message queue;
[0067] Step S112, the document conversion and rendering server generates an HTML online file according to the file message in the second message queue;
[0068] The ID of the temporary file is associated with the physical storage network address of the temporary file.
[0069] The file online preview method provided in this embodiment receives document data input by the user, sends the document data to the online editing server, and then caches the temporary files generated in the online editing server to the solid-state hard disk, verifies the temporary files, and stores the temporary files to the file server according to the verification results. In the process of high-frequency file updates, a large number of intermediate versions of files, namely temporary files, will be generated. The present invention avoids storing all temporary files to the file server by caching temporary files to the solid-state hard disk and then verifying and selectively storing the temporary files. While preventing useless temporary files from occupying the memory resources of the file server, it can also realize the timed update and synchronous storage of temporary files, ensuring that the temporary files stored to the file server are the latest versions of the files.
[0070] In a specific embodiment, the online document and the online editing server implement real-time transmission of document data through the socket communication principle.
[0071] Further, in the file online preview method provided in the present embodiment, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file. When multiple users edit and update the same file at the same time, due to problems such as network bandwidth delay, the timing of the final storage of the file will change, resulting in the final rendered file not being the latest version of the file. The present invention introduces the first message queue, sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue, and associates the ID of the temporary file with the physical storage network address of the temporary file, thereby pressing the storage time of the temporary file into the first message queue. In this way, when processing the temporary file stored in the file server, the latest version of the temporary file can be directly selected according to the storage time indicated by the storage timestamp, and then the corresponding file entity is obtained through the association between the ID of the temporary file and the physical storage network address of the temporary file. In this way, it is ensured that the processed file is the latest version of the file, the real-time performance of the file processing is ensured, and the requirements for high-frequency file updates are met.
[0072] Furthermore, in the file online preview method provided by the present embodiment, the synchronization server processes the first message queue according to the storage timestamp to obtain the second message queue, and then the document conversion rendering server generates an HTML online file according to the file message rendering in the second message queue. The storage timestamp indicates the storage time of the temporary file. By processing the first message queue to obtain the second message queue with the storage timestamp, the timing of the processing of the first message queue can be guaranteed, thereby ensuring the timing of the file messages in the second message queue. On this basis, the HTML online file is generated based on the file message rendering in the second message queue, which can ensure the timing of the file rendering, thereby ensuring that the rendered file is the latest file, realizing the real-time synchronous conversion rendering of the online file, ensuring that the file seen by the user is the latest version, reducing the economic loss of the user, and meeting the requirements of high-frequency file updates and online previews.
[0073] Preferably, in this embodiment, the HTML online file generated by rendering is a static HTML file. When multiple users update or preview the same file, the concurrency requirement for the file is high. If the concurrency is to be increased, more servers are needed to support it, which will cause unnecessary waste of resources. Static HTML files are excellent in supporting concurrency, distinguishing between file update requirements and preview requirements, and can achieve better business results at a lower cost.
[0074] Furthermore, in this embodiment, after the step of storing the temporary file in the file server according to the verification result, the file online preview method further includes: generating a physical storage network address and a storage timestamp for the temporary file stored in the file server.
[0075] In this embodiment, after the temporary file is stored in the file server, an entity storage network address and a storage timestamp are generated for the temporary file stored in the file server. The entity storage network address indicates the storage address of the file entity, and the corresponding file entity can be obtained through the entity storage network address. The storage timestamp indicates the storage time of the temporary file, and the file is processed based on the time indicated by the storage timestamp, which ensures the time sequence of file processing and meets the requirements of high-frequency file update and processing.
[0076] Furthermore, in this embodiment, after rendering and generating the HTML online file, the file online preview method may further include: displaying the HTML online file for the user to view.
[0077] Example 2
[0078] Figure 2 The second flowchart of the method for online file previewing in one embodiment of the present invention is shown. In this embodiment, the method for online file previewing includes:
[0079] Step S202, receiving document data input by the user, and sending the document data to the online editing server;
[0080] Step S204, caching the temporary files generated in the online editing server to the solid state drive;
[0081] Step S206, comparing the hash values of the current version of the temporary file with the previous version;
[0082] Step S208, if the Hash values are different, the temporary file is stored in the file server; if the Hash values are the same, the temporary file is abandoned;
[0083] Step S210, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue;
[0084] Step S212, the synchronization server processes the first message queue according to the stored timestamp to obtain a second message queue;
[0085] Step S214, the document conversion and rendering server generates an HTML online file according to the file message in the second message queue;
[0086] The ID of the temporary file is associated with the physical storage network address of the temporary file.
[0087] In this embodiment, the temporary file is verified, and the Hash value of the current version of the temporary file is compared with the previous version. When the Hash values of the two are different, the temporary file of the current version is stored in the file server, and when the Hash values of the two are the same, the storage of the temporary file of the current version is abandoned. The Hash value is a numerical value obtained by logical operation based on the content of the file. Different files (even with the same file name) have different Hash values, so the Hash value can be used as the "identity card" of the file. For files with the same Hash value, their contents must be exactly the same. Therefore, by storing temporary files with different Hash values of the current version and the previous version in the file server, it can be ensured that the files are stored only when they are updated, avoiding the storage of unchanged temporary files in the file server and occupying the memory resources of the file server. At the same time, it is also possible to realize the timed update and synchronous storage of temporary files, ensuring that the temporary files stored in the file server are the latest versions of the files.
[0088] In a specific embodiment, the file server is an IO-intensive file server, and temporary files are stored in the IO-intensive file server, so that the online editing server and the document conversion and rendering server can quickly obtain the required files through a dedicated network.
[0089] Example 3
[0090] Figure 3 The third flowchart of the method for online file previewing in one embodiment of the present invention is shown. In this embodiment, the method for online file previewing includes:
[0091] Step S302, receiving document data input by the user, and sending the document data to the online editing server;
[0092] Step S304, caching the temporary files generated in the online editing server to the solid state drive;
[0093] Step S306, verifying the temporary file, and storing the temporary file in the file server according to the verification result;
[0094] Step S308, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue;
[0095] Step S310, reading the file message in the first message queue to the third message queue;
[0096] Step S312, sending the latest file message in the third message queue to the second message queue at a preset time interval according to the storage timestamp, and / or sending the latest file message in the third message queue to the second message queue at a preset number of intervals according to the storage timestamp;
[0097] Step S314, the document conversion and rendering server generates an HTML online file according to the file message in the second message queue;
[0098] The ID of the temporary file is associated with the physical storage network address of the temporary file.
[0099] In this embodiment, the synchronization server reads the file message in the first message queue into the third message queue, and then sends the latest file message in the third message queue to the second message queue according to the preset time interval based on the storage timestamp. The file message in the first message queue indicates the temporary file stored in the file server. During the high-frequency update process of the file, a large number of temporary files will be generated. Even if the temporary files are selectively stored in the file server through screening, the number of temporary files stored in the file server is still large. The storage time of temporary files in the same time period is relatively close. When previewing the file, there is no need to process each temporary file. It is only necessary to process the last temporary file within the preset time interval according to the storage order of the temporary files. Therefore, by reading the file message in the first message queue into the third message queue, and then sending the latest file message in the third message queue to the second message queue according to the preset time interval, the file message in the first message queue can be screened, reducing the number of rendering times and saving memory resources.
[0100] In a specific embodiment, the preset time interval may be 5 seconds. Based on the storage timestamp, the synchronization server sends the latest file message in the third message queue to the second message queue every 5 seconds.
[0101] Furthermore, in this embodiment, the latest file message in the third message queue can also be sent to the second message queue according to the storage timestamp at a preset number of intervals. The storage time of temporary files in the same batch is relatively close. In order to reduce resource waste, when previewing files, the last temporary file of the same batch can be processed at a preset number of intervals. Therefore, by reading the file messages in the first message queue to the third message queue, and then sending the latest file messages in the third message queue to the second message queue at a preset number of intervals, the file messages in the first message queue can also be screened, reducing the number of rendering times and saving memory resources.
[0102] In a specific embodiment, the preset number interval may be 20. Based on the storage timestamp, the synchronization server sends the latest file message in the third message queue to the second message queue every 20 file messages.
[0103] Example 4
[0104] Figure 4 A fourth flowchart of a method for online previewing of a file in an embodiment of the present invention is shown. In this embodiment, the method for online previewing of a file includes:
[0105] Step S402, receiving document data input by the user, and sending the document data to the online editing server;
[0106] Step S404, caching the temporary files generated in the online editing server to the solid state drive;
[0107] Step S406, verifying the temporary file, and storing the temporary file in the file server according to the verification result;
[0108] Step S408, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue;
[0109] Step S410, the synchronization server processes the first message queue according to the stored timestamp to obtain a second message queue;
[0110] Step S412, obtaining the file entity from the file server according to the file message in the second message queue;
[0111] Step S414, obtaining the CPU usage rate, comparing the CPU usage rate with a preset threshold, and rendering the file entity according to the comparison result;
[0112] Step S416, if the CPU usage is less than the preset threshold, then increase the frequency of rendering the file entity; if the CPU usage is greater than the preset threshold, then reduce the frequency of rendering the file entity;
[0113] The ID of the temporary file is associated with the physical storage network address of the temporary file.
[0114] In this embodiment, the file entity is obtained from the file server according to the file message in the second message queue. The file message in the second message queue is a filtered file message, which contains the ID of the temporary file stored in the file server and the storage timestamp. The ID of the temporary file is associated with the physical storage network address of the temporary file. In this way, the file messages in the second message queue are processed in sequence based on the storage timestamp to obtain the ID of the corresponding temporary file, and then the corresponding file entity is obtained from the file server based on the association between the ID of the temporary file and the physical storage network address. In this way, the sequentiality and selectivity of the acquisition of the file entity are guaranteed, and while the real-time rendering of the file entity is guaranteed, memory resources are saved.
[0115] Furthermore, in this embodiment, before rendering the file entity, the CPU usage is obtained, the CPU usage is compared with a preset threshold, and the file entity is rendered according to the comparison result. When the CPU usage is less than the preset threshold, that is, the CPU usage is low, the frequency of rendering the file entity is increased, and multiple rendering operations are performed. When the CPU usage is greater than the preset threshold, that is, the CPU usage is high, the frequency of rendering the file entity is reduced. Specifically, the queuing time of the file entity rendering queue is increased, and after squeezing out a certain amount of file entities, the latest version of the file entity is selected for rendering. In this way, an on-demand dynamic rendering mechanism is adopted, and the frequency of rendering operations can be flexibly changed according to the CPU usage, thereby avoiding the conversion and rendering of too many unnecessary files, reducing unnecessary file rendering overhead, saving CPU memory resources, and ensuring the high availability of the document conversion and rendering server.
[0116] In a specific embodiment, the CPU usage rate can be calculated through files such as / proc / stat in the Linux system.
[0117] Example 5
[0118] Figure 5 A fourth flowchart of a method for online previewing of a file in an embodiment of the present invention is shown. In this embodiment, the method for online previewing of a file includes:
[0119] Step S502, receiving document data input by the user, and sending the document data to the online editing server;
[0120] Step S504, caching the temporary files generated in the online editing server to the solid state drive;
[0121] Step S506, comparing the hash values of the current version of the temporary file with the previous version;
[0122] Step S508, if the Hash values are different, the temporary file is stored in the file server; if the Hash values are the same, the temporary file is abandoned;
[0123] Step S510, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue;
[0124] Step S512, reading the file message in the first message queue to the third message queue;
[0125] Step S514, sending the latest file message in the third message queue to the second message queue at a preset time interval according to the storage timestamp, and / or sending the latest file message in the third message queue to the second message queue at a preset number of intervals according to the storage timestamp;
[0126] Step S516, obtaining the file entity from the file server according to the file message in the second message queue;
[0127] Step S518, obtaining the CPU usage rate, comparing the CPU usage rate with a preset threshold, and rendering the file entity according to the comparison result;
[0128] Step S520, if the CPU usage is less than a preset threshold, then increase the frequency of rendering the file entity; if the CPU usage is greater than the preset threshold, then reduce the frequency of rendering the file entity;
[0129] The ID of the temporary file is associated with the physical storage network address of the temporary file.
[0130] In this embodiment, after step S508, the file online preview method may further include: generating a physical storage network address and a storage timestamp for the temporary file stored in the file server.
[0131] Furthermore, in this embodiment, after step S520, the file online preview method may further include: displaying the HTML online file for the user to view.
[0132] In a specific embodiment, Fig. 9 A schematic flow chart of a method for online previewing of a file according to a specific embodiment of the present invention is shown.
[0133] like Fig. 9As shown, multiple users, i.e., a multi-person editing group, jointly edit the same file through an online document, and the online document sends the document data entered by the user to the online editing server. In the above process, a large number of intermediate versions of files, i.e., temporary files, will be generated, and a large number of temporary files generated in the online editing server will be cached through a solid-state hard drive. At the same time, the temporary file is verified, and when the temporary file is updated compared to its previous version, the temporary file is stored in the file server, and the storage timestamp and physical storage network address of the temporary file are generated at the same time. Afterwards, the first message queue is introduced, and the ID and storage timestamp of the temporary file stored in the file server are sent to the first message queue through the online editing server, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file. Furthermore, the synchronization server reads the file message in the first message queue into its local message queue, i.e., the third message queue, and sends the latest file message in the third message queue to the second message queue at a preset time interval or a preset number of intervals, thereby completing the "filtering" of the first message queue. Furthermore, the document conversion rendering server reads the file messages from the second message queue in order based on the storage timestamp, obtains the corresponding file entity from the file server according to the temporary file ID indicated by the file message and the entity storage network address associated therewith, and performs rendering conversion on it. Finally, the online document displays the rendered online file for viewing by multiple users, i.e., the multi-user preview group.
[0134] Example 6
[0135] An embodiment of the second aspect of the present invention provides a file online preview system. Figure 6 One of the schematic block diagrams of a file online preview system according to an embodiment of the present invention is shown. In this embodiment, the file online preview system 600 includes:
[0136] A receiving unit 602 is used to receive document data input by a user and send the document data to an online editing server; a caching unit 604 is used to cache temporary files generated in the online editing server to a solid state drive; a verification unit 606 is used to verify the temporary files and store the temporary files to the file server according to the verification result; a first processing unit 608 is used for the online editing server to send the ID and storage timestamp of the temporary file stored in the file server to the first message queue, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file; a second processing unit 610 is used for the synchronization server to process the first message queue according to the storage timestamp to obtain a second message queue; a rendering unit 612 is used for the document conversion rendering server to render and generate an HTML online file according to the file message in the second message queue.
[0137] The file online preview system 600 provided in this embodiment receives the document data input by the user through the receiving unit 602, sends the document data to the online editing server, and then caches the temporary files generated in the online editing server to the solid state drive through the cache unit 604, and verifies the temporary files through the verification unit 606, and stores the temporary files to the file server according to the verification results. In the process of high-frequency file updates, a large number of intermediate versions of files, namely temporary files, will be generated. The present invention uses the cache unit 604 to cache temporary files to the solid state drive, and then verifies and selectively stores the temporary files through the verification unit 606, avoiding the storage of all temporary files to the file server. While preventing useless temporary files from occupying the memory resources of the file server, it can also realize the timed update and synchronous storage of temporary files, ensuring that the temporary files stored to the file server are the latest versions of the files.
[0138] In a specific embodiment, the online document and the online editing server implement real-time transmission of document data through the socket communication principle.
[0139] Further, in the file online preview system 600 provided in the present embodiment, the online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue through the first processing unit 608, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file. When multiple users edit and update the same file at the same time, due to problems such as network bandwidth delay, the timing of the final storage of the file will change, resulting in the final rendered file not being the latest version of the file. The present invention introduces the first message queue by using the first processing unit 608, sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue, and associates the ID of the temporary file with the physical storage network address of the temporary file, thereby pressing the storage time of the temporary file into the first message queue. In this way, when processing the temporary file stored in the file server, the latest version of the temporary file can be directly selected according to the storage time indicated by the storage timestamp, and then the corresponding file entity is obtained through the association between the ID of the temporary file and the physical storage network address of the temporary file. In this way, it is ensured that the processed file is the latest version of the file, the real-time performance of the file processing is ensured, and the requirement of high-frequency file update is met.
[0140] Furthermore, the file online preview system 600 provided in this embodiment enables the synchronization server to process the first message queue according to the storage timestamp to obtain the second message queue through the second processing unit 610, and then enables the document conversion rendering server to generate an HTML online file according to the file message rendering in the second message queue through the rendering unit 612. The storage timestamp indicates the storage time of the temporary file. The first message queue is processed based on the storage timestamp to obtain the second message queue, which can ensure the timing of the processing of the first message queue, thereby ensuring the timing of the file message in the second message queue. On this basis, the HTML online file is generated based on the file message rendering in the second message queue, which can ensure the timing of the file rendering, thereby ensuring that the rendered file is the latest file, realizing the real-time synchronous conversion rendering of the online file, ensuring that the file seen by the user is the latest version, reducing the economic loss of the user, and meeting the requirements of high-frequency file updates and online previews.
[0141] Preferably, in this embodiment, the HTML online file generated by rendering is a static HTML file. When multiple users update or preview the same file, the concurrency requirement for the file is high. If the concurrency is to be increased, more servers are needed to support it, which will cause unnecessary waste of resources. Static HTML files are excellent in supporting concurrency, distinguishing between file update requirements and preview requirements, and can achieve better business results at a lower cost.
[0142] Furthermore, in this embodiment, the file online preview system 600 may also include a generating unit, which is used to generate a physical storage network address and a storage timestamp for the temporary file stored in the file server.
[0143] In this embodiment, a physical storage network address and a storage timestamp are generated for a temporary file stored in a file server by a generation unit. The physical storage network address indicates the storage address of the file entity, and the corresponding file entity can be obtained through the physical storage network address. The storage timestamp indicates the storage time of the temporary file, and the file is processed based on the time indicated by the storage timestamp, which ensures the time sequence of file processing and meets the requirements of high-frequency file update and processing.
[0144] Furthermore, in this embodiment, the file online preview system 600 may also include a display unit for displaying HTML online files for users to view.
[0145] Example 7
[0146] In this embodiment, based on Embodiment 6, the verification unit 606 is specifically used for:
[0147] Compare the hash values of the current version of the temporary file with the previous version; if the hash values are different, store the temporary file to the file server; if the hash values are the same, give up storing the temporary file.
[0148] In this embodiment, the Hash value of the current version of the temporary file is compared with the previous version through the verification unit 606. When the Hash values of the two are different, the temporary file of the current version is stored in the file server, and when the Hash values of the two are the same, the temporary file of the current version is abandoned. The Hash value is a numerical value obtained by logical operation based on the content of the file. Different files (even with the same file name) have different Hash values, so the Hash value can be used as the "identity card" of the file. For files with the same Hash value, their contents must be exactly the same. Therefore, the Hash value of the current version of the temporary file is compared with the previous version through the verification unit 606, and the temporary file with different Hash values of the current version and the previous version is stored in the file server, which can ensure that the file is stored only when it is updated, avoiding the storage of unchanged temporary files in the file server and occupying the memory resources of the file server. At the same time, the timed update and synchronous storage of temporary files can also be realized, ensuring that the temporary files stored in the file server are the latest versions of the files.
[0149] In a specific embodiment, the file server is an IO-intensive file server, and temporary files are stored in the IO-intensive file server, so that the online editing server and the document conversion and rendering server can quickly obtain the required files through a dedicated network.
[0150] Example 8
[0151] In this embodiment, based on Embodiment 6, the second processing unit 610 is specifically configured to:
[0152] Read the file message in the first message queue to the third message queue; send the latest file message in the third message queue to the second message queue at a preset time interval based on the storage timestamp; and / or send the latest file message in the third message queue to the second message queue at a preset number of intervals based on the storage timestamp.
[0153] In this embodiment, the file message in the first message queue is read to the third message queue by the second processing unit 610, and then the latest file message in the third message queue is sent to the second message queue according to the preset time interval based on the storage timestamp. The file message in the first message queue indicates the temporary file stored in the file server. During the high-frequency update process of the file, a large number of temporary files will be generated. Even if the temporary files are selectively stored in the file server through screening, the number of temporary files stored in the file server is still large. The storage time of temporary files in the same time period is relatively close. When previewing the file, it is not necessary to process each temporary file. It is only necessary to process the last temporary file in the preset time interval according to the storage order of the temporary files. Therefore, the file message in the first message queue is read to the third message queue by the second processing unit 610, and then the latest file message in the third message queue is sent to the second message queue according to the preset time interval, which can play a role in screening the file messages in the first message queue, reduce the number of rendering times, and save memory resources.
[0154] In a specific embodiment, the preset time interval may be 5 seconds. Based on the storage timestamp, the synchronization server sends the latest file message in the third message queue to the second message queue every 5 seconds.
[0155] Furthermore, in this embodiment, the second processing unit 610 can also be used to send the latest file message in the third message queue to the second message queue according to the storage timestamp and at a preset number of intervals. The storage time of temporary files in the same batch is relatively close. In order to reduce resource waste, when previewing files, the last temporary file of the same batch can be processed at a preset number of intervals. Therefore, the second processing unit 610 reads the file message in the first message queue to the third message queue, and then sends the latest file message in the third message queue to the second message queue at a preset number of intervals. This can also play a role in screening the file messages in the first message queue, reducing the number of rendering times and saving memory resources.
[0156] In a specific embodiment, the preset number interval may be 20. Based on the storage timestamp, the synchronization server sends the latest file message in the third message queue to the second message queue every 20 file messages.
[0157] Example 9
[0158] Figure 7 The second schematic block diagram of the file online preview system according to an embodiment of the present invention is shown. In this embodiment, based on the embodiment 6, the rendering unit 612 in the file online preview system 600 includes:
[0159] A first acquiring unit 6122 is used to acquire a file entity from a file server according to the file information in the second message queue;
[0160] The second acquisition unit 6124 is used to acquire the CPU usage rate;
[0161] The third processing unit 6126 is used to compare the CPU usage with a preset threshold value and render the file entity according to the comparison result;
[0162] The third processing unit 6126 is specifically configured to increase the frequency of rendering the file entity if the CPU usage is less than a preset threshold, and to reduce the frequency of rendering the file entity if the CPU usage is greater than the preset threshold.
[0163] In this embodiment, the first acquisition unit 6122 acquires the file entity from the file server according to the file message in the second message queue. The file message in the second message queue is a filtered file message, which includes the ID of the temporary file stored in the file server and the storage timestamp. The ID of the temporary file is associated with the physical storage network address of the temporary file. In this way, the file messages in the second message queue are processed in sequence based on the storage timestamp to acquire the ID of the corresponding temporary file, and then the corresponding file entity is acquired from the file server based on the association between the ID of the temporary file and the physical storage network address. In this way, the sequentiality and selectivity of the acquisition of the file entity are guaranteed, and while the real-time rendering of the file entity is guaranteed, memory resources are saved.
[0164] Furthermore, in this embodiment, before rendering the file entity, the CPU usage rate is also obtained through the second acquisition unit 6124, and the CPU usage rate is compared with a preset threshold value through the third processing unit 6126, and the file entity is rendered according to the comparison result. When the CPU usage rate is less than the preset threshold value, that is, the CPU usage rate is low, the frequency of rendering the file entity is increased, and multiple rendering operations are performed. When the CPU usage rate is greater than the preset threshold value, that is, the CPU usage rate is high, the frequency of rendering the file entity is reduced. Specifically, the queuing time of the file entity rendering queue is increased, and after squeezing a certain amount of file entities, the latest version of the file entity is selected for rendering. In this way, an on-demand dynamic rendering mechanism is adopted, and the frequency of rendering operations is flexibly changed according to the CPU usage, thereby avoiding the conversion and rendering of too many unnecessary files, reducing unnecessary file rendering overhead, saving CPU memory resources, and ensuring the high availability of the document conversion and rendering server.
[0165] In a specific embodiment, the CPU usage rate can be calculated through files such as / proc / stat in the Linux system.
[0166] Example 10
[0167] An embodiment of a third aspect of the present invention provides a computer device. Figure 8 A schematic block diagram of a computer device according to an embodiment of the present invention is shown. In this embodiment, the computer device 700 includes:
[0168] The file online preview system 600 of any of the above embodiments;
[0169] Memory 702, in which a computer program is stored;
[0170] Processor 704 implements the steps of the file online preview method of any of the above embodiments when the processor executes the computer program.
[0171] The computer device 700 provided in this embodiment includes the online file preview system 600 of any of the above embodiments. Therefore, it has all the beneficial effects of the online file preview system 600 of any of the above embodiments, which will not be described in detail here.
[0172] Furthermore, the computer device 700 provided in this embodiment includes a memory 702 and a processor 704. The memory 702 stores a computer program that can be executed by the processor 704. When the computer program is executed by the processor 704, the steps of the online file preview method of any of the above embodiments can be implemented. Therefore, the computer device 700 has all the beneficial effects of the online file preview method of any of the above embodiments, which will not be described in detail here.
[0173] Embodiment 11
[0174] An embodiment of the fourth aspect of the present invention provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the file online preview method in any of the above embodiments are implemented.
[0175] The readable storage medium provided in this embodiment stores a computer program, and when the computer program is executed by a processor, the steps of the online file preview method in any of the above embodiments are implemented. Therefore, the readable storage medium has all the beneficial effects of the online file preview method in any of the above embodiments, which will not be described in detail here.
[0176] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0177] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for online previewing of a file, characterized in that: include: Receiving document data input by a user, and sending the document data to an online editing server; Cache the temporary files generated in the online editing server to the solid state drive; Verifying the temporary file, and storing the temporary file in a file server according to the verification result; The online editing server sends the ID and storage timestamp of the temporary file stored in the file server to the first message queue, wherein the ID of the temporary file is associated with the physical storage network address of the temporary file; The synchronization server processes the first message queue according to the storage timestamp to obtain a second message queue; The document conversion and rendering server generates an HTML online file according to the file message in the second message queue; The step of the synchronization server processing the first message queue according to the storage timestamp to obtain the second message queue specifically includes: Reading the file message in the first message queue to a third message queue; According to the storage timestamp, sending the latest file message in the third message queue to the second message queue at a preset time interval; and / or According to the storage timestamp, the latest file message in the third message queue is sent to the second message queue at a preset number of intervals.
2. The method for online previewing of a file according to claim 1, characterized in that: After the step of storing the temporary file in the file server according to the verification result, the method further includes: The physical storage network address and the storage timestamp are generated for the temporary file stored in the file server.
3. The method for online file preview according to claim 1, characterized in that: The step of verifying the temporary file and storing the temporary file in the file server according to the verification result specifically includes: Compare the hash values of the current version of the temporary file with the previous version; If the hash values are different, the temporary file is stored in the file server; if the hash values are the same, the temporary file is abandoned.
4. The method for online previewing of a file according to claim 1, characterized in that: The step of generating an HTML online file by rendering the document conversion and rendering server according to the file message in the second message queue specifically includes: According to the file message in the second message queue, obtaining a file entity from the file server; Obtaining a CPU usage rate, comparing the CPU usage rate with a preset threshold, and rendering the file entity according to the comparison result; If the CPU usage is less than a preset threshold, the frequency of rendering the file entity is increased; if the CPU usage is greater than the preset threshold, the frequency of rendering the file entity is reduced.
5. A file online preview system, characterized in that: include: A receiving unit, configured to receive document data input by a user and send the document data to an online editing server; A cache unit, used for caching temporary files generated in the online editing server to a solid state drive; A verification unit, used for verifying the temporary file and storing the temporary file in a file server according to the verification result; A first processing unit, configured for the online editing server to send the ID and storage timestamp of the temporary file stored in the file server to a first message queue, wherein the ID of the temporary file is associated with a physical storage network address of the temporary file; A second processing unit, configured to synchronize the server to process the first message queue according to the storage timestamp to obtain a second message queue; A rendering unit, used for the document conversion rendering server to render and generate an HTML online file according to the file message in the second message queue; The second processing unit is specifically configured to: Reading the file message in the first message queue to a third message queue; According to the storage timestamp, sending the latest file message in the third message queue to the second message queue at a preset time interval; and / or According to the storage timestamp, the latest file message in the third message queue is sent to the second message queue at a preset number of intervals.
6. The file online preview system according to claim 5, characterized in that: The system further comprises: A generating unit is used to generate the physical storage network address and the storage timestamp for the temporary file stored in the file server.
7. The file online preview system according to claim 5, characterized in that: The verification unit is specifically used for: Compare the hash values of the current version of the temporary file with the previous version; If the hash values are different, the temporary file is stored in the file server; if the hash values are the same, the temporary file is abandoned.
8. The file online preview system according to claim 5, characterized in that: The rendering unit comprises: A first acquiring unit, configured to acquire a file entity from the file server according to the file information in the second message queue; The second acquisition unit is used to acquire the CPU usage rate; A third processing unit, used for comparing the CPU usage with a preset threshold value, and rendering the file entity according to the comparison result; The third processing unit is specifically configured to increase the frequency of rendering the file entity if the CPU usage is less than a preset threshold, and to reduce the frequency of rendering the file entity if the CPU usage is greater than the preset threshold.
9. A computer device, characterized in that: include: The file online preview system according to any one of claims 5 to 8; A memory having a computer program stored therein; A processor, wherein when executing the computer program, the processor implements the steps of the file online preview method according to any one of claims 1 to 5.
10. A readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the steps of the file online preview method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Telephone traffic data storage method and system
CN102118268A
Method of cooperatively editing shared file, server and user side
CN104717239A