Batch operation method, device and equipment for network file system sharing and medium
By obtaining the data bus from the network file system and defining a batch operation interface, the problem of low efficiency in batch operations in shared management is solved, enabling fast batch export and deletion, thus improving user experience and management efficiency.
Patent Information
- Application Number
- CN202310396236.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-14
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-04-14
AI Technical Summary
The lack of a standard interface in existing technologies to implement batch operations for sharing network file systems results in low efficiency for batch exporting or deleting thousands of shared files, impacting user experience and management efficiency.
By acquiring the data bus and registering the basic information of the network file system, a batch operation interface is defined. Based on the connection between the data bus and the network file system, a loop listening bus thread is started to monitor and process batch operation commands, and the corresponding operations are completed using pre-registered processing functions.
It enables fast batch export and batch deletion of network file system shares, improving management efficiency and user experience, and enhancing ease of use.
Smart Images

Figure CN116401226B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage system technology, and in particular to a method, apparatus, device and medium for batch operations of network file system sharing. Background Technology
[0002] Network File System (NFS) is a mainstream shared file system for heterogeneous platforms and one of the most important forms of network storage systems. It is characterized by its ease of use, convenient deployment, reliable data, and stable service. By mounting a NFS, we can use the disk storage space of a remote server as if it were a local file system, greatly expanding file storage space and facilitating file management for users. Users don't need to worry about the file's storage location, and the underlying storage operations are isolated, providing significant convenience for big data, cloud computing, and cloud storage. The service provided by NFS is network file system sharing, which is visible to users. Therefore, for big data, cloud computing, and cloud storage management platforms with large data and user scales, there is inevitably the issue of batch exporting and deleting multiple shares. Batch exporting and deleting multiple shares can quickly respond to users' batch operations on multiple shares, greatly improving the user experience in share management. Currently, the problem is the lack of a standard interface to implement batch operations on shares. Therefore, current share management is mostly for individual shares, and there are significant efficiency problems in batch exporting or deleting thousands of shares, which restricts the use of network file system sharing.
[0003] In summary, how to quickly achieve batch export and batch deletion of network file system shares, and improve the management efficiency and user experience of network file system services, is a problem that needs to be solved. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for batch operations in network file system sharing, which can quickly realize batch export and batch deletion of network file system sharing, thereby improving the management efficiency and user experience of network file system services. The specific solution is as follows:
[0005] Firstly, this application discloses a batch operation method for sharing a network file system, applied to a network file system, including:
[0006] Acquire the data bus and register the basic information of the network file system to the data bus to establish a connection between the network file system and the data bus;
[0007] Define a batch operation interface for network file system sharing, and based on the connection between the network file system and the data bus, start a loop listening bus thread to monitor the batch operation commands sent by the data bus client for the network file system sharing;
[0008] The corresponding operations are completed according to the batch operation command by using the processing functions registered in the batch operation interface.
[0009] Optionally, the step of acquiring the data bus and registering the basic information of the network file system to the data bus to establish a connection between the network file system and the data bus includes:
[0010] The connection entry of the data bus is obtained through the first preset interface;
[0011] Register a service name for the network file system at the connection entry point through the second preset interface;
[0012] Based on the service name, the interface information of the network file system and the path information corresponding to the interface information are registered to the data bus to establish a connection between the network file system and the data bus.
[0013] Optionally, the batch operation method for sharing a network file system further includes:
[0014] The connection entry of the data bus is obtained through the first preset library function, and the service name, service path and service interface are initialized.
[0015] Based on the connection entry point, the data bus object of the data bus is obtained through the second preset library function, and the interface method that has been registered with the data bus is called according to the data bus object to establish a connection between the data bus client and the data bus.
[0016] Optionally, the step of starting a loop listening bus thread to monitor batch operation commands sent by the data bus client for the network file system share includes:
[0017] The batch operation commands sent by the data bus client through the data bus are recorded in a linked list;
[0018] The callback function address corresponding to the linked list is used for storage, and a loop listening bus thread is started to monitor the linked list through a third preset interface so as to determine the operation corresponding to the message result using the callback function address.
[0019] Optionally, defining a batch operation interface for the network file system share, and based on the connection between the network file system and the data bus, starting a loop listening bus thread to monitor batch operation commands sent by the data bus client for the network file system share, includes:
[0020] The processing function is initialized through the fourth preset interface, and the interface name, interface path, vector entry and interface array of the data bus are registered to define the export operation interface and delete operation interface shared by the network file system.
[0021] Based on the connection between the network file system and the data bus, a loop listening bus thread is started to monitor the batch export commands and / or batch delete commands sent by the data bus client to the network file system share.
[0022] Optionally, after starting a loop listening bus thread to monitor batch export and / or batch delete commands sent by data bus clients to the network file system share based on the connection between the network file system and the data bus, the method further includes:
[0023] When a batch export command shared by the network file system is sent through the data bus client, the batch export command is parsed to determine the file location corresponding to the export configuration file and the first identifier string corresponding to the export configuration file;
[0024] The exported configuration file is loaded into memory according to the file location, and the first identifier string is matched with the existing shared list in the network file system to determine the first success message corresponding to the successful export of the exported configuration file, and / or the first failure message corresponding to the failed export of the exported configuration file and the first identifier string corresponding to the failed export.
[0025] The first success message and / or the first failure message, along with the first identifier string corresponding to the export failure, are returned to the data bus client.
[0026] Optionally, after starting a loop listening bus thread to monitor batch export and / or batch delete commands sent by data bus clients to the network file system share based on the connection between the network file system and the data bus, the method further includes:
[0027] When a batch deletion command shared by the network file system is sent through the data bus client, the batch deletion command is parsed to determine the second identifier string corresponding to the deleted configuration file;
[0028] The second identifier string is matched with the existing shared list in the network file system to determine the second success message corresponding to the successful deletion of the configuration file, and / or the second failure message corresponding to the failed deletion of the configuration file and the second identifier string corresponding to the failed deletion.
[0029] The second success message and / or the second failure message, along with the second identifier string corresponding to the deletion failure, are returned to the data bus client.
[0030] Secondly, this application discloses a batch operation apparatus for sharing a network file system, applied to a network file system, comprising:
[0031] A connection establishment module is used to acquire the data bus and register the basic information of the network file system to the data bus in order to establish a connection between the network file system and the data bus.
[0032] The interface definition module is used to define the batch operation interface for network file system sharing, and based on the connection between the network file system and the data bus, to start a loop listening bus thread to monitor the batch operation commands sent by the data bus client for the network file system sharing.
[0033] The data operation module is used to perform corresponding operations based on the batch operation commands by utilizing the processing functions registered in the batch operation interface.
[0034] Thirdly, this application discloses an electronic device including a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the batch operation method for sharing network file systems as described above.
[0035] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the batch operation method for sharing a network file system as described above.
[0036] This application provides a batch operation method for network file system (NFS) sharing, applied to the NFS, comprising: acquiring a data bus and registering the basic information of the NFS to the data bus to establish a connection between the NFS and the data bus; defining a batch operation interface for NFS sharing, and based on the connection between the NFS and the data bus, starting a loop-listening bus thread to monitor batch operation commands sent by data bus clients for NFS sharing; and using the processing functions registered in the batch operation interface to complete the corresponding operations according to the batch operation commands. It can be seen that, firstly, a connection is established between the NFS service and the data bus, i.e., the NFS acquires the data bus and registers its basic information to the data bus. This allows the NFS service to immediately call the corresponding interface to return request information when a message arrives, thus laying the groundwork for the NFS service commands to use the data bus service and its interface. Secondly, a batch operation interface is defined for NFS sharing, and then a loop-listening bus thread is started based on the connection between the NFS and the data bus to monitor batch operation commands sent by data bus clients for NFS sharing. In this way, the interface is customized before the loop-listening bus thread, eliminating the need for internal message processing within a loop, resulting in a clear structure. When using batch operation shared commands, the batch operation interface is directly invoked, utilizing the pre-registered processing functions to complete the corresponding tasks. As described above, a basic framework is established, through which the command initiating process can communicate via the data bus. This significantly improves the user experience of the network file system service, greatly enhances its usability, and improves the management efficiency of network file system sharing.
[0037] Furthermore, the batch operation apparatus, device, and storage medium for sharing a network file system provided in this application correspond to the aforementioned batch operation method for sharing a network file system and have the same effect. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0039] Figure 1 This application discloses a flowchart of a batch operation method for sharing a network file system.
[0040] Figure 2 This is a schematic diagram of the program structure for sharing a network file system as disclosed in this application;
[0041] Figure 3 This application discloses a flowchart of a specific batch operation method for sharing a network file system.
[0042] Figure 4 This is a schematic diagram illustrating the batch export of a network file system shared in this application;
[0043] Figure 5 This is a schematic diagram of a batch operation device for sharing a network file system, as disclosed in this application.
[0044] Figure 6 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0046] Currently, network file system (NFS) share management is designed for individual shares. There is a lack of a standard interface for batch exporting or deleting thousands of shares, which leads to significant efficiency issues in share management and restricts the use of NFS shares.
[0047] Therefore, this application provides a batch operation scheme for network file system sharing, which can quickly realize batch export and batch deletion of network file system sharing, thereby improving the management efficiency and user experience of network file system services.
[0048] This invention discloses a batch operation method for sharing a network file system, see [link to relevant documentation]. Figure 1 As shown, applied to a network file system, the method includes:
[0049] Step S11: Obtain the data bus and register the basic information of the network file system to the data bus to establish a connection between the network file system and the data bus.
[0050] In this embodiment, the network file system service process first establishes a connection with the data bus (DBUS). That is, the network file system service acquires the data bus and registers its basic information with it. This allows the network file system service to immediately call the corresponding interface to return the requested information when a message arrives.
[0051] In one specific implementation, the connection entry point of the data bus is obtained through a first preset interface; a service name for the network file system at the connection entry point is registered through a second preset interface; and according to the service name, the interface information of the network file system and the path information corresponding to the interface information are registered to the data bus to establish a connection between the network file system and the data bus. Specifically, the network file system service uses the first preset interface dbus_bus_get to obtain the connection entry point dbus_conn of the data bus; then it calls the second preset interface dbus_bus_request_name to register a name for this connection dbus_conn, such as "org.ganesha.nfsd". This gives the network file system service a data bus entry point, and then the network file system's interface, path, and other information are registered to the data bus to establish a connection between the network file system and the data bus.
[0052] For example, the interface structure of the data bus is as follows:
[0053]
[0054]
[0055] In another specific implementation, the connection entry point of the data bus is obtained through a first preset library function, and the service name, service path, and service interface are initialized. Based on the connection entry point, the data bus object of the data bus is obtained through a second preset library function, and the interface method of the data bus that has been registered is called according to the data bus object to establish a connection between the data bus client and the data bus. Specifically, the network file system service command initiator, that is, the data bus client, can use the Python dbus library functions to quickly establish a connection with the data bus. The connection entry point of the data bus is obtained through dbus.SystemBus(), the service name, service path, and service interface are initialized, the data bus object is obtained through get_object(), and then the interface method of the data bus object, get_dbus_method(), is used to call the interface method of the registered data bus interface to implement the interface functionality.
[0056] In this embodiment, once both the network file system and the data bus client have established a connection with the data bus, subsequent use of batch operation sharing commands will directly invoke the batch operation sharing interface to complete the corresponding function. This lays the groundwork for the network file system service commands to use the data bus service and its interface.
[0057] Step S12: Define the batch operation interface for the network file system share, and based on the connection between the network file system and the data bus, start a loop listening bus thread to monitor the batch operation commands sent by the data bus client for the network file system share.
[0058] The current problem is the lack of a standard interface to implement batch operations for sharing. Therefore, in this embodiment, a batch operation interface for network file system sharing is defined to initialize the batch operation interface. For example, the interface definitions for batch adding and batch deleting shared files are as follows:
[0059]
[0060] It should be noted that when defining the batch operation interface for network file system shares, the dbus_connection_register_object_path interface is used to initialize various processing functions of the network file system service. The processing functions for batch operation shares, such as batch export of shares and batch deletion of shares, are registered here.
[0061] In this embodiment, after the batch operation interface shared by the network file system is defined, a loop listening bus thread is started based on the connection between the network file system and the data bus to listen for bus messages in a while loop. Once a message is received, the corresponding processing function is started to handle it. In this way, the overall structure calls `dbus_connection_register_object_path` to register the path before the while loop. The advantage of this approach is that it eliminates the need for message processing within the loop, resulting in a clear structure.
[0062] In a network file system (NFS) service, exporting and deleting shared network files involves a front-end command acting as a data bus client. Through data bus technology, the front-end command is transmitted to the NFS service. After executing the corresponding action, the NFS service returns the service or parameter status, or the execution result, to the front-end command and displays it to the user. Unlike exporting and deleting a single share, batch operations on multiple shared network files are more complex. For example... Figure 2 The diagram shows the overall program structure. In each loop, the `dbus_connection_read_write_dispatch` interface is used to listen for and process command messages sent from the data bus. It should be noted that in this embodiment, a linked list is used to record the command messages sent from the data bus. The linked list is traversed once in each loop, and the corresponding callback function is called to perform the appropriate operations.
[0063] Specifically, the batch operation commands sent by the data bus client through the data bus are recorded in a linked list; the callback function addresses corresponding to the linked list are stored, and a loop-listening bus thread is started to monitor the linked list through a third preset interface, so as to determine the operation corresponding to the message result using the callback function address. It should be noted that the third preset interface dbus_connection_read_write_dispatch is continuously blocked waiting for command messages to be transmitted by the data bus. After the batch operation command is initiated, it will continue to block, thus being captured by the network file system service process until the data bus returns the result, or until it times out. As described above, a basic framework is established, through which the command initiating process can communicate with the data bus.
[0064] Step S13: Use the processing function registered in the batch operation interface to complete the corresponding operation according to the batch operation command.
[0065] In this embodiment, the processing function is pre-registered when the batch operation interface is defined, and the processing function is placed in the DBusObjectPathVTable structure. When the data bus client sends batch operation commands, such as batch delete or batch export commands, for network file system shares through the data bus, the message_function in the DBusObjectPathVTable structure points to the processing function. In the processing function, the message type is determined and processed, the actual interface method is called, and the result is returned to the data bus client after completion.
[0066] This application provides a batch operation method for network file system (NFS) sharing, applied to the NFS, comprising: acquiring a data bus and registering the basic information of the NFS to the data bus to establish a connection between the NFS and the data bus; defining a batch operation interface for NFS sharing, and based on the connection between the NFS and the data bus, starting a loop-listening bus thread to monitor batch operation commands sent by data bus clients for NFS sharing; and using the processing functions registered in the batch operation interface to complete the corresponding operations according to the batch operation commands. It can be seen that, firstly, a connection is established between the NFS service and the data bus, i.e., the NFS acquires the data bus and registers its basic information to the data bus. This allows the NFS service to immediately call the corresponding interface to return request information when a message arrives, thus laying the groundwork for the NFS service commands to use the data bus service and its interface. Secondly, a batch operation interface is defined for NFS sharing, and then a loop-listening bus thread is started based on the connection between the NFS and the data bus to monitor batch operation commands sent by data bus clients for NFS sharing. In this way, the interface is customized before the loop-listening bus thread, eliminating the need for internal message processing within a loop, resulting in a clear structure. When using batch operation shared commands, the batch operation interface is directly invoked, utilizing the pre-registered processing functions to complete the corresponding tasks. As described above, a basic framework is established, through which the command initiating process can communicate via the data bus. This significantly improves the user experience of the network file system service, greatly enhances its usability, and improves the management efficiency of network file system sharing.
[0067] This application discloses a specific batch operation method for sharing a network file system. See [link to relevant documentation]. Figure 3 As shown, applied to a network file system, the method includes:
[0068] Step S21: Obtain the data bus and register the basic information of the network file system to the data bus to establish a connection between the network file system and the data bus.
[0069] For a more detailed description of the process of step S21, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0070] Step S22: Initialize the processing function through the fourth preset interface, and register the interface name, interface path, vector entry and interface array of the data bus to define the export operation interface and delete operation interface shared by the network file system.
[0071] In this embodiment of the application, the fourth preset interface dbus_connection_register_object_path is used to register the interface name, path, vector entry, and interface array for using the data bus service. This interface array contains a series of network file system interface names and their actual actions.
[0072] Step S23: Based on the connection between the network file system and the data bus, start a loop listening bus thread to monitor the batch export commands and / or batch delete commands sent by the data bus client for the network file system share.
[0073] In this embodiment, the batch export of shared files can be accomplished by passing two parameters: one is the location of the export configuration file, and the other is a comma-separated string of the share IDs of the exported configuration files to be added (the configuration files must be configured beforehand). The batch deletion of shared files can be accomplished by passing one parameter: a comma-separated string of the share IDs of the configuration files to be deleted (the configuration files must be configured beforehand).
[0074] On the data bus server (NFS-ganesha), that is, the network file system side, after detecting the batch operation commands (such as batch export shares and batch delete shares) sent by the data bus client, it will call the corresponding registered bus methods, namely the batch export share interface and the batch delete share interface.
[0075] In one specific implementation, after starting a loop listening bus thread to monitor batch export commands and / or batch delete commands sent by the data bus client to the network file system share based on the connection between the network file system and the data bus, the method further includes: when a batch export command to the network file system share is sent through the data bus client, parsing the batch export command to determine the file location corresponding to the export configuration file and the first identifier string corresponding to the export configuration file; loading the export configuration file into memory according to the file location, and matching the first identifier string with the existing list of shares in the network file system to determine the first success message corresponding to the successful export of the export configuration file, and / or the first failure message corresponding to the failed export of the export configuration file and the first identifier string corresponding to the failed export; and returning the first success message and / or the first failure message and the first identifier string corresponding to the failed export to the data bus client.
[0076] In this embodiment, since the parameters are transmitted from the data bus, the data bus parameters are first parsed and converted into basic types, such as parsing the shared ID list string into multiple shared IDs. Then, the configuration file is loaded into memory and its fields are parsed. Each ID uniquely identifies a share. A matching shared ID is searched for. If no match is found, the addition fails. If a match is found but the share does not exist in the network file system, the corresponding share is created. If the addition fails, the failed shared ID is returned. If a match is found but the share already exists in the network file system, it means the share already exists and does not need to be created; in this case, success is returned. The failed shared IDs are separated by commas and strung together into a string, which is returned to the command line (i.e., the data bus client) according to the data bus's agreed rules, so the user can know which shares failed to be exported. If there are no failures, a batch export of shares is returned as successful. The entire process is as follows: Figure 4 As shown.
[0077] In another specific implementation, after starting a loop listening bus thread to monitor batch export commands and / or batch delete commands sent by the data bus client for the network file system shares based on the connection between the network file system and the data bus, the method further includes: when a batch delete command for the network file system shares is sent through the data bus client, parsing the batch delete command to determine a second identifier string corresponding to the deleted configuration file; matching the second identifier string with the existing list of shares in the network file system to determine a second success message corresponding to successful deletion of the configuration file, and / or a second failure message corresponding to failed deletion of the configuration file and a second identifier string corresponding to the deletion failure; and returning the second success message and / or the second failure message and the second identifier string corresponding to the deletion failure to the data bus client.
[0078] In this embodiment, the batch deletion operation of shares is similar to the batch export operation. First, the pre-defined string transmitted from the data bus is parsed. This string represents a set of comma-separated IDs of the shares to be deleted. Then, the system searches whether the ID of the share to be deleted exists in the network file system. If a match is found, the share exists and can be deleted, and the interface is called to delete the share. If deletion fails, a failure message is returned along with the share ID. If no match is found, the share does not exist, and the deletion result is returned as successful. The comma-separated IDs of the shares that failed to be deleted are assembled into a string and returned to the command line (i.e., the data bus client) according to the data bus's pre-defined rules. This allows the user to know which shares failed to be deleted; if no deletions failed, a successful batch deletion of shares is returned.
[0079] Step S24: Use the processing function registered in the batch operation interface to complete the corresponding operation according to the batch operation command.
[0080] For a more detailed explanation of step S24, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0081] This application provides a batch operation method for network file system sharing, applied to a network file system, comprising: acquiring a data bus and registering the basic information of the network file system to the data bus to establish a connection between the network file system and the data bus; initializing the processing function through a fourth preset interface and registering the interface name, interface path, vector entry, and interface array of the data bus to define the export operation interface and delete operation interface of the network file system sharing; based on the connection between the network file system and the data bus, starting a loop listening bus thread to monitor batch export commands and / or batch delete commands sent by the data bus client for the network file system sharing; and using the processing function registered in the batch operation interface to complete the corresponding operation according to the batch operation command. It can be seen that, firstly, a connection is established between the network file system service and the data bus, that is, the network file system needs to acquire the data bus and register its basic information to the data bus. This way, once a message arrives, the network file system service can immediately call the corresponding interface to return the request information, thus laying the groundwork for the network file system service commands to use the data bus service and its interface. Secondly, a batch operation interface is defined for batch operations on network file system (NFS) shares. Then, based on the connection between the NFS and the data bus, a looping bus listening thread is started to monitor batch operation commands sent by data bus clients for NFS shares. In this way, the interface is customized before the looping bus listening thread, eliminating the need for internal message processing within the loop, resulting in a clear structure. When a batch operation command is used, the batch operation interface is directly invoked, utilizing its pre-registered processing functions to complete the corresponding functionality. As described above, a basic framework is established, through which the command initiating process can communicate with the data bus. This significantly improves the user experience of the NFS service, greatly enhances the ease of use of the NFS, and improves the management efficiency of NFS shares.
[0082] Accordingly, embodiments of this application also disclose a batch operation device for sharing a network file system, see [link to relevant documentation]. Figure 5 As shown, the device, applied to a network file system, includes:
[0083] The connection establishment module 11 is used to acquire the data bus and register the basic information of the network file system to the data bus in order to establish a connection between the network file system and the data bus.
[0084] Interface definition module 12 is used to define the batch operation interface for network file system sharing, and based on the connection between the network file system and the data bus, start a loop listening bus thread to monitor the batch operation commands sent by the data bus client for the network file system sharing;
[0085] The data operation module 13 is used to complete the corresponding operation according to the batch operation command by utilizing the processing function registered in the batch operation interface.
[0086] For more detailed information on the working process of each of the above modules, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0087] Therefore, the above-described solution in this embodiment, applied to a network file system, includes: acquiring a data bus and registering the basic information of the network file system with the data bus to establish a connection between the network file system and the data bus; defining a batch operation interface shared by the network file system, and based on the connection between the network file system and the data bus, starting a loop-listening bus thread to monitor batch operation commands sent by data bus clients for the network file system sharing; and using the processing functions registered in the batch operation interface to complete the corresponding operations according to the batch operation commands. It is evident that firstly, the network file system service establishes a connection with the data bus, i.e., the network file system acquires the data bus and registers its basic information with it. This allows the network file system service to immediately call the corresponding interface to return request information when a message arrives, thus paving the way for the network file system service commands to use the data bus service and its interface. Secondly, a batch operation interface is defined for batch operations on the network file system sharing, and then, based on the connection between the network file system and the data bus, a loop-listening bus thread is started to monitor batch operation commands sent by data bus clients for the network file system sharing. In this way, the interface customization is completed before the loop-listening bus thread, eliminating the need for internal message processing within a loop, resulting in a clear structure. When using batch operation shared commands, the batch operation interface is directly invoked, utilizing the pre-registered processing functions to complete the corresponding tasks. As described above, a basic framework is established, through which the command initiating process can communicate via the data bus. This significantly improves the user experience of the network file system service, greatly enhances its usability, and improves the management efficiency of network file system sharing.
[0088] In one specific implementation, the connection establishment module 11 includes:
[0089] The first connection entry acquisition unit is used to acquire the connection entry of the data bus through a first preset interface;
[0090] The name registration unit is used to register a service name for the connection entry network file system through a second preset interface;
[0091] The information registration unit is used to register the interface information of the network file system and the path information corresponding to the interface information to the data bus according to the service name, so as to establish a connection between the network file system and the data bus.
[0092] In one specific implementation, the batch operation device shared by the network file system further includes:
[0093] The second connection entry acquisition unit is used to acquire the connection entry of the data bus through the first preset library function, and initialize the service name, service path and service interface;
[0094] The method invocation unit is used to obtain the data bus object of the data bus through the second preset library function based on the connection entry, and to call the interface method that has been registered with the data bus according to the data bus object, so as to establish a connection between the network file system and the data bus.
[0095] In one specific implementation, the interface definition module 12 includes:
[0096] A recording unit is used to record the batch operation commands sent by the data bus client through the data bus using a linked list;
[0097] The traversal unit is used to store the callback function address corresponding to the linked list and start a loop listening bus thread to monitor the linked list through a third preset interface so as to determine the operation corresponding to the message result using the callback function address.
[0098] In one specific implementation, the interface definition module 12 includes:
[0099] The information registration unit is used to initialize the processing function through the fourth preset interface and register the interface name, interface path, vector entry and interface array of the data bus to define the export operation interface and delete operation interface shared by the network file system.
[0100] The command monitoring module is used to start a loop listening bus thread to monitor batch export commands and / or batch delete commands sent by data bus clients to the network file system share, based on the connection between the network file system and the data bus.
[0101] In one specific implementation, the command monitoring module further includes:
[0102] The export configuration file information determination unit is used to parse the batch export command when the data bus client sends a batch export command shared by the network file system, so as to determine the file location corresponding to the export configuration file and the first identifier string corresponding to the export configuration file;
[0103] The first message result determination unit is used to load the exported configuration file into memory according to the file location, and match the first identifier string with the existing shared list in the network file system to determine the first success message corresponding to the successful export of the exported configuration file, and / or the first failure message corresponding to the failed export of the exported configuration file and the first identifier string corresponding to the failed export.
[0104] The first message result return unit is used to return the first success message and / or the first failure message, as well as the first identifier string corresponding to the export failure, to the data bus client.
[0105] In one specific implementation, the command monitoring module further includes:
[0106] The configuration file information determination unit is used to parse the batch deletion command when the data bus client sends a batch deletion command shared by the network file system to determine the second identifier string corresponding to the configuration file to be deleted.
[0107] The second message result determination unit is used to match the second identifier string with the existing shared list in the network file system to determine the second success message corresponding to the successful deletion of the configuration file, and / or the second failure message corresponding to the failed deletion of the configuration file and the second identifier string corresponding to the failed deletion.
[0108] The second message result return unit is used to return the second success message and / or the second failure message, as well as the second identifier string corresponding to the deletion failure, to the data bus client.
[0109] Furthermore, embodiments of this application also disclose an electronic device, Figure 6This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0110] Figure 6 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the batch operation method for sharing a network file system disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0111] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0112] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it can include an operating system 221, computer programs 222, and data 223, etc. The data 223 can include various types of data. The storage method can be temporary storage or permanent storage.
[0113] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the batch operation method of network file system sharing disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0114] Furthermore, this application also discloses a computer-readable storage medium, which includes random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, optical disks, or any other form of storage medium known in the art. The computer program, when executed by a processor, implements the aforementioned batch operation method for sharing within a network file system. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0115] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0116] The steps of the batch operations or algorithms for network file system sharing described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the art.
[0117] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply 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. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0118] The above provides a detailed description of a batch operation method, apparatus, device, and medium for sharing a network file system provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A batch operation method for sharing a network file system, characterized in that, Applied to network file systems, including: Acquire the data bus and register the basic information of the network file system to the data bus to establish a connection between the network file system and the data bus; Define a batch operation interface for network file system sharing, and based on the connection between the network file system and the data bus, start a loop listening bus thread to monitor the batch operation commands sent by the data bus client for the network file system sharing; Using the processing functions registered in the batch operation interface, the corresponding operations are completed according to the batch operation commands; The step of acquiring the data bus and registering the basic information of the network file system to the data bus to establish a connection between the network file system and the data bus includes: The connection entry of the data bus is obtained through the first preset interface; Register a service name for the network file system at the connection entry point through the second preset interface; Based on the service name, the interface information of the network file system and the path information corresponding to the interface information are registered to the data bus to establish a connection between the network file system and the data bus. The batch operation method for the network file system sharing also includes: The connection entry of the data bus is obtained through the first preset library function, and the service name, service path and service interface are initialized. Based on the connection entry point, the data bus object of the data bus is obtained through the second preset library function, and the interface method that has been registered with the data bus is called according to the data bus object to establish a connection between the data bus client and the data bus.
2. The batch operation method for sharing a network file system according to claim 1, characterized in that, The startup of the loop listening bus thread monitors the batch operation commands sent by the data bus client to the network file system share, including: The batch operation commands sent by the data bus client through the data bus are recorded in a linked list; The callback function address corresponding to the linked list is used for storage, and a loop listening bus thread is started to monitor the linked list through a third preset interface so as to determine the operation corresponding to the message result using the callback function address.
3. The batch operation method for sharing a network file system according to claim 1 or 2, characterized in that, The definition of the batch operation interface for the network file system share, and based on the connection between the network file system and the data bus, the starting of a loop listening bus thread to monitor the batch operation commands sent by the data bus client for the network file system share, includes: The processing function is initialized through the fourth preset interface, and the interface name, interface path, vector entry and interface array of the data bus are registered to define the export operation interface and delete operation interface shared by the network file system. Based on the connection between the network file system and the data bus, a loop listening bus thread is started to monitor the batch export commands and / or batch delete commands sent by the data bus client to the network file system share.
4. The batch operation method for sharing a network file system according to claim 3, characterized in that, After starting a loop-listening bus thread to monitor batch export and / or batch delete commands sent by data bus clients to the network file system share based on the connection between the network file system and the data bus, the method further includes: When a batch export command shared by the network file system is sent through the data bus client, the batch export command is parsed to determine the file location corresponding to the export configuration file and the first identifier string corresponding to the export configuration file; The exported configuration file is loaded into memory according to the file location, and the first identifier string is matched with the existing shared list in the network file system to determine the first success message corresponding to the successful export of the exported configuration file, and / or the first failure message corresponding to the failed export of the exported configuration file and the first identifier string corresponding to the failed export. The first success message and / or the first failure message, along with the first identifier string corresponding to the export failure, are returned to the data bus client.
5. The batch operation method for sharing a network file system according to claim 3, characterized in that, After starting a loop-listening bus thread to monitor batch export and / or batch delete commands sent by data bus clients to the network file system share based on the connection between the network file system and the data bus, the method further includes: When a batch deletion command shared by the network file system is sent through the data bus client, the batch deletion command is parsed to determine the second identifier string corresponding to the deleted configuration file; The second identifier string is matched with the existing shared list in the network file system to determine the second success message corresponding to the successful deletion of the configuration file, and / or the second failure message corresponding to the failed deletion of the configuration file and the second identifier string corresponding to the failed deletion. The second success message and / or the second failure message, along with the second identifier string corresponding to the deletion failure, are returned to the data bus client.
6. A batch operation device for sharing a network file system, characterized in that, Applied to network file systems, including: A connection establishment module is used to acquire the data bus and register the basic information of the network file system to the data bus in order to establish a connection between the network file system and the data bus. The interface definition module is used to define the batch operation interface for network file system sharing, and based on the connection between the network file system and the data bus, to start a loop listening bus thread to monitor the batch operation commands sent by the data bus client for the network file system sharing. The data operation module is used to perform corresponding operations according to the batch operation command by utilizing the processing functions registered in the batch operation interface. The connection establishment module includes: The first connection entry acquisition unit is used to acquire the connection entry of the data bus through a first preset interface; The name registration unit is used to register a service name for the connection entry network file system through a second preset interface; An information registration unit is used to register the interface information of the network file system and the path information corresponding to the interface information to the data bus according to the service name, so as to establish a connection between the network file system and the data bus. The batch operation device shared by the network file system also includes: The second connection entry acquisition unit is used to acquire the connection entry of the data bus through the first preset library function, and initialize the service name, service path and service interface; The method invocation unit is used to obtain the data bus object of the data bus through the second preset library function based on the connection entry, and to call the interface method that has been registered with the data bus according to the data bus object, so as to establish a connection between the data bus client and the data bus.
7. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the batch operation method for sharing a network file system as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein the computer programs, when executed by a processor, implement the batch operation method for sharing a network file system as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for realizing network equipment CLI (Command Line Interface for batch scripti) based on dynamic configuration
CN101924656A
Network file system-based authority control method and system
CN107748849A