Disclosure of Invention
The embodiment of the disclosure at least provides a file synchronization method, a file synchronization device, electronic equipment and a computer-readable storage medium.
In a first aspect, an embodiment of the present disclosure provides a file synchronization method, including:
determining a target distributed storage system according to file storage requirement information of a target webpage version integrated development environment;
modifying a file access path corresponding to the target webpage version integrated development environment from a local access path to an access path for accessing the target distributed storage system;
and in the process of operating the target webpage version integrated development environment on the electronic equipment provided with the target webpage version integrated development environment, accessing the target distributed storage system according to the modified access path.
In the embodiment of the disclosure, the file access path corresponding to the target web version integrated development environment is modified from the local access path to the access path for accessing the target distributed storage system, so that the file system of the WebIDE application program after the access path is modified reads and writes the file system data structure on the target distributed storage system, and the WebIDE application programs deployed on different servers access the same remote file system instead of the local file system, thereby avoiding the problem of file asynchronization in the prior art.
According to the first aspect, in a possible implementation manner, the determining a target distributed storage system according to file storage requirement information of a target webpage version integrated development environment includes:
and selecting a distributed storage system from a plurality of distributed storage systems as the target distributed storage system according to the file storage capacity requirement and the file reading rate requirement of the target webpage version integrated development environment.
In the embodiment of the disclosure, the target distributed storage system is determined according to the file storage capacity requirement and the file reading rate requirement of the target webpage version integrated development environment, so that the determined target distributed system meets the actual requirement, and the maximum utilization of resources is realized.
According to the first aspect, in a possible implementation, after determining the target distributed storage system, the method further includes:
and generating a data storage structure of a target distributed storage system corresponding to the target webpage version integrated development environment according to a tree data structure, so as to store the file content of the target webpage version integrated development environment commonly accessed by different electronic equipment provided with the target webpage version integrated development environment according to the data storage structure.
In the embodiment of the disclosure, the data of the file system is stored by designing the tree-shaped data storage structure, so that the tree-shaped data structure corresponds to the tree-shaped structure of the folder, and the data is convenient to store and read.
According to the first aspect, in a possible implementation manner, the modifying a file access path corresponding to the target webpage version integrated development environment from a local access path to an access path for accessing the target distributed storage system includes:
and integrating the target webpage version into an access path corresponding to the public interface set of the file system module in the development environment, and modifying the local access path into an access path for accessing the target distributed storage system.
According to the first aspect, in one possible implementation, the set of public interfaces includes a plurality of:
the system comprises a new file interface, a new folder interface, a delete file interface, a delete folder interface, a mobile file interface, an acquire file statistical data interface, an acquire file content interface and an update file content interface.
According to the first aspect, in a possible implementation manner, in the process of running the target netpage version integrated development environment on the electronic device in which the target netpage version integrated development environment is installed, accessing the target distributed storage system according to the modified access path includes:
accessing the target distributed storage system according to the modified access path to acquire a data table for storing the file content of the target webpage version integrated development environment in the target distributed storage system;
and acquiring the accessed target file content from the data table according to the data storage structure of the target distributed storage system corresponding to the target webpage version integrated development environment.
In a second aspect, an embodiment of the present disclosure provides a file synchronization apparatus, including:
the system determination module is used for determining a target distributed storage system according to the file storage requirement information of the target webpage version integrated development environment;
the path modification module is used for modifying a file access path corresponding to the target webpage version integrated development environment from a local access path to an access path for accessing the target distributed storage system;
and the system access module is used for accessing the target distributed storage system according to the modified access path in the process of operating the target webpage version integrated development environment on the electronic equipment provided with the target webpage version integrated development environment.
According to the second aspect, in a possible implementation, the system determination module is specifically configured to:
and selecting a distributed storage system from a plurality of distributed storage systems as the target distributed storage system according to the file storage capacity requirement and the file reading rate requirement of the target webpage version integrated development environment.
According to a second aspect, in a possible implementation, the apparatus further comprises:
and the data structure generating module is used for generating a data storage structure of a target distributed storage system corresponding to the target webpage version integrated development environment according to a tree data structure, and storing the file content of the target webpage version integrated development environment commonly accessed by different electronic equipment provided with the target webpage version integrated development environment according to the data storage structure.
According to the second aspect, in a possible implementation, the path modification module is specifically configured to:
and integrating the target webpage version into an access path corresponding to the public interface set of the file system module in the development environment, and modifying the local access path into an access path for accessing the target distributed storage system.
According to a second aspect, in one possible implementation, the set of public interfaces includes a plurality of:
the system comprises a new file interface, a new folder interface, a delete file interface, a delete folder interface, a mobile file interface, an acquire file statistical data interface, an acquire file content interface and an update file content interface.
According to the second aspect, in a possible implementation, the system access module is specifically configured to:
accessing the target distributed storage system according to the modified access path to acquire a data table for storing the file content of the target webpage version integrated development environment in the target distributed storage system;
and acquiring the accessed target file content from the data table according to the data storage structure of the target distributed storage system corresponding to the target webpage version integrated development environment.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the file synchronization method according to the first aspect.
In a fourth aspect, the disclosed embodiments provide a computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, performs the steps of the file synchronization method according to the first aspect.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, as generally described and illustrated in the figures herein, could be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the disclosure, provided in the accompanying drawings, is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of a, B, and C, and may mean including any one or more elements selected from the group consisting of a, B, and C.
An Integrated Development Environment (IDE) is an application program for providing a program Development Environment, and generally includes a code editor, a compiler, a debugger, and a graphical user interface tool, and integrates a code compiling function, an analyzing function, a compiling function, a debug function, and other Integrated Development software packages.
It has been found that, in the field of computer technology, users (developers) usually perform software Development, code debugging, and the like in mainstream IDE (Integrated Development Environment), such as: IDE such as Visual Studio, eclipse, neat Beans, intelliJ IDEA, etc. The web page version integrated development environment is a network application program for providing a program development environment. Through WebIDE, users can develop software on any device provided with a browser, and currently, the mainstream WebIDE comprises Theia and VSCode.
When using WebIDE, an application needs to be installed on a target electronic device, and then a browser needs to be used to access the target electronic device. However, this approach is generally only suitable for use by a single person. For a multi-user scenario, due to the limited capacity, performance and reliability of a single target electronic device, the WebIDE application needs to be installed onto multiple target electronic devices, and then the multiple target electronic devices are accessed through the scheduling of the load balancing system.
However, after installing the application of WebIDE to multiple target electronic devices, file dyssynchrony may occur. For example, if the WebIDE is used last time and the target electronic device a is accessed, the corresponding modified file is saved in the target electronic device a; when the WebIDE is used next time, the target electronic device B may be accessed through scheduling of the load balancing system, but the file modified last time is stored in the target electronic device A, that is, the WebIDE is a read-write local file system, so that different target files obtained when different target electronic devices are accessed are different, and the ordered development work is influenced. Therefore, how to solve the problem of file synchronization in a multi-user use scenario is a technical problem to be solved by the present disclosure.
Load Balance (Load Balance) is to Balance loads (work tasks and access requests) and distribute the loads to a plurality of operation units (servers and components) for execution. This balancing and splitting is commonly referred to as scheduling. The load balancing system is a system capable of realizing a load balancing function.
Based on the research, the present disclosure provides a file synchronization method, which can determine a target distributed storage system according to file storage requirement information of a target web version integrated development environment; modifying a file access path corresponding to the target webpage version integrated development environment from a local access path to an access path for accessing the target distributed storage system; and then accessing the target distributed storage system according to the modified access path in the process of operating the target webpage version integrated development environment on the electronic equipment provided with the target webpage version integrated development environment.
Therefore, the file system read-write of the WebIDE application program after the access path is modified is the file system data structure on the target distributed storage system, so that the WebIDE application programs deployed on different servers access the same remote file system instead of the local file system, and the problem of file asynchronization in the prior art is solved.
The above-mentioned drawbacks are the results of the inventor after practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to the above-mentioned problems should be the contribution of the inventor in the process of the present disclosure.
The following describes the present application in detail with reference to a specific system application architecture.
Referring to fig. 1, fig. 1 illustrates an exemplary system architecture that may be applied to the file synchronization method of the present application.
As shown in fig. 1, the system architecture 100 may include electronic devices 10, 20, a network 30, and a server 40. The network 30 serves as a medium for providing a communication link between the electronic devices 10, 20 and the server 40. Network 30 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the electronic devices 10, 20 to interact with the server 40 over the network 30 to receive or send messages or the like. Various client applications, such as an integrated development environment-like application, may be installed on the electronic devices 10, 20.
The electronic devices 10, 20 may be a variety of electronic devices having a display screen and a processor including, but not limited to, laptop portable computers, desktop computers, and the like.
The server 40 may be a server that provides various services, such as a server that provides support for an integrated development environment-like application displayed on the electronic device 10, 20. The server 40 may perform processing such as analysis on data such as a received acquisition request for acquiring an item matching the item name, and feed back a processing result (e.g., an entry file and a service file) to the electronic device.
It should be noted that the method for file synchronization provided by the embodiment of the present application is generally executed by the electronic device 10 or 20, and the target distributed storage system is deployed on a plurality of servers 30.
To facilitate understanding of this embodiment, first, a file synchronization method disclosed in an embodiment of the present disclosure is described in detail, where an execution subject of the file synchronization method provided in the embodiment of the present disclosure is generally an electronic device with certain computing capability, and the electronic device includes, for example: a terminal device, which may be a mobile device, a user terminal, a handheld device, a computing device, a vehicle device, a wearable device, or the like, or a server or other processing device. In some possible implementations, the file synchronization method may be implemented by a processor calling computer readable instructions stored in a memory.
Referring to fig. 2, a flowchart of a file synchronization method provided in the embodiment of the present disclosure is shown, where the method may be applied to the electronic device, or applied to a local or cloud server. The file synchronization method shown in fig. 2 includes the following S101 to S103:
s101, determining a target distributed storage system according to file storage requirement information of the target webpage version integrated development environment.
The web page version integrated development environment is a network application program for providing a program development environment. Through the webpage version integration development environment, a user can develop software on any device provided with a browser. According to the webpage version integrated development environment in the embodiment of the disclosure, software development is not limited by a certain computer, so that the IDE becomes portable, and the software development becomes more free. Currently, the mainstream WebIDE is theoia and VSCode.
Illustratively, a distributed storage system may be selected from a plurality of distributed storage systems as the target distributed storage system according to a file storage capacity requirement and a file reading rate requirement of the target webpage version integrated development environment. For example, mongoDB, written in the C + + language, is a open source database system based on distributed file storage. Furthermore, since the MongoDB is oriented to the database of the document storage, it is relatively simple and easy to operate. Therefore, mongoDB may be selected as the target distributed storage system.
S102, modifying a file access path corresponding to the target webpage version integrated development environment from a local access path to an access path for accessing the target distributed storage system.
It should be appreciated that applications typically use a modular organization, and WebIDE applications sort the code for different functions into different modules. For example, the code related to reading and writing files is classified as a file system module. In addition, the application program also adopts a layered design. Inside WebIDE, two layers, a base module and an application module, are roughly included. The file system module, as a basic module, exposes some public interface sets to the application module for use. Outside the WebIDE, the WebIDE module can be implemented by relying on the corresponding module of the underlying framework. For example, both VSCode and thia are based on the node. Because the code of the WebIDE follows modular and hierarchical design, only the corresponding module needs to be modified when the function is modified.
For example, when modifying the access path, a file system module of the WebIDE application may be determined first, for example, the file system module of Theia is packages/filesystems; and then modifying the public interface set of the file system module, and changing the read-write local file system into the read-write target distributed data storage system, namely, integrating the target webpage version into an access path corresponding to the public interface set of the file system module in the development environment, and modifying the local access path into an access path for accessing the target distributed storage system.
Wherein the set of public interfaces comprises: a new file interface, a new folder interface, a delete file interface, a delete folder interface, a move file interface, an obtain file statistics interface, an obtain file content interface, an update file content interface, and the like.
And S103, accessing the target distributed storage system according to the modified access path in the process of operating the target webpage version integrated development environment on the electronic equipment provided with the target webpage version integrated development environment.
In the embodiment of the disclosure, the file access path corresponding to the target web version integrated development environment is modified from the local access path to the access path for accessing the target distributed storage system, so that the modified file system of the WebIDE application program reads and writes the file system data structure on the target distributed storage system, and further, the WebIDE application programs deployed on different servers access the same remote file system instead of the local file system, thereby avoiding the problem of file asynchronization in the prior art.
In addition, the distributed storage system is used for storing files, so that a large storage capacity can be obtained, and the target distributed storage system dispersedly stores data on a plurality of independent servers, adopts an expandable system structure and shares a storage load by using a plurality of storage servers, so that the reliability, the usability and the access efficiency of the system are improved, and the expansion is easy.
S103 will be described in detail with reference to specific embodiments.
As to S103, in the process of operating the target web version integrated development environment on the electronic device installed with the target web version integrated development environment, when accessing the target distributed storage system according to the modified access path, as shown in fig. 3, the following S1031 to 1032 may be included:
and S1031, accessing the target distributed storage system according to the modified access path to obtain a data table in the target distributed storage system, wherein the data table stores the file content of the target webpage version integrated development environment.
It should be appreciated that after the access path is modified, the WebIDE application may be deployed to a different physical machine (e.g., a different server).
Illustratively, the connected target distributed storage system instance may be obtained according to the modified access path, and a logical unit, such as a table of a database, on which the file system content is stored is obtained.
And S1032, acquiring the accessed target file content from the data table according to the data storage structure of the target distributed storage system corresponding to the target webpage version integrated development environment.
Illustratively, the pseudo-code for the get file content interface is as follows:
referring to fig. 4, a flowchart of another file synchronization method provided in the embodiment of the present disclosure is shown. The file synchronization method includes the following steps S201 to S204:
s201, determining a target distributed storage system according to the file storage requirement information of the target webpage version integrated development environment.
This step is similar to step S101 described above and will not be described herein again.
And S202, generating a data storage structure of a target distributed storage system corresponding to the target webpage version integrated development environment according to a tree data structure, so as to store the file content of the target webpage version integrated development environment commonly accessed by different electronic devices in which the target webpage version integrated development environment is installed according to the data storage structure.
It should be appreciated that a file system is a method of storing and organizing computer data, and that the file system uses the abstract logical concept of files and tree directories instead of the concept of using data blocks for physical devices such as hard disks and optical disks. When a user uses a file system to store data, the user does not need to care about the number of data blocks of the hard disk (or optical disk) where the data is actually stored, and only needs to remember the directory and file name of the file.
Since the folders adopt the tree structure, when the folders are stored in the distributed storage system, a corresponding tree data structure also needs to be designed, and therefore, in the embodiment, for convenience of data storage and reading, a tree data structure is designed to store the file system data.
The tree data structure at least comprises file path, file type, modification time, file content, file size and subfile list fields. The file types include both files and folders.
Illustratively, the data structure fields are as follows:
s203, modifying the file access path corresponding to the target webpage version integrated development environment from a local access path to an access path for accessing the target distributed storage system.
This step is similar to step S102, and is not described herein again.
And S204, in the process of operating the target webpage version integrated development environment on the electronic equipment provided with the target webpage version integrated development environment, accessing the target distributed storage system according to the modified access path.
This step is similar to step S103 described above and will not be described herein again.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same technical concept, a file synchronization device corresponding to the file synchronization method is further provided in the embodiment of the present disclosure, and as the principle of solving the problem of the device in the embodiment of the present disclosure is similar to that of the file synchronization method in the embodiment of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Referring to fig. 5, a schematic diagram of a file synchronization apparatus 500 according to an embodiment of the present disclosure is shown, where the file synchronization apparatus includes:
the system determination module 501 is configured to determine a target distributed storage system according to file storage requirement information of a target web version integrated development environment;
a path modification module 502, configured to modify a file access path corresponding to the target web page version integrated development environment from a local access path to an access path for accessing the target distributed storage system;
the system access module 503 is configured to access the target distributed storage system according to the modified access path in the process of running the target web version integrated development environment on the electronic device in which the target web version integrated development environment is installed.
In a possible implementation, the system determination module 501 is specifically configured to:
and selecting a distributed storage system from the distributed storage systems as the target distributed storage system according to the file storage capacity requirement and the file reading rate requirement of the target webpage version integrated development environment.
In a possible embodiment, the apparatus further comprises:
a data structure generating module 504, configured to generate, according to a tree data structure, a data storage structure of a target distributed storage system corresponding to the target web page version integrated development environment, and to store, according to the data storage structure, file content of the target web page version integrated development environment that is commonly accessed by different electronic devices in which the target web page version integrated development environment is installed.
In a possible implementation, the path modification module 502 is specifically configured to:
and integrating the target webpage version into an access path corresponding to the public interface set of the file system module in the development environment, and modifying the local access path into an access path for accessing the target distributed storage system.
In one possible implementation, the set of public interfaces includes a plurality of:
the system comprises a new file interface, a new folder interface, a delete file interface, a delete folder interface, a mobile file interface, an acquire file statistical data interface, an acquire file content interface and an update file content interface.
In a possible implementation, the system access module 503 is specifically configured to:
accessing the target distributed storage system according to the modified access path to acquire a data table for storing the file content of the target webpage version integrated development environment in the target distributed storage system;
and acquiring the accessed target file content from the data table according to the data storage structure of the target distributed storage system corresponding to the target webpage version integrated development environment.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Based on the same technical concept, the embodiment of the disclosure also provides an electronic device. Referring to fig. 6, a schematic structural diagram of an electronic device 700 provided in the embodiment of the present disclosure includes a processor 701, a memory 702, and a bus 703. The memory 702 is used for storing execution instructions and includes a memory 7021 and an external memory 7022; the memory 7021 is also referred to as an internal memory and temporarily stores operation data in the processor 701 and data exchanged with the external memory 7022 such as a hard disk, and the processor 701 exchanges data with the external memory 7022 via the internal memory 7021.
In this embodiment, the memory 702 is specifically configured to store application program codes for executing the scheme of the present application, and is controlled by the processor 701 to execute. That is, when the electronic device 700 is operated, the processor 701 and the memory 702 communicate with each other through the bus 703, so that the processor 701 executes the application program code stored in the memory 702, thereby executing the method in any of the foregoing embodiments.
The Memory 702 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 701 may be an integrated circuit chip having signal processing capabilities. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It is to be understood that the illustrated structure of the embodiment of the present application does not specifically limit the electronic device 700. In other embodiments of the present application, the electronic device 700 may include more or fewer components than shown, or combine certain components, or split certain components, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the file synchronization method in the foregoing method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute steps of the file synchronization method in the foregoing method embodiments, which may be referred to specifically for the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working process of the system and the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and details are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, the division of the units into only one type of logical function may be implemented in other ways, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solutions of the present disclosure, which are essential or part of the technical solutions contributing to the prior art, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.