CN107357524B - File storage method, file reading method and electronic equipment - Google Patents

File storage method, file reading method and electronic equipment Download PDF

Info

Publication number
CN107357524B
CN107357524B CN201710525735.XA CN201710525735A CN107357524B CN 107357524 B CN107357524 B CN 107357524B CN 201710525735 A CN201710525735 A CN 201710525735A CN 107357524 B CN107357524 B CN 107357524B
Authority
CN
China
Prior art keywords
storage device
network storage
network
electronic device
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710525735.XA
Other languages
Chinese (zh)
Other versions
CN107357524A (en
Inventor
刘念林
吴新勇
邱吉刚
李汶隆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Jiuzhou Electric Group Co Ltd
Original Assignee
Sichuan Jiuzhou Electric Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Jiuzhou Electric Group Co Ltd filed Critical Sichuan Jiuzhou Electric Group Co Ltd
Priority to CN201710525735.XA priority Critical patent/CN107357524B/en
Publication of CN107357524A publication Critical patent/CN107357524A/en
Application granted granted Critical
Publication of CN107357524B publication Critical patent/CN107357524B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0635Configuration or reconfiguration of storage systems by changing the path, e.g. traffic rerouting, path reconfiguration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Abstract

The invention discloses a method for storing a file, a method for reading the file and electronic equipment, which are used for solving the technical problem of high difficulty in using and managing network storage equipment in the prior art, wherein the method for storing the file is applied to the electronic equipment, the electronic equipment is connected with at least one network storage equipment in a network storage system, and the method for storing the file comprises the following steps: a business logic component in the middleware of the electronic equipment obtains a first write operation request for storing a first file; the business logic component determines a first network storage device corresponding to the first network storage device identifier from at least one network storage device based on the first network storage device identifier included in the first write operation request; a storage management component in the middleware mounts the first network storage device on the electronic device; the storage management component stores the first file in a first network storage device.

Description

File storage method, file reading method and electronic equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method for storing a file, a method for reading a file, and an electronic device.
Background
The appearance of Network storage technology meets the increasing data storage demand of people, and in order to meet the personalized and differentiated data storage demand of different users, various types of Network storage protocols are provided in the prior art, such as NFS (Network File System), CIFS (Common Internet File System), ISCSI (Internet Small Computer System Interface), and the like based on File-level storage.
However, the difficulty of using network storage devices by users is increased by the various network storage protocols, and users need to have related technical knowledge to correctly use different network storage protocols; in addition, in the prior art, when the electronic device is connected with a plurality of network storage devices at the same time, a user needs to control and manage each network storage device one by one, which is difficult to manage.
Therefore, the technical problem that the difficulty in using and managing the network storage device is high exists in the prior art.
Disclosure of Invention
The embodiment of the invention provides a method for storing a file, a method for reading the file and electronic equipment, which are used for solving the technical problem that the difficulty in using and managing network storage equipment in the prior art is high.
In a first aspect, a method for storing a file is provided, where the method is applied in an electronic device, and the electronic device is connected to at least one network storage device in a network storage system, and the method includes:
a business logic component in the middleware of the electronic equipment obtains a first write operation request for storing a first file;
the business logic component determines a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first write operation request;
a storage management component in the middleware mounts the first network storage device onto the electronic device;
the storage management component stores the first file in the first network storage device.
In one possible implementation, before the storage management component in the middleware mounts the first network storage device onto the electronic device, the method further includes:
the business logic component determines a first mounting mode corresponding to a first storage type based on the first storage type included in the first write operation request;
the mounting of the first network storage device onto the electronic device by a storage management component in the middleware comprises:
and mounting the first network storage device to the electronic device by a storage management component in the middleware in the first mounting mode so as to obtain a mounting path for accessing the first network storage device in the electronic device.
In a possible implementation manner, when the first storage type is file-level storage, the determining, by the service logic component, a first mount manner corresponding to the first storage type based on the first storage type included in the first write operation request includes:
the business logic component determines that a network mapping mode corresponding to the file-level storage is the first mounting mode;
the mounting of the first network storage device onto the electronic device by a storage management component in the middleware comprises:
and the storage management component mounts the first network storage device onto the electronic device in the network mapping mode to obtain the network address of the first network storage device as the mounting path.
In a possible implementation manner, when the first storage type is data block storage, the determining, by the service logic component, a first mount manner corresponding to the first storage type based on the first storage type included in the first write operation request includes:
the service logic component determines that a synchronous volume mounting mode corresponding to the data block storage is the first mounting mode;
the mounting of the first network storage device onto the electronic device by a storage management component in the middleware comprises:
and the storage management component mounts the first network storage device to a preset path on the electronic device in the synchronous volume mount mode to obtain the preset path as the mount path.
In one possible implementation manner, the storing the first file in the first network storage device by the storage management component includes:
the storage management component stores the first file in the first network storage device based on the mount path.
In a second aspect, a method for reading a file is provided, and is applied to an electronic device, where the electronic device is connected to at least one network storage device in a network storage system, and the method includes:
a business logic component in the middleware of the electronic equipment obtains a first read operation request for reading a first file;
the business logic component determines a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first read operation request;
the business logic component determines a reading path of the first file based on a mount path of the electronic equipment for accessing the first network storage equipment and a storage path of the first file in the first network storage equipment;
and reading the first file by a storage management component in the middleware based on the reading path.
In one possible implementation, before the business logic component determines the read path of the first file, the method further includes:
the business logic component determines whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component mounts the first network storage device on the electronic device in a network mapping manner to obtain a network address of the first network storage device as the mounting path.
In one possible implementation, before the business logic component determines the read path of the first file, the method further includes:
the business logic component determines whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component mounts a preset path from the first network storage device to the electronic device in a synchronous volume mounting mode so as to obtain a network address of the first network storage device as the mounting path.
In a third aspect, an electronic device is provided, the electronic device being connected to at least one network storage device in a network storage system, the electronic device comprising middleware, the middleware comprising a business logic component and a storage management component, wherein:
the business logic component is used for obtaining a first write operation request for storing a first file; determining a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first write operation request;
the storage management component is used for mounting the first network storage device on the electronic device; storing the first file in the first network storage device.
In one possible implementation, before the storage management component mounts the first network storage device onto the electronic device, the business logic component is further configured to:
determining a first mounting mode corresponding to a first storage type based on the first storage type included in the first write operation request;
the storage management component mounts the first network storage device onto the electronic device, including:
and the storage management component mounts the first network storage device onto the electronic device in the first mounting mode to obtain a mounting path for accessing the first network storage device in the electronic device.
In a possible implementation manner, when the first storage type is file-level storage, the determining, by the service logic component, a first mount manner corresponding to the first storage type based on the first storage type included in the first write operation request includes:
the business logic component determines that a network mapping mode corresponding to the file-level storage is the first mounting mode;
the storage management component mounts the first network storage device onto the electronic device, including:
and the storage management component mounts the first network storage device onto the electronic device in the network mapping mode to obtain the network address of the first network storage device as the mounting path.
In a possible implementation manner, when the first storage type is data block storage, the determining, by the service logic component, a first mount manner corresponding to the first storage type based on the first storage type included in the first write operation request includes:
the service logic component determines that a synchronous volume mounting mode corresponding to the data block storage is the first mounting mode;
the storage management component mounts the first network storage device onto the electronic device, including:
and the storage management component mounts the first network storage device to a preset path on the electronic device in the synchronous volume mount mode to obtain the preset path as the mount path.
In one possible implementation manner, the storing the first file in the first network storage device by the storage management component includes:
the storage management component stores the first file in the first network storage device based on the mount path.
In a fourth aspect, another electronic device is provided, where the electronic device is connected to at least one network storage device in a network storage system, and the electronic device includes a middleware, where the middleware includes a business logic component and a storage management component, where:
the business logic component is used for obtaining a first read operation request for reading a first file; determining a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first read operation request; determining a reading path of the first file based on a mount path of the electronic equipment for accessing the first network storage equipment and a storage path of the first file in the first network storage equipment;
the storage management component is used for reading the first file based on the reading path.
In a possible implementation manner, before the business logic component determines the read path of the first file, the business logic component is further configured to:
determining whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component is further configured to:
and mounting the first network storage device on the electronic device in a network mapping mode to obtain the network address of the first network storage device as the mounting path.
In a possible implementation manner, before the business logic component determines the read path of the first file, the business logic component is further configured to:
determining whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component is further configured to:
and mounting the first network storage device to a preset path on the electronic device in a synchronous volume mounting mode to obtain a network address of the first network storage device as the mounting path.
The method for storing the file, the method for reading the file and the electronic device adopt the design of the middleware framework to uniformly manage at least one network storage device connected to the electronic device, thereby greatly reducing the difficulty of using and managing the network storage device by a user.
Furthermore, in the embodiment of the present invention, the service logic and the storage management are separated, when the user uses the network storage device, only the interaction with the service logic component is needed, the service logic component abstracts the service logic of the user and converts the service logic into a specific operation on the network storage device, and the storage management component performs the specific operation and management on the network storage device. In the whole process of realizing the user service logic, the user does not need to specifically operate the network storage device, the operation difficulty of the user is reduced, and the network storage device can be conveniently used even for the user without network storage related professional knowledge.
Furthermore, in the embodiment of the present invention, the service logic and the storage management are separated by the middleware, so that a direct service call interface of the network storage device can be provided for a user, and the adaptability and the portability of the method for storing a file, the method for reading a file, and the electronic device in the embodiment of the present invention are improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a schematic diagram illustrating a connection relationship between an electronic device and a network storage device according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of storing files in an embodiment of the invention;
FIG. 3 is a flowchart of a method for reading a file according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the invention;
fig. 5 is a schematic structural diagram of another electronic device in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In addition, the term "and/or" herein is only one kind of association relationship describing an associated object, and means that there may be three kinds of relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in this document generally indicates that the preceding and following related objects are in an "or" relationship unless otherwise specified.
In the embodiment of the present invention, the electronic device may include a mobile phone, a PAD (tablet computer), a PC (personal computer), a laptop, a wearable electronic device (for example, a smart watch), a server, and other electronic devices, and the specific type of the electronic device is not limited in the embodiment of the present invention.
In the embodiment of the present invention, the network storage device may be a storage device connected to the electronic device through a wired network or a wireless network, and the connection between the network storage device and the electronic device may be a direct connection or an indirect connection through a network device such as a router, a gateway, and a switch. Specifically, the Network Storage device may be an IPSAN (IP Storage Area Network, Storage Area Network based on an IP Network) Storage device, an NAS (Network Attached Storage) Storage device, a disk array, a CD/DVD drive, a tape drive, or a removable Storage medium, and the like.
In this embodiment of the present invention, a network storage system may be formed by at least one network storage device, please refer to fig. 1, where fig. 1 is a schematic diagram illustrating a connection relationship between an electronic device and at least one network storage device in the network storage system according to an embodiment of the present invention.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
In the following detailed description, the method for storing a file, the method for reading a file, and the electronic device according to the embodiments of the present invention will be described in detail in four aspects.
It should be understood that, in the embodiment of the present invention, the method for storing a file provided in the first aspect and the method for reading a file provided in the second aspect may be used in an electronic device simultaneously as a complement to each other, or may be used in an electronic device separately as an independent method; in a specific implementation process, the method for storing a file provided in the first aspect and the method for reading a file provided in the second aspect may be implemented by the same software or hardware, or may be implemented by different software or hardware; in addition, the electronic device provided in the third aspect and the electronic device provided in the fourth aspect may be the same electronic device or different electronic devices.
In a first aspect, please refer to fig. 2, an embodiment of the present invention provides a method for storing a file, where the method may be applied to an electronic device, that is, an execution subject of each step in the method may be the electronic device described above, and the electronic device may be connected to at least one network storage device in a network storage system. The process of the method is described as follows:
step 101: a business logic component in middleware of an electronic device obtains a first write operation request for storing a first file.
In the embodiment of the invention, the method for storing the file can be executed in the electronic equipment in a middleware mode. Specifically, the middleware includes a service logic component, and the service logic component can obtain a service requirement of a user, that is, a problem that the user wants to solve through a network storage device, for example, the service logic may be to store a certain movie to a certain network storage device, copy a picture from a certain path in a certain network storage device, create a folder in a root directory of a certain network storage device, and so on.
In the embodiment of the present invention, the first write operation request is used to instruct to store the first file, that is, to write data to the network storage device. The storing of the first file may be storing a packaged complete file such as a document, a picture, a compressed packet, or storing unpackaged data, or writing an instruction to be executed by the network storage device into the network storage device, or the like. For ease of understanding, in the subsequent description of the first aspect, the storage of "movie. mp 4" is illustrated as storing the first file.
In the embodiment of the present invention, there are various ways for the business logic component to obtain the first write operation request, for example, obtaining an instruction including the first write operation request through a calling interface provided by the middleware to a user; for another example, the middleware may provide a graphical user interface to the user, and the user may input the first write operation request by operating an icon on the user interface, such as dragging an icon of "movie. mp 4" to overlap with an icon of a certain network storage device in the user interface, which may indicate that "movie. mp 4" is stored in the network storage device.
Step 102: and the business logic component determines a first network storage device corresponding to the first network storage device identification from the at least one network storage device based on the first network storage device identification included in the first write operation request.
In the embodiment of the present invention, after obtaining the first write operation request in step 101, the service logic component abstracts the directly obtained first write operation request, that is, converts the problem that the user wants to solve through the first write operation request into a specific operation on the network storage device.
In step 102, the business logic component parses the first write operation request to obtain valid data included in the first write operation request for indicating execution of storing the first file. In this embodiment of the present invention, the first write operation request may include the first network storage device identifier. The first network storage device is a network storage device to which the user wants to store the first file, and the first network storage device identification may include identifications of one or more network storage devices, for example, when the user wants to store "movie. mp 4" to two network storage devices at the same time, the first network storage device identification may include identifications of the two network storage devices at the same time.
Specifically, the first network storage device identification may be a network address of the electronic device communicating with the first network storage device, or an identification code, a name, or the like of the first network storage device. In turn, the business logic component can determine the network storage device having the first network storage device identification as the first network storage device. In this embodiment of the present invention, the electronic device may further include a correspondence table between the network storage device identifier and the network storage device, and the network storage device corresponding to the first network storage device identifier may be determined as the first network storage device by querying the correspondence table, and the first network storage device may also be determined by querying an Address Resolution Protocol (ARP) table, and the like.
Step 103: a storage management component in the middleware mounts a first network storage device onto the electronic device.
In the embodiment of the present invention, the middleware may further include a storage management component, where the storage management component is configured to execute a specific operation on the network storage device. After abstracting the first write operation request in step 102 and determining the first network storage device according to the first network storage device identifier, the storage management component mounts the first network storage device onto the electronic device. By mounting the first network storage device, the electronic device can access the first network storage device and can operate the first network storage device and files and data stored in the first network storage device.
Step 104: the storage management component stores the first file in a first network storage device.
After the first network storage device is mounted in step 103, the first network storage device can be accessed in the electronic device, and the storage management component can store the first file in the first network storage device. For example, as exemplified in the foregoing description, the storage management component may store "movie. mp 4" in the first network storage device, and then the user may read and use "movie. mp 4" by accessing the first network storage device.
In a possible implementation manner, before the storage management component in the middleware mounts the first network storage device onto the electronic device in step 103, the method for storing the file may further include the following steps: the business logic component determines a first mounting mode corresponding to the first storage type based on the first storage type included in the first write operation request.
Furthermore, when the storage management component in the middleware mounts the first network storage device onto the electronic device in step 103, the storage management component may mount the first network storage device onto the electronic device in the first mounting manner, and may obtain a mounting path for accessing the first network storage device in the electronic device by mounting the first network storage device onto the electronic device.
In the embodiment of the present invention, a plurality of storage types for storing the first file may be included, for example, the storage types may include file-level storage, for example, a NAS storage manner, an FTP storage manner, and the like, and when the NAS storage manner is adopted, storage protocols such as NFS, CIFS, and the like may be used; as another example, the storage type may include data block storage, such as ISCSI storage, disk array storage, and the like.
In addition, in the embodiment of the present invention, before the first network storage device is mounted, it may be further determined in advance by the service logic component whether the first network storage device is mounted on the electronic device in the first mounting manner, and if the first network storage device is mounted in the first mounting manner, the mounting path of the first network storage device may be directly obtained without repeated mounting.
In a possible implementation manner, when the first storage type included in the first write operation request is file-level storage, the determining, by the business logic component, a first mount manner corresponding to the first storage type based on the first storage type included in the first write operation request may include: and the service logic component determines that the network mapping mode corresponding to the file level storage is a first mounting mode.
Furthermore, the mounting of the first network storage device onto the electronic device by the storage management component in the middleware may include: the storage management component mounts the first network storage device onto the electronic device in a network mapping mode to obtain a network address of the first network storage device as a mounting path.
In the embodiment of the present invention, each network storage device in the network storage system may have a unique network address, so that when the first network storage device is determined according to the first network storage device identifier in step 102, the network address of the first network storage device may be determined. Furthermore, when the first network storage device is mounted in a network mapping manner, the network address of the first network storage device can be obtained as a mounting path of the first network storage device.
For example, the network address of the first network storage device may be an IP address, and specifically for example, 192.168.1.233, the storage management component may obtain 192.168.1.233 a mount path for the first network storage device, and the user may access the first network storage device through the path of access 192.168.1.233. In addition, a path 192.168.1.233 can be replaced by a name easily recognized and called by a user in the electronic equipment, for example, 192.168.1.233 is replaced by a path Storage-1, when the user accesses the path Storage-1, the service logic component can automatically convert the path Storage-1 into a 192.168.1.233 path, and the first network Storage device is still accessed by the user finally.
When the storage type is file-level storage, the files can be managed more conveniently, and sharing of the files is facilitated.
In a possible implementation manner, when the first storage type included in the first write operation request is data block storage, the service logic component determines, based on the first storage type included in the first write operation request, a first mount manner corresponding to the first storage type, and may include the following steps: and the service logic component determines that the synchronous volume mounting mode corresponding to the data block storage is the first mounting mode.
Furthermore, the mounting of the first network storage device onto the electronic device by the storage management component in the middleware may include: the storage management component mounts the first network storage device to a preset path on the electronic device in a synchronous volume-mounting mode so as to obtain the preset path as a mounting path.
In the embodiment of the present invention, when the storage management component mounts the first network storage device in the synchronous volume mount manner, the storage management component may mount the first network storage device to a preset path in the electronic device, for example, the preset path may be a drive letter in the electronic device, such as "Z:" or "F:", or the preset path may also be a folder in the electronic device, such as "/dev/sda", or the like. Furthermore, when the first network storage device is mounted to the preset path in a synchronous volume mounting manner, the preset path can be obtained as the mounting path of the first network storage device. The user can directly access and manage the first network storage device mounted in the synchronous mounting mode through the mounting path, and the first network storage device is like accessing and managing a local disk mounted by the electronic device.
For example, the preset path may be "Z:", and the storage management component may obtain "Z:" as a mount path for the first network storage device, and the user may access the first network storage device by accessing "Z:".
In this embodiment of the present invention, after the step of mounting, by the storage management component, the first network storage device to the preset path on the electronic device in the synchronous volume mount manner, it may be further determined, by the service logic component, whether the first network storage device is successfully mounted to the preset path on the electronic device in the synchronous volume mount manner, and if it is determined that the first network storage device is not successfully mounted to the preset path on the electronic device in the synchronous volume mount manner, the service logic component may notify the user that the mounting is not successful, and may provide an option for the user to continue operating, where the following two possible options are provided in this embodiment of the present invention as examples:
the first method comprises the following steps: continuing to mount the first network storage device to a preset path on the electronic device in a synchronous volume mounting mode until the first network storage device is successfully mounted or the preset maximum repeated mounting times are reached;
and the second method comprises the following steps: and mounting the first network storage device on the electronic device in a network mapping mode, obtaining a network address of the first network storage device as a mounting path, and storing the first file in a file-level storage mode.
In addition, when the first network storage device is not successfully mounted to the preset path on the electronic device in the synchronous volume mounting manner, the middleware may also automatically select the possible options to perform operations according to actual situations.
When the storage type is data block storage, the storage speed is high.
In a possible implementation manner, the storing, by the storage management component in step 104, the storing the first file in the first network storage device may specifically include: the storage management component stores the first file in the first network storage device based on the mount path.
In the embodiment of the present invention, after the storage management component mounts the first network storage device onto the electronic device, the first network storage device can be accessed on the electronic device through the mount path, and therefore, the storage management component can also store the first file into the first network storage device according to the mount path. Specifically, when storing the first file in the first network storage device, the storage management component may store the first file directly to the mount path, or store the first file to a predetermined location under the mount path, for example, a subdirectory under the mount path, and so on.
When the first file is stored to the predetermined position under the mount path, the predetermined position may be included in the first write operation request or may be selected by the user after the mount is successful.
For example, assuming that the predetermined location is "\ new folder", the first file is "movie. mp 4", and the mount path is 192.168.1.233, the storage management component may store "movie. mp 4" under the path of "\ \192.168.1.233\ new folder", after which the user may access the path of "\ \192.168.1.233\ new folder \ movie. mp 4" to read the "movie. mp 4" file in the electronic device.
For another example, assuming that the predetermined location is "\ new folder", the first file is "movie. mp 4", and the mount path is "Z:", the storage management component may store "movie. mp 4" under the path of "Z: \ new folder", after which the user may access the path of "Z: \ new folder \ movie. mp 4" in the electronic device to read the "movie. mp 4" file.
The method for storing the file is illustrated by a specific implementation procedure. The middleware comprises a service logic component and a storage management component, wherein the storage management component can comprise an ISCSI management module, a NAS management module and a NAS tool module; the ISCSI management module and the NAS tool module correspond to data block storage in the embodiment of the invention, specifically, the ISCSI management module is responsible for connecting, logging in and hanging the network storage device through an ISCSI protocol, the NAS tool module is responsible for sharing, deleting and sharing the volume or the catalogue, and the like, and the ISCSI management module and the NAS tool module can be used for realizing the synchronous hanging of the network storage device; the NAS management module is responsible for mounting the network storage device as a local network disk in a network mapping manner through NAS protocols, such as the NAS protocols of NFS, CIFS, and the like. In addition, in the embodiment of the present invention, the middleware user may be a user, or may be software for calling a middleware service interface, or the like. The implementation process is as follows:
(1) a first write operation request is obtained by a business logic component from a middleware user to begin a mount operation. The first write operation request may be a complete operation instructing to store the first file to the first network storage device, or may be an operation instructing only to mount the first network storage device. The first write operation request may include the first network storage identifier, the storage type, an expected occupancy period/duration for storing the first file, and the like.
(2) And judging the storage type by the business logic component according to the first write operation request.
And (3.1) if the storage type judged in the step (2) is the local storage of the electronic equipment, for example, the storage type is stored in a local disk installed on the electronic equipment, the service logic component directly returns the judgment result to a middleware user, and the middleware user executes a first writing operation in a local storage mode, for example, stores a first file in a C disk in the local disk of the electronic equipment.
(3.2.1) if the storage type judged in the step (2) is file-level storage, calling the NAS management module by the service logic component, mounting the first network storage device to the electronic device in a network mapping manner by the NAS management module through an NAS protocol, and returning a mounting result to the service logic component by the NAS management module, wherein the mounting result comprises a mounting path of the first network storage device, namely a network address of the first network storage device.
And (3.2.2) the service logic component returns the mounting result to the middleware user.
(3.3.1) if the storage type judged in the step (2) is data block storage, the service logic component calls an ISCSI management module, the ISCSI management module adopts an ISCSI protocol to perform volume hanging operation on the first network storage device in a synchronous volume hanging mode, and the ISCSI management module returns a volume hanging result to the service logic component, wherein the volume hanging result comprises information used for indicating whether the first network storage device is hung and rolled up and volume information of the first network storage device.
And (3.3.2) the service logic component judges whether the first network storage is successfully hung according to the volume hanging result returned in the step (3.3.1).
(3.3.3.1) if the mount failure is determined in step (3.3.2), returning, by the business logic component, a message to the middleware user indicating the mount failure.
(3.3.3.2) if the mounting is determined to be successful in the step (3.3.2), the service logic component calls the NAS tool module, the NAS tool module shares the first network storage device with which the volume is successfully mounted, and allocates a preset path for the first network storage device, so as to finally mount the first network storage device to the preset path on the first network storage device. Furthermore, the NAS tool module returns a mount result to the service logic component, where the mount result includes a mount path of the first network storage device, that is, a preset path.
And (3.3.4) the service logic component returns the mounting result to the middleware user.
In the embodiment of the invention, after the first network storage device is mounted successfully and the mounting path is obtained, the middleware user can access the first network storage device by accessing the mounting path. And, in the event that the first network storage device is successfully mounted, the storage management component may store the first file in the first network storage device according to the first write operation request.
In the embodiment of the invention, when the storage mode for storing the first file is file-level storage, the storage management component stores the whole file as a storage object in the first network storage device; when the storage mode for storing the first file is data block storage, the storage management component splits the first file into a plurality of data blocks, and stores each data block into the first network storage device by using the data block as a storage object, so as to store the first file into the first network storage device.
The method for storing the files provided by the embodiment of the invention adopts the design of the middleware framework to uniformly manage at least one network storage device connected with the electronic equipment, thereby greatly reducing the difficulty of using and managing the network storage device by a user.
Furthermore, in the embodiment of the present invention, the service logic and the storage management are separated, when the user uses the network storage device, only the interaction with the service logic component is needed, the service logic component abstracts the service logic of the user and converts the service logic into a specific operation on the network storage device, and the storage management component performs the specific operation and management on the network storage device. In the whole process of realizing the user service logic, the user does not need to specifically operate the network storage device, the operation difficulty of the user is reduced, and the network storage device can be conveniently used even for the user without network storage related professional knowledge.
Furthermore, in the embodiment of the present invention, the service logic and the storage management are separated by the middleware, so that a direct service call interface of the network storage device can be provided for a user, and the adaptability and the portability of the method for storing files in the embodiment of the present invention are improved.
In a second aspect, please refer to fig. 3, an embodiment of the present invention provides a method for reading a file, where the method may be applied to an electronic device, that is, an execution subject of each step in the method may be the electronic device described above, and the electronic device may be connected to at least one network storage device in a network storage system. The process of the method is described as follows:
step 201: a business logic component in middleware of an electronic device obtains a first read operation request for reading a first file.
In the embodiment of the invention, the method for reading the file can be executed in the electronic equipment in a middleware mode. Specifically, the middleware includes a service logic component, and the service logic component can acquire a service requirement of a user, that is, a problem that the user wants to solve through a network storage device, for example, reading a certain file, a folder, and the like in a certain network storage device.
In this embodiment of the present invention, the first read operation request is used to instruct to read the first file, that is, to read data from the network storage device. Reading the first file may refer to reading a packaged complete file such as a document, a picture, a compressed packet, or reading unpacked data, or the like. For ease of understanding, in the description that follows of the second aspect, the "movie. mp 4" stored in the first network storage device is illustrated as the first file.
In the embodiment of the present invention, there are various ways for the business logic component to obtain the first read operation request, for example, obtaining an instruction including the first read operation request through a calling interface provided by the middleware to a user; for another example, the middleware may provide a graphical user interface to the user, and the user may input the first read operation request by operating an icon on the user interface, such as double-clicking a "movie. mp 4" icon cached in the user interface, which may indicate opening a "movie. mp 4" file stored in the first network storage device.
Step 202: and the business logic component determines a first network storage device corresponding to the first network storage device identification from the at least one network storage device based on the first network storage device identification included in the first read operation request.
In the embodiment of the present invention, after the first read operation request is obtained in step 201, the service logic component abstracts the directly obtained first read operation request, that is, converts the problem that the user wants to solve by the first read operation request into a specific operation on the network storage device.
In step 202, the business logic component parses the first read operation request to obtain valid data included in the first read operation request for instructing to read the first file. In this embodiment of the present invention, the first read operation request may include a first network storage device identifier, and the first network storage device storing the first file may be determined from at least one network storage device included in the network storage system through the first network storage device identifier.
Specifically, the first network storage device identification may be a network address of the electronic device communicating with the first network storage device, or an identification code, a name, or the like of the first network storage device.
In the embodiment of the present invention, the electronic device may further include a correspondence table between the network storage device identifier and the network storage device, and by querying the correspondence table, it may be determined that the network storage device corresponding to the first network storage device identifier is the first network storage device, and in addition, the first network storage device may be determined by querying the ARP table, and so on.
Step 203: the business logic component determines a reading path of the first file based on a mount path of the electronic device for accessing the first network storage device and a storage path of the first file in the first network storage device.
In this embodiment of the present invention, the first read operation request may include a storage path of the first file in the first network storage device, where the storage path may indicate a location where the first file is specifically stored in the first network storage device. For example, if the storage path is "\ new folder \ movie. mp 4", it may indicate that the file "movie. mp 4" is stored in the "new folder" under the root directory of the first network storage device.
Furthermore, the service logic component can determine a read path of the first file according to the mount path of the first network storage device and the storage path of the first file.
For example, assuming that the storage path is "\ \ new folder \ movie. mp 4" and the mount path is 192.168.1.233, the business logic component may determine that the path of "\ \192.168.1.233\ new folder \ movie. mp 4" is a read path of the file of "movie. mp 4", and the user may access the path of "\ \192.168.1.233\ new folder \ movie. mp 4" in the electronic device to read the file of "movie. mp 4".
For another example, assuming that the storage path is "\\ new folder \ movie. mp 4" and the mount path is "Z:", the business logic component may determine that the path of "Z: \ new folder \ movie. mp 4" is a read path of the file of "movie. mp 4", and the user may access the path of "Z: \ new folder \ movie. mp 4" in the electronic device to read the file of "movie. mp 4".
Step 204: a storage management component in the middleware reads the first file based on the read path.
After the read path of the first file is determined in step 203, a specific read operation may be performed by the storage management component to read the first file from the read path.
In a possible implementation manner, before the business logic component determines the reading path of the first file, the method for reading the file may further include the following steps: the business logic component determines whether the first network storage device is mounted to the electronic device.
According to the determination result of the service logic component, if the first network storage device is not mounted on the electronic device, the storage management component mounts the first network storage device on the electronic device in a network mapping mode to obtain a network address of the first network storage device as a mounting path of the first network storage device.
For example, the network address of the first network storage device may be an IP address, specifically for example 192.168.1.233, and the storage management component may obtain 192.168.1.233 a mount path for the first network storage device. Furthermore, when the storage path of the first file is "\ \ new folder \ movie. mp 4", the storage management component may read the "movie. mp 4" file stored in the first network storage device from the path of "\ \192.168.1.233\ new folder \ movie. mp 4", with the file as the read object.
In the embodiment of the present invention, the determining, by the service logic component, whether the first network storage device is mounted on the electronic device may include determining, by the service logic component, whether the first network storage device is mounted on the electronic device in a network mapping manner or a synchronous volume mounting manner, may also include determining, by the service logic component, whether the first network storage device is mounted on the electronic device in a synchronous volume mounting manner, and may also include determining, by the service logic component, whether the first network storage device is mounted on the electronic device in a network mapping manner.
In a possible implementation manner, before the business logic component determines the reading path of the first file, the method for reading the file may further include the following steps: the business logic component determines whether the first network storage device is mounted to the electronic device.
According to the determination result of the service logic component, if the first network storage device is not mounted on the electronic device, the storage management component mounts the first network storage device to a preset path on the electronic device in a synchronous volume mounting mode so as to obtain a network address of the first network storage device as a mounting path.
In the embodiment of the present invention, because a synchronous volume hanging manner needs to consume a certain time, in order to be able to read the first file in time, when the service logic component determines that the first network storage device is not hung on the electronic device, the storage management component may simultaneously perform the following two operations:
operation one: and mounting the first network storage device on the electronic device in a network mapping manner to obtain that the network address of the first network storage device is a mounting path of the first network storage device, where the mounting path is used for the service logic module to determine a read path in step 203 of the file reading operation.
And operation II: and mounting the first network storage device to a preset path on the electronic device in a synchronous volume mounting mode.
In the embodiment of the present invention, when the storage management component successfully mounts the first network storage in a synchronous volume mount manner by executing the second operation, the storage management component may store mount information of the first network storage device, where the mount information may include a preset path on which the first network storage device is mounted. When the user needs to access the first network storage device again, the storage management component may directly obtain the preset path for mounting the first network storage device as the mounting path of the first network storage device according to the stored mounting information.
The method for reading the file is illustrated by a specific implementation procedure. The middleware comprises a service logic component and a storage management component, wherein the storage management component can comprise an ISCSI management module, a NAS management module and a NAS tool module; the ISCSI management module and the NAS tool module correspond to data block storage in the embodiment of the invention, specifically, the ISCSI management module is responsible for connecting, logging in and hanging the network storage device through an ISCSI protocol, the NAS tool module is responsible for sharing, deleting and sharing the volume or the catalogue, and the like, and the ISCSI management module and the NAS tool module can be used for realizing the synchronous hanging of the network storage device; the NAS management module is responsible for mounting the network storage device as a local network disk in a network mapping manner through NAS protocols, such as the NAS protocols of NFS, CIFS, and the like. In addition, in the embodiment of the present invention, the middleware user may be a user, or may be software for calling a middleware service interface, or the like. The implementation process is as follows:
(1) a first read operation request is obtained by the business logic component from a middleware user to begin read file path analysis. The first write operation request may be a complete operation instructing reading of the first file from the first network storage device, or may be an operation instructing only obtaining of the first file read path. The first read operation request comprises a first network storage device identification used for determining the first network storage device and a storage path of the first file in the first network storage device.
(2) And judging whether the first network storage device is mounted on the electronic device or not by the service logic component according to the first read operation request.
And (3.1) if the first network storage device is determined to be mounted on the electronic device in the step (2), determining a reading path of the first file by the service logic component based on the mounting path of the first network storage device and the storage path of the first file, and returning the reading path to the middleware user.
(3.2.1) if the first network storage device is determined not to be mounted on the electronic device in the step (2), calling the NAS management module by the service logic component, mounting the first network storage device on the electronic device in a network mapping mode through an NAS protocol by the NAS management module, and returning a mounting result to the service logic component by the NAS management module, wherein the mounting result comprises a mounting path of the first network storage device, namely a network address of the first network storage device.
And (3.2.2) the service logic component determines a reading path of the first file based on the mounting path obtained in the step (3.2.1) and the storage path of the first file, and returns the reading path to the middleware user.
(3.2.3) while executing the step (3.2.2), the service logic component calls the ISCSI management module, the ISCSI management module adopts an ISCSI protocol, performs a volume hanging operation on the first network storage device in a synchronous volume hanging manner, and returns a volume hanging result to the service logic component, where the volume hanging result includes information indicating whether the first network storage device is successfully hung, and when the volume is successfully hung, the volume hanging result may also include volume information of the first network storage device.
And (3.2.4) the service logic component judges whether the first network storage device is successfully hung according to the volume hanging result returned in the step (3.2.3). If the service logic component determines that the volume hanging in the step (3.2.3) fails, the service logic component controls to repeatedly execute the step (3.2.3) until the volume hanging is successful or the preset maximum repeated volume hanging times is reached; and if the roll hanging work in the step (3.2.3) is determined, the business logic component stores the roll hanging result.
In the embodiment of the present invention, after the service logic component returns the read path to the middleware user, the middleware user can read the first file from the first network storage device through the read path. Also, in the event that a read path for the first file is determined, an operation to read the first file from the read path may be performed by the storage management component in accordance with the first read operation request.
In this embodiment of the present invention, the operation of determining, by the service logic component, whether the first network storage device is mounted to the electronic device may include determining, by the service logic component, whether the first network storage device is mounted to the electronic device in a network mapping manner or a synchronous volume mounting manner, may also include only determining, by the service logic component, whether the first network storage device is mounted to the electronic device in a synchronous volume mounting manner, and may also include only determining, by the service logic component, whether the first network storage device is mounted to the electronic device in a network mapping manner.
The method for reading the file provided by the embodiment of the invention adopts the design of the middleware framework to uniformly manage at least one network storage device connected with the electronic equipment, thereby greatly reducing the difficulty of using and managing the network storage device by a user.
Furthermore, in the embodiment of the present invention, the service logic and the storage management are separated, when the user uses the network storage device, only the interaction with the service logic component is needed, the service logic component abstracts the service logic of the user and converts the service logic into a specific operation on the network storage device, and the storage management component performs the specific operation and management on the network storage device. In the whole process of realizing the user service logic, the user does not need to specifically operate the network storage device, the operation difficulty of the user is reduced, and the network storage device can be conveniently used even for the user without network storage related professional knowledge.
Furthermore, in the embodiment of the present invention, the service logic and the storage management are separated by the middleware, so that a direct service call interface of the network storage device can be provided for a user, and the adaptability and the portability of the method for reading a file in the embodiment of the present invention are improved.
Further, in the embodiment of the present invention, when the service logic component determines that the first network storage device is not mounted on the electronic device, the storage management component mounts the first network storage device in a network mapping manner, and can mount the first network storage device quickly to obtain the network address of the first network storage device as the mounting path. By the method, mounting time delay is reduced, and response speed of reading the first file is improved.
Further, in the embodiment of the present invention, when the service logic component determines that the first network storage device is not mounted on the electronic device, the storage management component may mount the first network storage device in a synchronous volume mount manner while obtaining the network address of the first network storage device as a mount path, so as to improve a response speed when the user reads the file from the first network storage device again.
In a third aspect, referring to fig. 4, based on the same inventive concept as the method for storing a file in the first aspect, an embodiment of the present invention provides an electronic device, where the electronic device is connected to at least one network storage device in a network storage system, the electronic device includes a middleware 300, and the middleware 300 includes a business logic component 301 and a storage management component 302, where:
a business logic component 301 for obtaining a first write operation request for storing a first file; determining a first network storage device corresponding to the first network storage device identifier from at least one network storage device based on the first network storage device identifier included in the first write operation request;
a storage management component 302 for mounting a first network storage device onto an electronic device; the first file is stored in a first network storage device.
In one possible implementation, before the storage management component 302 mounts the first network storage device onto the electronic device, the business logic component 301 is further configured to:
determining a first mounting mode corresponding to a first storage type based on the first storage type included in the first write operation request;
the storage management component 302 mounts a first network storage device onto an electronic device, including:
the storage management component 302 mounts the first network storage device onto the electronic device in a first mount manner to obtain a mount path in the electronic device for accessing the first network storage device.
In a possible implementation manner, when the first storage type is file-level storage, determining, by the business logic component 301, a first mount manner corresponding to the first storage type based on the first storage type included in the first write operation request includes:
the service logic component 301 determines that the network mapping mode corresponding to the file level storage is a first mounting mode;
the storage management component 302 mounts a first network storage device onto an electronic device, including:
the storage management component 302 mounts the first network storage device onto the electronic device in a network mapping manner to obtain a network address of the first network storage device as a mounting path.
In a possible implementation manner, when the first storage type is data block storage, determining, by the business logic component 301, a first mount manner corresponding to the first storage type based on the first storage type included in the first write operation request includes:
the service logic component 301 determines that the synchronous volume mount mode corresponding to the data block storage is a first mount mode;
the storage management component 302 mounts a first network storage device onto an electronic device, including:
the storage management component 302 mounts the first network storage device to a preset path on the electronic device in a synchronous volume mount manner, so as to obtain the preset path as a mount path.
In one possible implementation, the storage management component 302 stores the first file in a first network storage device, including:
the storage management component 302 stores the first file in the first network storage device based on the mount path.
As the electronic device in the embodiment of the present invention is similar to the principle of the method for storing a file in the first aspect, the implementation of the electronic device in the embodiment of the present invention may refer to the implementation of the method for storing a file in the first aspect, and details are not described here.
In a fourth aspect, referring to fig. 5, based on the same inventive concept as the method for reading a file in the second aspect, an embodiment of the present invention provides another electronic device, where the electronic device is connected to at least one network storage device in a network storage system, the electronic device includes a middleware 400, and the middleware 400 includes a business logic component 401 and a storage management component 402, where:
a business logic component 401, configured to obtain a first read operation request for reading a first file; determining a first network storage device corresponding to the first network storage device identifier from at least one network storage device based on the first network storage device identifier included in the first read operation request; determining a reading path of a first file based on a mount path for accessing the first network storage device in the electronic device and a storage path of the first file in the first network storage device;
a storage management component 402 for reading the first file based on the read path.
In one possible implementation, before business logic component 401 determines the read path of the first file, business logic component 401 is further configured to:
determining whether a first network storage device is mounted on an electronic device;
if the first network storage device is not mounted to the electronic device, the storage management component 402 is further configured to:
and mounting the first network storage device on the electronic device in a network mapping mode to obtain a network address of the first network storage device as a mounting path.
In one possible implementation, before business logic component 401 determines the read path of the first file, business logic component 401 is further configured to:
determining whether a first network storage device is mounted on an electronic device;
if the first network storage device is not mounted to the electronic device, the storage management component 402 is further configured to:
and mounting the first network storage device to a preset path on the electronic device in a synchronous volume mounting mode so as to obtain a network address of the first network storage device as a mounting path.
Because the electronic device in the embodiment of the present invention is similar to the principle of the method for reading a file in the second aspect, the implementation of the electronic device in the embodiment of the present invention may refer to the implementation of the method for reading a file in the second aspect, and details are not repeated here.
It is clearly understood by those skilled in the art that, for convenience and simplicity of description, the above division of the functional units/components is merely used as an example, and in practical applications, the above function distribution may be performed by different functional units according to needs, that is, the internal structure of the device is divided into different functional units/components to perform all or part of the above described functions.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units or components is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or may be 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 through some interfaces, devices or units/components, and may be in an electrical, mechanical or other form.
The units/components described as separate parts may or may not be physically separate, and parts displayed as units/components may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units/components. Some or all of the units/components can be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional units/components in the embodiments of the present invention may be integrated into one processing unit, or each unit/component may exist alone physically, or two or more units/components may be integrated into one unit. The integrated units/components can be realized in the form of hardware or software functional units/components.
The integrated units/components, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention 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, a network device, or the like) or a Processor (Processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above embodiments are only used to describe the technical solutions of the present invention in detail, but the above embodiments are only used to help understanding the method and the core idea of the present invention, and should not be construed as limiting the present invention. Those skilled in the art should also appreciate that they can easily conceive of various changes and substitutions within the technical scope of the present disclosure.

Claims (14)

1. A method for storing files is applied to an electronic device, the electronic device is connected with at least one network storage device in a network storage system, the middleware of the electronic device comprises a business logic component and a storage management component, and the method comprises the following steps:
the business logic component obtains a first write operation request for storing a first file;
the business logic component determines a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first write operation request;
the business logic component determines a first mounting mode corresponding to a first storage type based on the first storage type included in the first write operation request;
the storage management component mounts the first network storage device onto the electronic device in the first mounting mode to obtain a mounting path used for accessing the first network storage device in the electronic device;
the storage management component stores the first file in the first network storage device;
when the business logic component determines that the first network storage device is not successfully mounted to the preset path on the electronic device in the first mounting mode: the business logic component continues to mount the first network storage device to a preset path on the electronic device in the first mounting mode until the first network storage device is successfully mounted or a preset maximum repeated mounting frequency is reached; and/or the business logic component mounts the first network storage device on the electronic device in other mounting modes.
2. The method of claim 1, wherein when the first storage type is file-level storage, the business logic component determining a first mount style corresponding to the first storage type based on the first storage type included in the first write operation request comprises:
the business logic component determines that a network mapping mode corresponding to the file-level storage is the first mounting mode;
the storage management component mounts the first network storage device onto the electronic device, including:
and the storage management component mounts the first network storage device onto the electronic device in the network mapping mode to obtain the network address of the first network storage device as the mounting path.
3. The method of claim 1, wherein when the first storage type is data block storage, the determining, by the business logic component, a first mount style corresponding to the first storage type based on the first storage type included in the first write operation request comprises:
the service logic component determines that a synchronous volume mounting mode corresponding to the data block storage is the first mounting mode;
the storage management component mounts the first network storage device onto the electronic device, including:
and the storage management component mounts the first network storage device to a preset path on the electronic device in the synchronous volume mount mode to obtain the preset path as the mount path.
4. The method of any of claims 2-3, wherein the storing the first file by the storage management component in the first network storage device comprises:
the storage management component stores the first file in the first network storage device based on the mount path.
5. A method for reading a file is applied to an electronic device, the electronic device is connected with at least one network storage device in a network storage system, the middleware of the electronic device comprises a business logic component and a storage management component, and the method comprises the following steps:
the business logic component obtains a first read operation request for reading a first file;
the business logic component determines a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first read operation request;
when the business logic component determines that the first network storage device is not successfully mounted to the preset path on the electronic device: the business logic component mounts the first network storage device to the electronic device in a first mounting mode and/or other mounting modes to obtain a mounting path of the first network storage device;
the business logic component determines a reading path of the first file based on a mount path of the electronic equipment for accessing the first network storage equipment and a storage path of the first file in the first network storage equipment;
the storage management component reads the first file based on the read path.
6. The method of claim 5, wherein prior to the business logic component determining the read path for the first file, the method further comprises:
the business logic component determines whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component mounts the first network storage device on the electronic device in a network mapping manner to obtain a network address of the first network storage device as the mounting path.
7. The method of claim 5, wherein prior to the business logic component determining the read path for the first file, the method further comprises:
the business logic component determines whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component mounts a preset path from the first network storage device to the electronic device in a synchronous volume mounting mode so as to obtain a network address of the first network storage device as the mounting path.
8. An electronic device connected to at least one network storage device in a network storage system, the electronic device comprising middleware comprising a business logic component and a storage management component, wherein:
the business logic component is used for obtaining a first write operation request for storing a first file; determining a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first write operation request;
the business logic component is further configured to determine a first mount mode corresponding to a first storage type based on the first storage type included in the first write operation request;
the storage management component is configured to mount the first network storage device onto the electronic device in the first mounting manner, so as to obtain a mounting path in the electronic device for accessing the first network storage device;
the storage management component is further configured to store the first file in the first network storage device;
the service logic component is further configured to, when the service logic component determines that the first network storage device is not successfully mounted to the preset path on the electronic device in the first mounting manner: continuing to mount the first network storage device to a preset path on the electronic device in the first mounting mode until the first network storage device is successfully mounted or a preset maximum repeated mounting frequency is reached; and/or mounting the first network storage device on the electronic device in other mounting modes.
9. The electronic device of claim 8, wherein when the first storage type is file-level storage, the business logic component determines, based on the first storage type included in the first write operation request, a first mount style corresponding to the first storage type, including:
the business logic component determines that a network mapping mode corresponding to the file-level storage is the first mounting mode;
the storage management component mounts the first network storage device onto the electronic device, including:
and the storage management component mounts the first network storage device onto the electronic device in the network mapping mode to obtain the network address of the first network storage device as the mounting path.
10. The electronic device of claim 8, wherein when the first storage type is data block storage, the business logic component determines a first mount style corresponding to the first storage type based on the first storage type included in the first write operation request, including:
the service logic component determines that a synchronous volume mounting mode corresponding to the data block storage is the first mounting mode;
the storage management component mounts the first network storage device onto the electronic device, including:
and the storage management component mounts the first network storage device to a preset path on the electronic device in the synchronous volume mount mode to obtain the preset path as the mount path.
11. The electronic device of any of claims 8-10, wherein the storage management component stores the first file in the first network storage device, comprising:
the storage management component stores the first file in the first network storage device based on the mount path.
12. An electronic device connected to at least one network storage device in a network storage system, the electronic device comprising middleware comprising a business logic component and a storage management component, wherein:
the business logic component is used for obtaining a first read operation request for reading a first file; determining a first network storage device corresponding to a first network storage device identifier from the at least one network storage device based on the first network storage device identifier included in the first read operation request;
the business logic component is further configured to, when it is determined that the first network storage device is not successfully mounted to the preset path on the electronic device: mounting the first network storage device to the electronic device in a first mounting mode and/or other mounting modes to obtain a mounting path of the first network storage device;
the business logic component is further configured to determine a read path of the first file based on a mount path of the electronic device for accessing the first network storage device and a storage path of the first file in the first network storage device;
the storage management component is used for reading the first file based on the reading path.
13. The electronic device of claim 12, wherein prior to the business logic component determining the read path for the first file, the business logic component is further to:
determining whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component is further configured to:
and mounting the first network storage device on the electronic device in a network mapping mode to obtain the network address of the first network storage device as the mounting path.
14. The electronic device of claim 12, wherein prior to the business logic component determining the read path for the first file, the business logic component is further to:
determining whether the first network storage device is mounted on the electronic device;
if the first network storage device is not mounted on the electronic device, the storage management component is further configured to:
and mounting the first network storage device to a preset path on the electronic device in a synchronous volume mounting mode to obtain a network address of the first network storage device as the mounting path.
CN201710525735.XA 2017-06-30 2017-06-30 File storage method, file reading method and electronic equipment Active CN107357524B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710525735.XA CN107357524B (en) 2017-06-30 2017-06-30 File storage method, file reading method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710525735.XA CN107357524B (en) 2017-06-30 2017-06-30 File storage method, file reading method and electronic equipment

Publications (2)

Publication Number Publication Date
CN107357524A CN107357524A (en) 2017-11-17
CN107357524B true CN107357524B (en) 2021-02-09

Family

ID=60273293

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710525735.XA Active CN107357524B (en) 2017-06-30 2017-06-30 File storage method, file reading method and electronic equipment

Country Status (1)

Country Link
CN (1) CN107357524B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111586141B (en) * 2020-04-30 2023-04-07 中国工商银行股份有限公司 Job processing method, device and system and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050248B (en) * 2014-06-05 2018-03-02 北京捷成世纪科技股份有限公司 A kind of document storage system and storage method
CN104537076B (en) * 2014-12-31 2017-12-08 北京奇艺世纪科技有限公司 A kind of file read/write method and device

Also Published As

Publication number Publication date
CN107357524A (en) 2017-11-17

Similar Documents

Publication Publication Date Title
US11394625B2 (en) Service level agreement based storage access
EP3657358B1 (en) Method, device and system for persistent data processing, and readable storage medium
EP3499786B1 (en) Data synchronization method, apparatus, storage medium and electronic device
EP3637724B1 (en) Method supporting wireless access to storage device, and mobile routing hotspot device
JP2010205111A (en) System, and method for reproducing context, first terminal device, second terminal device, context obtaining device or storage device, program thereof
US20130227085A1 (en) Terminal and method for using cloud services
KR20200140555A (en) Electronic device for switching between a dual standby mode and a single standby mode and method for the same
US9591079B2 (en) Method and apparatus for managing sessions of different websites
CN102821111A (en) Real-time synchronizing method for file cloud storage
US20140297586A1 (en) Device and method for cloud file management
CN112256676A (en) Method, device, equipment and medium for migrating database
CN104679581A (en) Method and device for running program in background
WO2020135131A1 (en) Network hotspot switching method, intelligent terminal and computer-readable storage medium
US20150212902A1 (en) Network attached storage device with automatically configured distributed file system and fast access from local computer client
JP7393468B2 (en) Data synchronization methods, devices, electronic devices, storage media and computer programs
US10848558B2 (en) Method and apparatus for file management
CN109117153A (en) Processing method, device, terminal and the storage medium of application program
CN107357524B (en) File storage method, file reading method and electronic equipment
WO2014176955A1 (en) Mobile terminal configuration method and device
WO2014163660A1 (en) Removable storage device identity and configuration information
CN107168648B (en) File storage method and device and terminal
WO2014183711A1 (en) Multi-media data backup method, user terminal and synchronizer
US10545834B1 (en) Server-assisted network data archiving
CN104394210A (en) Direction connection communication method and device
KR20120065674A (en) Device for downloading files on behalf of another device and operation method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant