File system, method and device applied to modern browser

By introducing a union file system and shared data instances in the browser environment, the code modification problem during the migration of client-side mini-programs/mini-games was solved, achieving zero-change portability of the file system and consistency of permission management, ensuring the normal operation of mini-programs/mini-games in the browser.

CN121144260APending Publication Date: 2025-12-16ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511292659.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-10
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

In existing technologies, when migrating client-side mini-programs/mini-games to a browser environment, significant code modifications are required to adapt to the browser's file system, making zero-change migration impossible, and file system read/write permission management is complex.

Method used

This paper provides a modern browser file system architecture, including a storage layer and a service layer. It merges temporary and persistent file system instances through a union file system, sets the access priority of the persistent file system to be higher than that of the temporary file system, exposes a unified API to realize directory access, and combines shared data instances of the browser's main thread and worker threads for synchronous operations.

Benefits of technology

It achieves zero-change portability of the file system in the browser environment, maintains consistency in read and write permission management of the file system, solves the complex problem of temporary and persistent files in a single directory, and realizes seamless migration of client-side mini-programs/mini-games.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121144260A_ABST
    Figure CN121144260A_ABST
Patent Text Reader

Abstract

One or more embodiments of the invention provide a file system, method and device applied to a modern browser. The file system comprises a storage layer and a service layer, and the storage layer comprises a running memory and a source private file system; the service layer comprises a joint file system, and the joint file system is obtained by combining a temporary file system instance and a persistent file system instance; wherein a first file directory which is realized by relying on a running memory is created under the temporary file system instance, a second file directory which is realized by relying on a source private file system is created under the persistent file system instance, and access paths of the first file directory and the second file directory are the same. The access priority of the persistent file system instance is higher than that of the temporary file system instance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to one or more embodiments in the field of modern browser technology, and more particularly to a file system, method, and apparatus for use in modern browsers. Background Technology

[0002] With the continued maturation of the mobile internet ecosystem, mini-program / mini-game platforms, relying on super apps such as social apps and payment apps, have become the core distribution carriers for lightweight applications. To balance application performance, operational security, and ecosystem management, these platforms have generally built a deeply customized file system API, which is responsible for file management such as data storage, reading, updating, and caching.

[0003] Currently, when developers develop mini-programs / mini-games for client environments, they can directly use the toolchain provided by the platform to complete development, debugging, and building without additional adaptation to underlying capabilities. However, when it is necessary to migrate mini-programs / mini-games to browser environments, because browser environments follow Web standards and have fundamental differences from the custom file system APIs of client platforms, developers have to make significant additional modifications to the mini-program / mini-game code to adapt to the file system in browser environments.

[0004] Therefore, how to achieve "zero-change porting" of client-side mini-programs / mini-games to modern browsers, and implement a file management system API in the browser environment that is completely consistent with the runtime of client-side mini-games, has become a core problem that urgently needs to be solved in the current cross-platform mini-program / mini-game development field. Summary of the Invention

[0005] To achieve "zero-change porting" of client-side mini-programs / mini-games to modern browsers, one or more embodiments of this specification provide a file system, method, and apparatus applicable to modern browsers.

[0006] Firstly, one or more embodiments of this specification provide a file system for use in modern browsers, the file system comprising: The storage layer includes running memory and the source private file system; The service layer includes a union file system, which is obtained by merging a temporary file system instance and a persistent file system instance. The temporary file system instance creates a first file directory that is implemented in the runtime memory, and the persistent file system instance creates a second file directory that is implemented in the source private file system. The access paths of the first file directory and the second file directory are the same, and the access priority of the persistent file system instance is higher than that of the temporary file system instance.

[0007] In one possible implementation, the file system also includes an adaptation layer for adapting the APIs of the service layer to the file system APIs of the client's mini-program.

[0008] In one possible implementation, a temporary file system instance creates a game code file directory and a temporary file directory that rely on runtime memory, while a persistent file system instance creates a user file directory and a cache file directory that rely on the source private file system. The temporary file directory is the first file directory, and the cache file directory is the second file directory.

[0009] Secondly, one or more embodiments of this specification also provide a file operation method applied to a modern browser, the method being implemented based on a file system as described in any of the first aspects, the method comprising: Receive a read data request, which is used to request the reading of data from the first access directory; In response to receiving a read data request, retrieve the first access directory in the persistent file system instance; If the first access directory is not found in the persistent file system instance, the first access directory is retrieved in the temporary file system instance. Receive a write data request, which is used to request that target data be written to the second access directory; In response to receiving a write data request, the target data is written to the second access directory in the persistent file system instance.

[0010] One possible implementation method also includes: Create the browser's main thread and worker threads; Establish a communication connection between the browser's main thread and worker threads; Create a shared data instance, which is used for data sharing between the browser's main thread and worker threads; In response to receiving a data synchronization request for the source private file system, the browser's main thread inputs the data synchronization request information to the shared data instance. When a worker thread detects a data synchronization request from a shared data instance, it calls the source private file system to obtain the response data corresponding to the data synchronization request. The worker thread inputs response information to the shared data instance; the response information includes response data. When the browser's main thread detects input response information from the shared data instance, it retrieves the response data from the shared data instance through the browser's main thread.

[0011] In one possible implementation, after inputting data synchronization request information to the shared data instance via the browser's main thread, the method further includes: Wake up worker threads by calling a notification function on the browser's main thread; The browser's main thread detects whether worker threads are inputting response information in the shared data instance.

[0012] In one possible implementation, the shared data instance adopts a structure that includes a header and a body; This includes inputting data synchronization request information to the shared data instance via the browser's main thread, including: The browser's main thread changes the first element in the header of the shared data instance from 0 to 1, and expresses the data synchronization request information in the body of the shared data instance. This includes inputting response information to the shared data instance through worker threads, including: The worker thread changes the first element in the message header from 1 to 0, and then expresses the response data in the message body.

[0013] In one possible implementation, when a worker thread detects a data synchronization request from a shared data instance, it calls the source private file system to obtain the response data corresponding to the data synchronization request, including: When the worker thread detects that the first element in the header has changed from 0 to 1, it calls the source private file system to obtain the response data corresponding to the data synchronization request information. When the browser's main thread detects that the first element in the message header has changed from 1 to 0, it retrieves the response data from the message body through the browser's main thread.

[0014] Thirdly, one or more embodiments of this specification also provide a file manipulation apparatus for use in modern browsers, the apparatus comprising: The first receiving module is used to receive read data requests, which are used to request the reading of data from the first access directory. The first retrieval module is used to retrieve the first access directory in the persistent file system instance in response to receiving a read data request; The second retrieval module is used to retrieve the first access directory in a temporary file system instance if the first access directory is not found in the persistent file system instance. The second receiving module is used to receive write data requests, which are used to request the writing of target data to the second access directory. The write module is used to respond to a write data request by writing the target data to the second access directory in the persistent file system instance.

[0015] In one possible implementation, the apparatus further includes: a synchronization module for creating a browser main thread and worker threads; establishing a communication connection between the browser main thread and worker threads; creating a shared data instance for sharing data between the browser main thread and worker threads; responding to receiving a data synchronization request for a source private file system, inputting data synchronization request information to the shared data instance through the browser main thread; when a worker thread detects that the shared data instance has input data synchronization request information, calling the source private file system through the worker thread to obtain response data corresponding to the data synchronization request information; inputting response information to the shared data instance through the worker thread, the response information including response data; and when the browser main thread detects that the shared data instance has input response information, retrieving response data from the shared data instance through the browser main thread.

[0016] In one possible implementation, the synchronization module is also used to: wake up the worker thread by calling a notification function through the browser's main thread; and detect whether the worker thread has entered response information in the shared data instance through the browser's main thread.

[0017] In one possible implementation, the shared data instance adopts a structure including a header and a body; wherein, the synchronization module is used to input data synchronization request information to the shared data instance through the browser's main thread, specifically: The browser's main thread changes the first element in the header of the shared data instance from 0 to 1, and expresses the data synchronization request information in the body of the shared data instance. The synchronization module is used to input response information to the shared data instance through worker threads. The response information includes response data, specifically: The worker thread changes the first element in the message header from 1 to 0, and then expresses the response data in the message body.

[0018] In one possible implementation, the synchronization module, when a worker thread detects a data synchronization request from a shared data instance, retrieves the response data corresponding to the data synchronization request by calling the source private file system. Specifically: When the worker thread detects that the first element in the header has changed from 0 to 1, it calls the source private file system to obtain the response data corresponding to the data synchronization request information. When the browser's main thread detects that the first element in the message header has changed from 1 to 0, it retrieves the response data from the message body through the browser's main thread.

[0019] Fourthly, one or more embodiments of this specification also provide an electronic device, which includes a memory and a processor; the memory is used to store a computer program product; the processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, it implements the file operation method of the second aspect described above applied to a modern browser.

[0020] Fifthly, one or more embodiments of this specification also provide a computer-readable storage medium storing computer program instructions that, when executed, implement the file operation method of the second aspect described above applied to a modern browser.

[0021] In summary, one or more embodiments of this specification provide a file system, method, and apparatus for use in modern browsers. The method is based on a file system implemented in a modern browser, in which temporary file system instances and persistent file system instances are physically isolated internally, maintaining their respective unique capabilities. For example, the persistent file system instance is used to store files that need to be retained long-term, while the temporary file system instance is used to store temporary files. Furthermore, by setting the access priority of the persistent file system instance higher than that of the temporary file system instance, the access permissions of directories under the persistent file system instance can be writable, while the access permissions of directories under the temporary file system instance can be read-only. Externally, an API is exposed, so that without changing the code of the mini-program or mini-game, a single access path can be used to access directories under both the temporary and persistent file system instances. This solves the complex problems of file system read / write permission management and the simultaneous existence of temporary and persistent files in a single directory in a browser environment, further achieving the goal of porting client-provided mini-programs or mini-games to modern browsers with zero changes. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of one or more embodiments of this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of one or more embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 A schematic diagram of a client-side mini-game file system provided for one or more embodiments of this specification; Figure 2 This specification provides an architecture diagram of a file system applied to a modern browser, for one or more embodiments. Figure 3 A flowchart illustrating a file manipulation method applied to a modern browser, provided for one or more embodiments of this specification; Figure 4 A flowchart illustrating yet another file manipulation method applied to a modern browser, provided for one or more embodiments of this specification; Figure 5 A scenario diagram illustrating communication between the browser's main thread and worker threads through a shared data instance, provided for one or more embodiments of this specification; Figure 6 A structural block diagram of a file manipulation device applied to a modern browser, provided for one or more embodiments of this specification; Figure 7 This is a structural block diagram of an electronic device provided for one or more embodiments of this specification. Detailed Implementation

[0024] The present specification describes one or more embodiments in further detail below with reference to the accompanying drawings and examples. Through these descriptions, the features and advantages of one or more embodiments of the present specification will become clearer and more apparent.

[0025] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments. Although various aspects of embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless specifically indicated otherwise.

[0026] Furthermore, the technical features described below in one or more embodiments of this specification may be combined with each other as long as they do not conflict with each other.

[0027] To facilitate understanding, the technical names involved in one or more embodiments of this specification will be explained below.

[0028] 1. Modern browsers: These are browsers that support the latest web standards (such as HTML5, CSS3, JavaScript ES6+, etc.), have high-performance rendering engines, and are continuously updated to adapt to new technologies. They are the foundational tools for building modern web pages and web applications, providing a smoother user experience, stronger security, and compatibility with emerging features.

[0029] 2. Mini Programs: These are lightweight application forms that run on a parent platform (such as social software, browsers, etc.) without requiring separate download and installation. Their core goal is to break down the barrier of "app download and installation," allowing users to quickly obtain tools, services, or content through "search and use instantly" and "click and use instantly," while reducing the development and distribution costs for developers.

[0030] 3. Mini-games: These are lightweight game applications that run on a parent platform (such as social software, browsers, etc.) without requiring separate download and installation.

[0031] It should be noted that, in some classification methods, mini-games can also be classified as a type of mini-program, and this specification does not limit this in one or more embodiments.

[0032] 4. File system: It is the core component of the operating system (OS) responsible for managing and organizing data on storage devices, providing data creation, reading, writing, deletion, access control and other operation capabilities.

[0033] It should be noted that the technical solutions provided in one or more embodiments of this specification can be adapted to both mini-programs and mini-games. The following description uses an application to a mini-game scenario as an example.

[0034] To facilitate understanding, the application scenarios of the technical solutions provided in one or more embodiments of this specification will be described below.

[0035] In scenarios where it's necessary to port client-side mini-games to modern browsers, the goal is to achieve this without altering the mini-game's code.

[0036] A key aspect of the aforementioned zero-change porting process is ensuring consistency in file management operations across both ends, meaning implementing a file system with the same capabilities in modern browsers as on the client side. In other words, using the client-side game's file system as a reference standard, the same capabilities are implemented in modern browsers.

[0037] The following describes the characteristics of the client's mini-game file system.

[0038] The client's mini-game file system should include at least the following features: 1. Enable access to both temporary and persistent files within the same access path (e.g., https: / / resource).

[0039] 2. Temporary files and persistent files have different read and write permissions.

[0040] For example, such as Figure 1As shown, the file types in the client-side mini-game file system are divided into game code files, temporary files, cache files, and user files. Among them, temporary files, cache files, and user files are all local files.

[0041] The access methods and permission controls for the above-mentioned file types are as follows: Game code files are temporary files, and their access permissions are read-only.

[0042] Temporary files are temporary files that are accessed via the file virtualization protocol https: / / resource. Their access permissions are read-only, and they are automatically destroyed each time the game is exited.

[0043] The cached file is a persistent file, operated via the file virtual protocol https: / / resource, and has write permissions, supporting persistent storage.

[0044] User files are persistent files, accessed via the file virtual protocol https: / / user, and have write permissions, supporting persistent storage.

[0045] Regarding file operation mechanisms, the game code files and temporary files are written by the mini-game runtime framework, while the game itself only has read permissions. The core responsibilities of the runtime framework include: using the file system API to decompress the game code package to the file system, providing basic resources for game operation; and storing files obtained through APIs such as file download and image saving in a unified temporary directory.

[0046] For mini-game code, synchronous or asynchronous file operation APIs can be called during runtime, including file reading and writing, copying, directory creation, and compressed file decompression. Among them, write operations such as file writing, copying, and decompression need to be persistently stored to ensure that users can reuse the results of previous operations when accessing the game later, thus maintaining good performance. For read operations such as file reading, directory access, and resource existence checks, access to both temporary and persistent directories must be supported to ensure the integrity of resource acquisition.

[0047] It should be noted that in a client-side environment, the development, debugging, and construction of the aforementioned mini-game file system can be directly completed using the toolchain provided by the platform. However, in a browser-based environment, because browsers adhere to Web standards, there are fundamental differences between the browser environment and the client-side platform's custom file system API. Therefore, developers currently have to make significant additional modifications to the mini-game code to adapt it to the browser-based file system.

[0048] In order to implement a file system with the above-mentioned characteristics on a modern browser without modifying the game code, one or more embodiments of this specification provide a new file system architecture that is applied to the file system of a modern browser.

[0049] Figure 2 This specification provides an architecture diagram of a file system applied to a modern browser, for one or more embodiments.

[0050] like Figure 2 As shown, one or more embodiments of this specification provide a file system for use in modern browsers, which may include a storage layer and a service layer.

[0051] The storage layer can include RAM and a source private file system. RAM enables the storage of temporary files (also known as memory-based files), while the source private file system enables the storage of persistent files.

[0052] For example, runtime memory is used to store game code files and temporary files. Runtime memory destroys the temporarily stored game code files and temporary files when the page is closed to reduce memory overhead. The source private file system can be used to store user files and cached files, which are unaffected by the page lifecycle; data remains even when the browser is closed, meeting the need for long-term storage of persistent files.

[0053] In this way, compared to a pure memory solution, a tiered storage solution that combines RAM and a source private file system can meet the needs of fast access to temporary data as well as the need for long-term storage of data such as game level progress and user item library.

[0054] The service layer includes a union file system, which is obtained by merging temporary file system instances and persistent file system instances.

[0055] In practice, a temporary file system instance is created in the service layer corresponding to the runtime memory, and a persistent file system instance is created in the service layer corresponding to the source private file system. Then, a union file system is used to merge the temporary and persistent file system instances, allowing the service layer to expose the union file system's API externally, while not exposing the APIs of the temporary and persistent file system instances.

[0056] In one possible implementation, creating a temporary file system instance at the service layer can be achieved as follows: based on the createFsFromVolume method of memfs (in-memory file system), create a file system instance consistent with the Node.js file system interface definition, and use this as a temporary file system instance.

[0057] One possible implementation is to create a persistent file system instance at the service layer, which can be achieved by using the fsa-node-fs module based on memfs to create a file system instance that is consistent with the Node.js file system interface definition, and using this as the persistent file system instance.

[0058] The temporary file system instance creates a first file directory that relies on runtime memory, while the persistent file system instance creates a second file directory that relies on the source private file system. The first and second file directories share the same access path. For example, the first file directory is a temporary file directory, and the second file directory is a cache file directory; both the first and second file directories share the access path https: / / resource. For example, the temporary file system instance may also contain a game code file directory, and the persistent file system instance may also contain a user file directory.

[0059] In this context, persistent file system instances have a higher access priority than temporary file system instances.

[0060] For example, when the game code initiates a data read request, the union file system will first check the high-priority persistent file system instance. If the target file exists in the persistent file system instance, it will return directly; otherwise, it will automatically access the low-priority temporary file system instance.

[0061] When the game code initiates a write data request, the union file system will redirect the write request to a writable persistent file system instance to ensure that the persistent file is correctly saved to the browser's source private file system and to prevent the persistent file from being accidentally written to runtime memory.

[0062] Internally, the temporary and persistent file system instances are physically isolated, maintaining their respective capabilities. For example, the persistent file system instance stores files that need to be retained long-term, while the temporary file system instance stores temporary files. Furthermore, by setting the access priority of the persistent file system instance higher than that of the temporary file system instance, directories under the persistent file system instance can be writable, while directories under the temporary file system instance can be read-only. Externally, an API is exposed, allowing access to directories under both the temporary and persistent file system instances via a single path without requiring changes to the mini-program / mini-game code. This solves the complex issues of file system read / write permission management and the simultaneous existence of temporary and persistent files in a single directory in a browser environment, further enabling zero-change porting of client-side mini-programs / mini-games to modern browsers.

[0063] like Figure 2 As shown, the file system can also include an adaptation layer. The adaptation layer is used to adapt the API of the service layer to the API of the file system of the client's mini-program / mini-game to ensure interface consistency.

[0064] This specification also provides a file operation method for modern browsers through one or more embodiments, the method being based on the file system implementation for modern browsers provided in the above embodiments. This method can be applied to electronic devices employing the aforementioned file system for modern browsers.

[0065] Figure 3 A flowchart illustrating a file manipulation method applied to a modern browser, provided for one or more embodiments of this specification.

[0066] like Figure 3 As shown, one or more embodiments of this specification provide a file manipulation method applied to a modern browser, which may include the following steps: S102, Receive a read data request. The read data request is used to request to read data from the first access directory.

[0067] S104, in response to receiving a read data request, retrieve the first access directory in the persistent file system instance.

[0068] S106, if the first access directory is not found in the persistent file system instance, the first access directory is retrieved in the temporary file system instance.

[0069] S108, Receive write data request, the write data request is used to request to write target data to the second access directory.

[0070] S110, in response to receiving a write data request, write the target data to the second access directory in the persistent file system instance.

[0071] Because persistent file system instances have higher access priority than temporary file system instances, when a read data request is received, the system first searches for the first access directory within the persistent file system instance. If the first access directory is found in the persistent file system instance, the corresponding data is read from that directory. If the first access directory is not found in the persistent file system instance, the system searches for it in the temporary file system instance and reads the corresponding data from that directory. In other words, directories under both the persistent and temporary file system instances have read permissions.

[0072] Upon receiving a write request, the target data is directly written to the second access directory within the persistent file system instance. In other words, directories under the persistent file system instance have write permissions, while directories under the temporary file system instance do not.

[0073] It should be noted that some mini-programs, such as mini-games, require the use of a synchronized file API, meaning that file management must also be synchronized on the main thread. However, in a browser environment, the source private file system cannot directly provide synchronization operations on the browser's main thread. Therefore, to further implement the "main thread synchronization operation" function in modern browsers, this specification provides one or more embodiments of a method for implementing browser main thread synchronization operations based on a source private file system. Figure 4 As shown, the method may include the following steps: S202, creates the browser's main thread and worker threads.

[0074] S204 establishes a communication connection between the browser's main thread and worker threads.

[0075] S206, Create a shared data instance.

[0076] In S202, after creating the browser's main thread, worker threads can be created through the browser's main thread.

[0077] In S204, the browser's main thread and worker threads can handshake to establish a communication connection. The handshake process can be found in relevant technical documentation and will not be elaborated upon here.

[0078] In S206, shared data instances can be created through the browser's main thread to allocate a shared memory space for data sharing between the browser's main thread and worker threads. For example, a Shared Array Buffer instance can be created through the browser's main thread to share data between threads.

[0079] It should be noted that steps S202 to S206 above can be performed before launching the mini-program / mini-game. After launching the mini-program / mini-game, wait to receive a data synchronization request for the source private file system. After receiving the data synchronization request for the source private file system, perform the following steps S208 to S214.

[0080] S208, In response to receiving a data synchronization request for the source private file system, the browser's main thread inputs the data synchronization request information to the shared data instance.

[0081] In one possible implementation, the shared data instance adopts a structure including a header and a body. Thus, in response to receiving a data synchronization request for the source private file system, the browser's main thread changes the first element in the shared data instance's header from 0 to 1, and expresses the data synchronization request information in the shared data instance's body.

[0082] For example, such as Figure 5 As shown, the first six elements in the shared data instance are the message header, and the other elements are the message body. The initial value of the first element in the message header is 0. Upon receiving a data synchronization request, the browser's main thread writes the data synchronization request information into the message body and modifies the first element in the message header from 0 to 1.

[0083] After the browser's main thread sends a data synchronization request to the shared data instance, the browser's main thread can call a notification function (e.g., Atomics.notify) to wake up the worker threads. Furthermore, the browser's main thread can detect whether the worker threads have sent a response to the shared data instance, so that the corresponding response data can be read from the shared data instance accordingly.

[0084] Specifically, the browser's main thread can wake up worker threads using Atomics.notify, and then use the Atomics API to continuously check whether there is a response message in the shared data instance.

[0085] For example, if the browser's main thread detects that the first element in the header has changed from 1 to 0 again, it determines that a response has been detected in the shared data instance. Otherwise, it continues to detect until the first element in the header changes from 1 to 0.

[0086] S210, when the worker thread detects the input data synchronization request information of the shared data instance, it calls the source private file system through the worker thread to obtain the response data corresponding to the data synchronization request information.

[0087] Similarly, worker threads can use the Atmos API to repeatedly check if a data synchronization request has been entered into the shared data instance. For example, they can determine if a data synchronization request has been entered by checking if the first element in the header is 1.

[0088] Upon detecting that the first element in the header has become 1, the worker thread retrieves and parses the message body from the shared data instance to obtain the data synchronization request information. Then, it calls the source private file system to obtain the response data corresponding to the data synchronization request information.

[0089] S212, the worker thread inputs response information to the shared data instance, the response information including response data.

[0090] After obtaining the response data corresponding to the data synchronization request information through the worker thread, the response information including the response data is input into the shared data instance.

[0091] For example, a worker thread changes the first element in the message header from 1 to 0 and writes the response data into the message body.

[0092] S214, when the browser's main thread detects input response information from the shared data instance, the browser's main thread retrieves the response data from the shared data instance.

[0093] After the worker thread changes the first element in the header from 1 to 0, the browser's main thread can detect this change and determine that a response has been entered into the shared data instance. Therefore, the browser's main thread retrieves and parses the response data from the shared data instance. Afterward, the browser's main thread can send the response data back to the requester that initiated the data synchronization request.

[0094] After the data synchronization request is completed, the browser's main thread and worker threads can enter a waiting state, waiting for the next data synchronization request.

[0095] Thus, the browser synchronization method provided in one or more embodiments of this specification stores data synchronization request information related to the data synchronization request in a shared data instance through the browser's main thread, and then informs worker threads that they can retrieve and process the data synchronization request information from the shared data instance. After reading this data synchronization request information from the shared data instance, the worker threads perform the corresponding file synchronization operations in the source private file system (because synchronization operations can be performed in the worker threads). After completing the file synchronization operations in the source private file system, the worker threads notify the browser's main thread to retrieve the results of the file synchronization operations from the shared data instance, i.e., the response data, thereby indirectly achieving the effect of file synchronization operations in the browser's main thread.

[0096] The file operation process described above, based on Shared Array Buffer, Atmos API, and worker thread interaction, can be encapsulated to provide an interface similar to that of a regular synchronized file API. For upper-layer game code or application code, calling these encapsulated APIs is the same as in other environments that support synchronized file APIs, without needing to worry about the complex details of underlying multi-threaded collaboration and shared memory operations. This achieves synchronized file management APIs based on the source private file system on the browser's main thread.

[0097] It is understood that the above embodiments are merely examples, and modifications can be made to the above embodiments in actual implementation. Those skilled in the art will understand that any modifications to the above embodiments that do not require creative effort fall within the protection scope of one or more embodiments of this specification, and will not be described again in the embodiments.

[0098] Based on the same inventive concept, one or more embodiments of this specification also provide a file operation device for modern browsers. Since the principle of the file operation device for modern browsers is similar to that of the aforementioned file operation method for modern browsers, the implementation of the file operation device for modern browsers can refer to the implementation of the aforementioned file operation method for modern browsers, and the repeated parts will not be described again.

[0099] See Figure 6 , Figure 6 This specification provides a structural block diagram of a file manipulation device applied to a modern browser, as illustrated in one or more embodiments. Figure 6 As shown, the file operation device 300 applied to modern browsers may include: a first receiving module 301, a first searching module 302, a second searching module 303, a second receiving module 304, and a writing module 305. Among them, The first receiving module 301 is used to receive a data read request, which is used to request to read data from the first access directory.

[0100] The first retrieval module 302 is used to retrieve the first access directory in the persistent file system instance in response to receiving a read data request.

[0101] The second retrieval module 303 is used to retrieve the first access directory in a temporary file system instance if the first access directory is not found in the persistent file system instance.

[0102] The second receiving module 304 is used to receive a write data request, which is used to request the writing of target data to the second access directory.

[0103] The write module 305 is used to write the target data to the second access directory in the persistent file system instance in response to receiving a write data request.

[0104] In one possible implementation, the device further includes: The synchronization module is used to create the browser's main thread and worker threads; establish a communication connection between the browser's main thread and worker threads; create a shared data instance for the browser's main thread and worker threads to share data; respond to a data synchronization request received for the source private file system by inputting the data synchronization request information to the shared data instance through the browser's main thread; when a worker thread detects the input data synchronization request information to the shared data instance, it calls the source private file system through the worker thread to obtain the response data corresponding to the data synchronization request information; it inputs response information, including response data, to the shared data instance through the worker thread; and when the browser's main thread detects the input response information to the shared data instance, it retrieves the response data from the shared data instance through the browser's main thread.

[0105] In one possible implementation, the synchronization module is also used to: wake up the worker thread by calling a notification function through the browser's main thread; and detect whether the worker thread has entered response information in the shared data instance through the browser's main thread.

[0106] In one possible implementation, the shared data instance adopts a structure including a header and a body; wherein, the synchronization module is used to input data synchronization request information to the shared data instance through the browser's main thread, specifically: The browser's main thread changes the first element in the header of the shared data instance from 0 to 1, and expresses the data synchronization request information in the body of the shared data instance. The synchronization module is used to input response information to the shared data instance through worker threads. The response information includes response data, specifically: The worker thread changes the first element in the message header from 1 to 0, and then expresses the response data in the message body.

[0107] In one possible implementation, the synchronization module, when a worker thread detects a data synchronization request from a shared data instance, retrieves the response data corresponding to the data synchronization request by calling the source private file system. Specifically: When the worker thread detects that the first element in the header has changed from 0 to 1, it calls the source private file system to obtain the response data corresponding to the data synchronization request information. When the browser's main thread detects that the first element in the message header has changed from 1 to 0, it retrieves the response data from the message body through the browser's main thread.

[0108] See Figure 7 , Figure 7 This is a structural block diagram of an electronic device provided for one or more embodiments of this specification. Figure 7 As shown, the electronic device 400 may include a processor 401 and a memory 402; the memory 402 may be coupled to the processor 401. It is worth noting that... Figure 7 This is an example; other types of structures can also be used to supplement or replace this structure to achieve telecommunications functions or other functions.

[0109] In one possible implementation, the functionality of the file manipulation device 400 used in modern browsers can be integrated into the processor 401. The processor 401 can be configured to perform the following operations: Receive a read data request, which is used to request the reading of data from the first access directory; In response to receiving a read data request, retrieve the first access directory in the persistent file system instance; If the first access directory is not found in the persistent file system instance, the first access directory is retrieved in the temporary file system instance. Receive a write data request, which is used to request that target data be written to the second access directory; In response to receiving a write data request, the target data is written to the second access directory in the persistent file system instance. Alternatively, Create the browser's main thread and worker threads; Establish a communication connection between the browser's main thread and worker threads; Create a shared data instance, which is used for data sharing between the browser's main thread and worker threads; In response to receiving a data synchronization request for the source private file system, the browser's main thread inputs the data synchronization request information to the shared data instance. When a worker thread detects a data synchronization request from a shared data instance, it calls the source private file system to obtain the response data corresponding to the data synchronization request. The worker thread inputs response information to the shared data instance; the response information includes response data. When the browser's main thread detects input response information from the shared data instance, it retrieves the response data from the shared data instance through the browser's main thread.

[0110] In another possible implementation, the file operation device 400 for modern browsers can be configured separately from the processor 401. For example, the file operation device 400 for modern browsers can be configured as a chip connected to the processor 401, and file operations for modern browsers can be implemented through the control of the processor 401.

[0111] Furthermore, in some alternative implementations, the electronic device 400 may also include: a communication module, an input unit, an audio processor, a display, a power supply, etc. It is worth noting that the electronic device 400 is not necessarily required to include these components. Figure 7 All components shown; in addition, the electronic device 400 may also include Figure 7 For components not shown, please refer to existing technologies.

[0112] In some alternative implementations, the processor 401, sometimes also referred to as a controller or operating control, may include a microprocessor or other processor device and / or logic device, which receives input and controls the operation of various components of the electronic device 400.

[0113] The memory 402 may be, for example, one or more of a cache, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices. It may store the aforementioned information related to the file operation device 400 used in modern browsers, and may also store programs for executing that information. The processor 401 may execute the program stored in the memory 402 to perform information storage or processing, etc.

[0114] An input unit can provide input to the processor 401. This input unit may be, for example, a button or touch input device. A power supply can be used to provide power to the electronic device 400. A display can be used to display images and text, etc. This display may be, for example, an LCD display, but is not limited to this.

[0115] Memory 402 can be a solid-state memory, such as read-only memory (ROM), random access memory (RAM), SIM card, etc. It can also be a memory that retains information even when power is off, can be selectively erased, and contains more data; examples of this type of memory are sometimes referred to as EPROM, etc. Memory 402 can also be some other type of device. Memory 402 includes buffer memory (sometimes referred to as a buffer). Memory 402 may include an application / function storage unit for storing application programs and function programs or processes for executing the operation of electronic device 400 via processor 401.

[0116] The memory 402 may also include a data storage unit for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit of the memory 402 may include various drivers for the computer device for communication functions and / or for performing other functions of the computer device (such as messaging applications, address book applications, etc.).

[0117] The communication module is a transmitter / receiver that sends and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor 401 to provide input signals and receive output signals, which can be the same as in a conventional mobile communication terminal.

[0118] Based on different communication technologies, multiple communication modules can be configured in the same computer device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module (transmitter / receiver) is also coupled to a speaker and microphone via an audio processor to provide audio output through the speaker and receive audio input from the microphone, thereby enabling typical telecommunications functions. The audio processor may include any suitable buffer, decoder, amplifier, etc. Additionally, the audio processor is coupled to processor 401, enabling on-device recording via the microphone and on-device playback of stored sound via the speakers.

[0119] One or more embodiments of this specification also provide a computer-readable storage medium capable of implementing all the steps of the file operation method for modern browsers described above. The computer-readable storage medium stores a computer program that, when executed by a processor, implements all the steps of the file operation method for modern browsers described above. For example, when the processor executes the computer program, it implements the following steps: Receive a read data request, which is used to request the reading of data from the first access directory; In response to receiving a read data request, retrieve the first access directory in the persistent file system instance; If the first access directory is not found in the persistent file system instance, the first access directory is retrieved in the temporary file system instance. Receive a write data request, which is used to request that target data be written to the second access directory; In response to receiving a write data request, the target data is written to the second access directory in the persistent file system instance. Alternatively, Create the browser's main thread and worker threads; Establish a communication connection between the browser's main thread and worker threads; Create a shared data instance, which is used for data sharing between the browser's main thread and worker threads; In response to receiving a data synchronization request for the source private file system, the browser's main thread inputs the data synchronization request information to the shared data instance. When a worker thread detects a data synchronization request from a shared data instance, it calls the source private file system to obtain the response data corresponding to the data synchronization request. The worker thread inputs response information to the shared data instance; the response information includes response data. When the browser's main thread detects input response information from the shared data instance, it retrieves the response data from the shared data instance through the browser's main thread.

[0120] While one or more embodiments of this specification provide the operational steps of the methods described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive labor. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual device or client product execution, the methods shown in the embodiments or drawings can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment).

[0121] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, apparatus (systems), or computer program products. Therefore, the embodiments of this specification can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, one or more embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0122] This specification describes one or more embodiments of a method, apparatus (system), and computer program product according to one or more embodiments of this specification with reference to flowchart illustrations and / or block diagrams. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0123] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0124] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0125] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and system embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0126] In this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Those skilled in the art will understand the specific meaning of the above terms in one or more embodiments of this specification, depending on the specific circumstances.

[0127] It should be noted that, unless otherwise specified, one or more embodiments and features thereof in this specification can be combined with each other. This specification is not limited to any single aspect, nor to any single embodiment, nor to any combination and / or substitution of such aspects and / or embodiments. Furthermore, each aspect and / or embodiment of one or more embodiments of this specification can be used alone or in combination with one or more other aspects and / or embodiments thereof.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of one or more embodiments of this specification, and are not intended to limit them. Although one or more embodiments of this specification have been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of one or more embodiments of this specification, and they should all be covered within the scope of the claims and the specification of one or more embodiments of this specification.

[0129] The foregoing description of one or more embodiments of this specification has been provided in conjunction with optional implementation methods. However, these embodiments are merely exemplary and illustrative. Various substitutions and modifications can be made to the one or more embodiments of this specification, all of which fall within the protection scope of the one or more embodiments of this specification.

Claims

1. A file system for use in modern browsers, characterized in that, The file system includes: The storage layer includes running memory and the source private file system; The service layer includes a union file system, which is obtained by merging a temporary file system instance and a persistent file system instance. The temporary file system instance has a first file directory implemented using the runtime memory, and the persistent file system instance has a second file directory implemented using the source private file system. The first and second file directories have the same access path, and the persistent file system instance has a higher access priority than the temporary file system instance.

2. The file system as described in claim 1, characterized in that, The file system also includes: An adaptation layer is used to adapt the APIs of the service layer to the file system APIs of mini-programs and / or mini-games in the client.

3. The file system as described in claim 1, characterized in that, The temporary file system instance contains a game code file directory and a temporary file directory implemented in the running memory. The persistent file system instance contains a user file directory and a cache file directory implemented in the source private file system. The temporary file directory is the first file directory, and the cache file directory is the second file directory.

4. A file manipulation method applied to modern browsers, characterized in that, The method is implemented based on the file system as described in any one of claims 1-3, and the method includes: Receive a data read request, the data read request being used to request the reading of data from the first access directory; In response to receiving the read data request, the first access directory is retrieved in the persistent file system instance; If the first access directory is not found in the persistent file system instance, the first access directory is retrieved in the temporary file system instance; Receive a write data request, the write data request being used to request writing target data to the second access directory; In response to receiving the write data request, the target data is written to the second access directory in the persistent file system instance.

5. The method as described in claim 4, characterized in that, The method further includes: Create the browser's main thread and worker threads; Establish a communication connection between the browser's main thread and the worker thread; Create a shared data instance, which is used for data sharing between the browser's main thread and the worker threads; In response to receiving a data synchronization request for the source private file system, the browser's main thread inputs the data synchronization request information to the shared data instance. When the worker thread detects that the shared data instance has input a data synchronization request, it calls the source private file system through the worker thread to obtain the response data corresponding to the data synchronization request. The worker thread inputs response information to the shared data instance, and the response information includes the response data. When the browser's main thread detects that the shared data instance has input the response information, the browser's main thread retrieves the response data from the shared data instance.

6. The method as described in claim 5, characterized in that, After inputting data synchronization request information to the shared data instance through the browser's main thread, the method further includes: The worker thread is woken up by calling a notification function on the browser's main thread. The browser's main thread detects whether the worker thread has entered response information in the shared data instance.

7. The method as described in claim 5, characterized in that, The shared data instance adopts a structure including an information header and an information body; The step of inputting data synchronization request information to the shared data instance through the browser's main thread includes: The browser's main thread changes the first element in the header of the shared data instance from 0 to 1, and expresses the data synchronization request information in the body of the shared data instance. The process of inputting response information to the shared data instance through the worker thread includes: The worker thread changes the first element in the header from 1 to 0 and expresses the response data in the body.

8. The method as described in claim 7, characterized in that, When the worker thread detects that the shared data instance has input a data synchronization request, it calls the source private file system to obtain the response data corresponding to the data synchronization request, including: When the worker thread detects that the first element in the header changes from 0 to 1, it calls the source private file system to obtain the response data corresponding to the data synchronization request information. When the browser's main thread detects that the first element in the header has changed from 1 to 0, the browser's main thread retrieves the response data from the message body.

9. A file manipulation device for use in modern browsers, characterized in that, The device includes: The first receiving module is used to receive a read data request, wherein the read data request is used to request to read data from the first access directory; The first retrieval module is configured to, in response to receiving the data read request, retrieve the first access directory in the persistent file system instance; The second retrieval module is used to retrieve the first access directory in a temporary file system instance if the first access directory is not found in the persistent file system instance. The second receiving module is used to receive a write data request, the write data request being used to request writing target data to the second access directory; The write module is configured to, in response to receiving the write data request, write the target data to the second access directory in the persistent file system instance.

10. The apparatus as claimed in claim 9, characterized in that, The device further includes: A synchronization module is used to create a browser main thread and worker threads; establish a communication connection between the browser main thread and the worker threads; create a shared data instance for sharing data between the browser main thread and the worker threads; in response to receiving a data synchronization request for a source private file system, the browser main thread inputs data synchronization request information to the shared data instance; when the worker thread detects that the shared data instance has input data synchronization request information, the worker thread calls the source private file system to obtain response data corresponding to the data synchronization request information; the worker thread inputs response information to the shared data instance, the response information including the response data; when the browser main thread detects that the shared data instance has input the response information, the browser main thread retrieves the response data from the shared data instance.

11. The apparatus as claimed in claim 10, characterized in that, The synchronization module is also used for: The worker thread is woken up by calling a notification function on the browser's main thread. The browser's main thread detects whether the worker thread has entered response information in the shared data instance.

12. The apparatus as claimed in claim 10, characterized in that, The shared data instance adopts a structure including an information header and an information body; The synchronization module is used to input data synchronization request information to the shared data instance through the browser's main thread, specifically as follows: The browser's main thread changes the first element in the header of the shared data instance from 0 to 1, and expresses the data synchronization request information in the body of the shared data instance. The synchronization module is configured to input response information to the shared data instance through the worker thread. The response information includes the response data, specifically: The worker thread changes the first element in the header from 1 to 0 and expresses the response data in the body.

13. The apparatus as claimed in claim 12, characterized in that, The synchronization module is configured to, when the worker thread detects that the shared data instance has input a data synchronization request, obtain response data corresponding to the data synchronization request by calling the source private file system through the worker thread, specifically: When the worker thread detects that the first element in the header changes from 0 to 1, it calls the source private file system to obtain the response data corresponding to the data synchronization request information. When the browser's main thread detects that the first element in the header has changed from 1 to 0, the browser's main thread retrieves the response data from the message body.

14. An electronic device, characterized in that, The electronic device includes: Memory, used to store computer program products; A processor is configured to execute a computer program product stored in the memory, wherein, when the computer program product is executed, it implements the method described in any one of claims 4-8.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed, implement the method described in any one of claims 4-8.

Citation Information

Cited By

  • Point cloud data processing method and device based on browser storage

    CN121880288A