Data transmission method for mobile storage device
Technical Field
The invention relates to the technical field of mobile storage, in particular to a data transmission method of mobile storage equipment.
Background
With the continuous development of cloud computing, enterprise informatization becomes an indispensable component of cloud computing, and a cloud desktop belongs to a recognized implementation mode and can play an important role in the enterprise resource datamation industry. Rdp remote desktop based cloud desktop implementation is the most used cloud desktop implementation currently used by the industry.
In a general office scene, a user often uses a mobile storage device (usb mobile storage) to perform file transmission; in cloud desktop transmission, the transmission efficiency of files is often affected due to the limitation of the read-write performance of mobile storage and the limitation of network bandwidth.
At present, freerdp can realize reading and writing of a cloud desktop on a mobile storage device through mapping of a driving device, but due to the fact that a reading and writing path is too long and the media of the mobile device are limited to be different, a large number of small file reading and writing scenes are generated, and transmission performance is greatly influenced.
Disclosure of Invention
In order to solve one of the above problems, the present invention provides a method for transmitting data of a mobile storage device, which can shorten an IO read-write path in a scenario where a mobile storage device is mapped on a cloud desktop, improve data transmission reliability and read-write transmission efficiency, and do not need to add an additional burden to rdp.
In order to solve the technical problems, the invention provides the following technical scheme: a data transmission method of a mobile storage device comprises the following steps:
step S1, the terminal device sets a buffer area, and the buffer area is used for buffering the temporary file of the mobile storage device;
step S2, the cloud desktop sends out an instruction for reading the specified file of the corresponding mobile storage device in the shared mounting point; the terminal equipment identifies the mobile storage equipment in advance and mounts the mobile storage equipment to a shared mounting point of the terminal equipment;
step S3, a Share _ folder _ interface process acquisition instruction of the terminal equipment acquires file index information of the designated file; the Share _ folder _ interface process sends the file index information to the usbmount process;
step S4, the usbmount process judges whether the designated file has a corresponding temporary file in the cache region according to the file index information; if the specified file does not have the corresponding temporary file in the cache region, the usbmount process reads the specified file from the mobile storage device according to the file index information, and stores the specified file in the cache region to generate the corresponding temporary file;
if the specified file in the cache region has a corresponding temporary file, the usbmount process directly reads the temporary file in the cache region;
step S5, the usbmount process transmits the temporary file generated in the cache region or the temporary file read in the cache region to a Share _ folder _ interface process; and the Share _ folder _ interface process sends the specified file to the cloud desktop, and the cloud desktop finishes reading the specified file.
Further, step S0 is included before step S1, after the mobile storage device is inserted into the terminal device, the terminal device identifies the mobile storage device and mounts the mobile storage device to the shared mounting point of the terminal device; the terminal device is connected with the cloud desktop through an rdp protocol, and the cloud desktop maps the shared mounting point of the terminal device.
Further, in step S5, the usbmount process converts the read specified file into a bitstream and transmits the bitstream to the Share _ folder _ interface process.
Further, step S5 is followed by step S6, after the mobile storage device is removed from the terminal device, the terminal device clears the buffer and the temporary file in the buffer.
The invention also aims to provide a data transmission method of the mobile storage device, which comprises the following steps: step S11, the terminal device sets up a buffer area, the buffer area is used for buffering the temporary data written by the mobile storage device;
step S12, the cloud desktop sends an instruction for writing the specified data into the mobile storage device corresponding to the shared mounting point; the terminal equipment identifies the mobile storage equipment in advance and mounts the mobile storage equipment to a shared mounting point of the terminal equipment;
step S13, the Share _ folder _ interface process obtains the instruction, and obtains the file index information of the temporary data; the Share _ folder _ interface process sends the file index information to the usbmount process;
step S14, the usbmount process judges whether the temporary data has a corresponding temporary file in the cache region according to the file index information; if the temporary data in the cache region does not have the corresponding temporary file, the usbmount process creates a new temporary file, and the cloud desktop writes the temporary data into the new temporary file; if the temporary data in the cache region has the corresponding temporary file, the cloud desktop directly writes the temporary data into the temporary file, and the temporary file obtains a new round of updating;
step 15, after the operation of writing the temporary data into the temporary file by the cloud desktop is finished, copying the temporary file onto the mobile storage device by the usbmount process.
Further, step S10 is included before step S11, after the mobile storage device is inserted into the terminal device, the terminal device identifies the mobile storage device and mounts the mobile storage device to the shared mounting point of the terminal device; the terminal device is connected with the cloud desktop through an rdp protocol, and the cloud desktop maps the shared mounting point of the terminal device.
Further, step S15 is followed by step S16, after the mobile storage device is removed from the terminal device, the terminal device clears the buffer and the temporary file in the buffer.
After the technical scheme is adopted, the invention at least has the following beneficial effects: according to the invention, the cache region is arranged on the terminal equipment, when the cloud desktop reads or writes data into the mobile storage equipment, the data is firstly stored in the cache region, and the data is copied into the mobile storage equipment by the terminal equipment after the data is read or written.
Drawings
Fig. 1 is a flowchart illustrating steps of a data transmission method (data reading) of a mobile storage device according to an embodiment 1 of the present invention.
Fig. 2 is a flowchart illustrating a data transmission method (data writing) of a mobile storage device according to an embodiment 2 of the present invention.
Detailed Description
It should be noted that, in the present application, the embodiments and features of the embodiments may be combined with each other without conflict, and the present application is further described in detail with reference to the drawings and specific embodiments.
According to the invention, the cache region is mainly arranged on the terminal equipment, so that the reading and writing speed of the cloud desktop on the mobile storage equipment is improved, and the transmission efficiency and experience of the cloud desktop are improved. Since any mobile storage device is involved in reading and writing data, the present invention is mainly described in two parts, one part is described in a reading process from the mobile storage device (embodiment 1), and the other part is described in a writing process from the mobile storage device (embodiment 2), which both belong to the field of data operation of a cloud desktop on the mobile storage device.
Example 1
As shown in fig. 1, the present embodiment discloses a data transmission method (data reading) for a mobile storage device, which includes the steps of:
step S0, after the mobile storage device is inserted into the terminal device, the terminal device identifies the mobile storage device and mounts the mobile storage device to a shared mounting point of the terminal device; the terminal equipment is connected with the cloud desktop through an rdp protocol, and the cloud desktop maps a shared mounting point of the terminal equipment; the mapping function is that the cloud desktop can directly read and write the data of the mobile storage device through the shared mounting point; in this embodiment, the mobile storage device is preferentially selected as the USB storage device;
step S1, the terminal device sets a buffer area, and the buffer area is used for buffering the temporary file of the mobile storage device;
step S2, the cloud desktop sends out an instruction for reading the specified file of the corresponding mobile storage device in the shared mounting point;
step S3, a Share _ folder _ interface process acquisition instruction of the terminal equipment acquires file index information of the designated file; the Share _ folder _ interface process sends the file index information to the usbmount process;
step S4, the usbmount process judges whether the designated file has a corresponding temporary file in the cache region according to the file index information; if the specified file does not have the corresponding temporary file in the cache region, the usbmount process reads the specified file from the mobile storage device according to the file index information, and stores the specified file in the cache region to generate the corresponding temporary file;
if the specified file in the cache region has a corresponding temporary file, the usbmount process directly reads the specified file in the cache region;
step S5, the usbmount process transmits the read specified file to the Share _ folder _ interface process; the Share _ folder _ interface process sends the specified file to the cloud desktop, and the cloud desktop finishes reading the specified file; preferentially, the usbmount process converts the read specified file into a bit stream and then transmits the bit stream to the Share _ folder _ interface process;
and step S6, after the mobile storage device is removed from the terminal device, the terminal device clears the buffer area and the temporary file in the buffer area.
Example 2
As shown in fig. 2, the present embodiment provides a data transmission method (data writing) for a mobile storage device, including the following steps:
step S10, after the mobile storage device is inserted into the terminal device, the terminal device identifies the mobile storage device and mounts the mobile storage device to a shared mounting point of the terminal device; the terminal equipment is connected with the cloud desktop through an rdp protocol, and the cloud desktop maps a shared mounting point of the terminal equipment;
step S11, the terminal device sets up a buffer area, the buffer area is used for buffering the temporary data written by the mobile storage device;
step S12, the cloud desktop sends an instruction for writing the specified data into the mobile storage device corresponding to the shared mounting point;
step S13, the Share _ folder _ interface process obtains the instruction, and obtains the file index information of the temporary data; the Share _ folder _ interface process sends the file index information to the usbmount process;
step S14, the usbmount process judges whether the temporary data has a corresponding temporary file in the cache region according to the file index information; if the temporary data in the cache region does not have the corresponding temporary file, the usbmount process creates a new temporary file, and the cloud desktop writes the temporary data into the new temporary file; if the temporary data in the cache region has the corresponding temporary file, the cloud desktop directly writes the temporary data into the temporary file, and the temporary file obtains a new round of updating;
step S15, after the operation that the cloud desktop writes the temporary data into the temporary file is finished, copying the temporary file to the mobile storage device by the usbmount process;
and step S16, after the mobile storage device is removed from the terminal device, the terminal device clears the buffer area and the temporary file in the buffer area.
In this embodiment 1 and embodiment 2, a buffer area is mainly set in the terminal device, when the cloud desktop reads or writes data into the mobile storage device, the data is first stored in the buffer area, and the data is copied into the mobile storage device by the terminal device after the data is read or written, because the buffer area of the terminal device has a faster read-write speed than the mobile storage device (for example, the terminal device uses a solid state disk, the read speed can reach 2G per second, while the mobile storage device can only reach 100M per second, and the difference between the read-write speeds of the two devices is huge and obvious), the speed of reading or writing the data into the mobile storage device by the cloud desktop is greatly increased.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various equivalent changes, modifications, substitutions and alterations can be made herein without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.