Disclosure of Invention
The invention provides a data transmission method, a device, equipment and a storage medium, which can reduce the consumption of memory resources and improve the efficiency of batch file processing.
According to an aspect of the present invention, there is provided a data transmission method applied to a data receiving side, the method comprising:
Receiving a subfile from a data sender and storing the subfile into a first file directory;
Decrypting the subfiles by adopting a preset symmetric encryption algorithm, and moving the decrypted subfiles to a second file directory;
Receiving a file transmission message from a distributed file monitoring tool, responding, and carrying out file merging on the subfiles in the second file directory based on the file transmission message to generate a target file, wherein the target file is a file required by a data receiver for batch file processing operation;
And when the number of the target files reaches a preset target number threshold, starting batch file processing operation.
According to another aspect of the present invention, there is provided a data transmission method applied to a data sender, the method comprising:
Dividing the target file into at least one sub-file, encrypting the sub-file by adopting a preset symmetric encryption algorithm, and then sending the sub-file to a data receiver in disorder, wherein the naming information of the sub-file is determined according to the file name of the target file and the dividing sequence of the sub-file;
After each sub-file is successfully sent, the data sender informs the distributed file monitoring tool to send a file transmission message of the sub-file to the data receiver so that the data receiver can merge target files according to the file transmission message, wherein the file transmission message comprises naming information, file abstract information and file path information of the sub-file.
According to another aspect of the present invention, there is provided a data transmission apparatus for use with a data receiver, the apparatus comprising:
The file receiving module is used for receiving the subfiles from the data sender and storing the subfiles into the first file catalogue;
the file decryption module is used for decrypting the subfiles by adopting a preset symmetric encryption algorithm and moving the decrypted subfiles to a second file directory;
The file merging module is used for receiving the file transmission message from the distributed file monitoring tool and responding, and carrying out file merging on the subfiles in the second file catalogue based on the file transmission message to generate a target file, wherein the target file is a file required by a data receiver for carrying out batch file processing operation;
And the batch processing module is used for starting batch file processing operation when the number of the target files reaches a preset target number threshold value.
According to another aspect of the present invention, there is provided a data transmission apparatus for use with a data receiver, the apparatus comprising:
The file sending module is used for segmenting the target file into at least one sub-file, encrypting the sub-file by adopting a preset symmetric encryption algorithm and then sending the sub-file to a data receiver in disorder, wherein the naming information of the sub-file is determined according to the file name of the target file and the segmentation sequence of the sub-file;
and the message sending module is used for informing the distributed file monitoring tool to send the file transmission message of the subfile to the data receiver after each subfile is successfully sent, so that the data receiver carries out the merging of the target files according to the file transmission message, wherein the file transmission message comprises the naming information, the file abstract information and the file path information of the subfiles.
According to another aspect of the present invention, there is provided an electronic apparatus including:
At least one processor, and
A memory communicatively coupled to the at least one processor, wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the data transmission method according to any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a data transmission method according to any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer program product comprising a computer program which, when executed by a processor, implements a data transmission method according to any of the embodiments of the present invention.
According to the technical scheme, the received subfiles are processed by adopting the multi-stage file catalogue to generate the target file, the file data processing flow is normalized, the subfiles in different processing stages are classified and stored, the data pollution is avoided, the data processing efficiency is improved, the target file is combined through the file transmission information, the imperceptible file arrival event is converted into a perceptible, audible and processable file transmission information, the saving of thread resources is realized, and the timeliness of batch file processing operation is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements that are expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a data transmission method according to an embodiment of the present invention, where the method may be performed by a data transmission device, and the data transmission device may be implemented in hardware and/or software, and the data transmission device may be configured in various general-purpose computing devices. As shown in fig. 1, the method includes:
s110, receiving the subfiles from the data sender and storing the subfiles to the first file catalogue.
The subfiles may be subfiles of files required for the batch file processing operation of the data receiver. The first file directory may be a temporary directory for receiving files by the data receiver.
It should be noted that, in the embodiment of the present invention, the data receiver and the data sender are data nodes in the distributed system, the identities of the data sender and the data receiver may be interchanged, when the data node in the distributed system receives data, the data node is the data receiver, and when the data node in the distributed system performs data transmission, the data node is the data sender. In the distributed system, an encryption algorithm is negotiated in advance between each data node, and the reliability of a data transmission process can be ensured through the data encryption algorithm when data transmission is carried out between each data node. At the same time, the data receiving node may receive data transmitted from at least one data transmitting node. Alternatively, the encryption algorithm may be adaptively set according to those skilled in the art, and is not particularly limited herein.
Specifically, when the data receiver receives the subfiles transmitted from at least one data sender, the subfiles are stored in the first file directory.
S120, decrypting the subfiles by adopting a preset encryption algorithm, and moving the decrypted subfiles to a second file directory.
The second file directory is used for storing the decrypted received data.
In an alternative embodiment of the present invention, a preset encryption algorithm is adopted to decrypt the subfiles, and the decrypted subfiles are moved to the second file directory, and further including replacing the subfiles with the decrypted subfiles if the subfiles with the same naming information as the decrypted subfiles exist in the second file directory.
In the embodiment of the invention, subfiles with different transmission versions may exist, and the naming information of the subfiles is the same, but the file content of the subfiles may be changed. Therefore, in the case that the subfiles with the same naming information as the subfiles after the new decryption already exist in the second file directory, the subfiles already existing in the second file directory are replaced by the subfiles after the new decryption, and the newly received subfiles are used as the reference.
S130, receiving and responding to the file transmission message from the distributed file monitoring tool, and carrying out file merging on the subfiles in the second file directory based on the file transmission message to generate the target file.
The distributed file monitoring tool can be a real-time data monitoring tool arranged in the distributed system and is used for processing and analyzing data flow data, when the distributed file monitoring tool monitors that a sub-file is successfully sent by a data sender, a file transmission message is generated and sent to a file receiver of the sub-file, the file transmission message can comprise file naming information, file abstract information and a sub-file quantity threshold value of the sub-file, the target file can be a file required by the data receiver for batch file processing operation, and optionally, the target file required by the data receiver is generally stored in other data nodes in the distributed system.
In the file transmission process, in order to ensure data security, the data sender may encrypt and send the target file after splitting the target file, so that the data receiver needs to combine the sub-files after receiving the sub-files, and then can obtain the target file.
And S140, when the number of the target files reaches a preset target number threshold, starting batch file processing operation.
Specifically, when the data receiver monitors that the received target file reaches a preset target quantity threshold value required by the batch file processing operation, the batch file processing operation is started. Alternatively, the preset target number threshold may be adaptively set according to those skilled in the art.
According to the technical scheme, the received subfiles are processed by adopting the multi-stage file catalogue to generate the target file, the file data processing flow is normalized, the subfiles in different processing stages are classified and stored, the data pollution is avoided, the data processing efficiency is improved, the target file is combined through the file transmission information, the imperceptible file arrival event is converted into a perceptible, audible and processable file transmission information, the saving of thread resources is realized, and the timeliness of batch file processing operation is improved.
Example two
Fig. 2 is a flowchart of a data transmission method provided in a second embodiment of the present invention, where the embodiment is further refined based on the foregoing embodiment, and specific steps of receiving a file transmission message from a distributed file monitoring tool and responding, and performing file merging on subfiles in a second file directory based on the file transmission message to generate a target file are provided. It should be noted that, in the parts of the embodiments of the present invention that are not described in detail, reference may be made to related expressions of other embodiments, which are not described in detail herein. As shown in fig. 2, the method includes:
s210, receiving the subfiles from the data sender and storing the subfiles to the first file directory.
S220, decrypting the subfiles by adopting a preset encryption algorithm, and moving the decrypted subfiles to a second file directory.
S230, traversing the subfiles in the second file directory according to the pre-naming information in the file naming information, determining a target subfile, and moving the target subfile to a third file directory.
The subfiles stored in the third file directory are files to be combined, and have the same pre-naming information. It should be noted that, the naming information of the sub-file is composed of pre-naming information and post-naming information, the pre-naming information may be the naming information of the parent file to which the sub-file belongs, and the post-naming information may be used to characterize the splitting sequence when the sub-file is split.
In the case that the third file catalogue is empty, the data receiver can sequentially extract the file transmission information from the message queue, traverse the subfiles in the second file catalogue according to the pre-naming information of the file naming information in the file transmission information, determine the subfiles with the same pre-naming information in the second file catalogue as target subfiles, and move the target subfiles to the third file catalogue. Under the condition that the third file catalogue is not empty, the data receiver extracts the front naming information in the file transmission message from the message queue, if the front naming information is different from the front naming information of the subfiles in the third file catalogue, the file transmission information is put into the message queue in a flushing mode, and the file transmission information is extracted from the message queue in a flushing mode again, so that the subfiles in the third file catalogue are guaranteed to have the same front naming information.
In an optional implementation manner of the embodiment of the invention, traversing the subfiles in the second file directory according to the pre-naming information in the file naming information to determine the target subfiles, including traversing the subfiles in the second file directory according to the pre-naming information in the file naming information to determine candidate subfiles, checking the candidate subfiles according to the file abstract information in the file naming information, and determining the candidate subfiles as the target subfiles if the checking is passed.
And checking the candidate subfiles through file abstract information, and generating the accuracy of the target file.
S240, when the number of the files in the third file directory reaches the threshold value of the number of the subfiles, merging the subfiles in the third file directory according to the sequence of the post naming information in the file naming information to generate the target file.
The sub-file number threshold may be used to characterize the number of sub-files after the target file is segmented. Alternatively, the subfile number threshold may be adaptively set according to those skilled in the art.
After the target file is generated, the target file may be saved in a file batch processing server set by the data receiver, so as to prepare for batch file processing operation.
S250, when the number of the target files reaches a preset target number threshold, starting batch file processing operation.
According to the technical scheme, the target file is generated by merging the sub-files through the front naming information and the rear naming information in the file naming information, and the accuracy of the generated target file is ensured.
Example III
Fig. 3 is a flowchart of a data transmission method provided in a third embodiment of the present invention, where the method may be performed by a data transmission device, and the data transmission device may be implemented in hardware and/or software, and the data transmission device may be configured in various general-purpose computing devices. As shown in fig. 3, the method includes:
S310, segmenting the target file into at least one sub-file, encrypting the sub-file by adopting a preset encryption algorithm, and then sending the encrypted sub-file to a data receiver in disorder, wherein the naming information of the sub-file is determined according to the file name of the target file and the segmentation order of the sub-file.
And S320, after each sub-file is successfully transmitted, the data sender informs the distributed file monitoring tool to transmit a file transmission message of the sub-file to the data receiver so that the data receiver performs merging of target files according to the file transmission message, wherein the file transmission message comprises naming information, file abstract information and file path information of the sub-file.
In the embodiment of the invention, when a data sender in a distributed system sends a target file to a data receiver, the target file is split into at least one sub-file, the sub-file is encrypted by adopting a preset encryption algorithm and then sent to the data receiver in disorder, so that the file transmission efficiency is improved, and after the sub-file is successfully sent by the data sender, a distributed file monitoring tool arranged in the distributed system monitors the file transmission action and generates a file transmission message of the sub-file and sends the file transmission message to the data receiver.
According to the technical scheme, the target files are combined through the file transmission messages, the imperceptible file arrival event is converted into the perceptible, audible and processable file transmission message, the thread resource saving is realized, and the timeliness of batch file processing operation is improved.
Example IV
Fig. 4 is a schematic structural diagram of a data transmission device applied to a data receiving party according to a fourth embodiment of the present invention. As shown in fig. 4, the apparatus includes:
A file receiving module 410, configured to receive a subfile from a data sender, and store the subfile to a first file directory;
the file decryption module 420 is configured to decrypt the subfiles by using a preset symmetric encryption algorithm, and move the decrypted subfiles to a second file directory;
The file merging module 430 is configured to receive a file transfer message from the distributed file monitoring tool and respond to the file transfer message, and perform file merging on the subfiles in the second file directory based on the file transfer message to generate a target file, where the target file is a file required by the data receiver for performing a batch file processing operation;
the batch processing module 440 is configured to start a batch file processing job when the number of the target files reaches a preset target number threshold.
According to the technical scheme, the received subfiles are processed by adopting the multi-stage file catalogue to generate the target file, the file data processing flow is normalized, the subfiles in different processing stages are classified and stored, the data pollution is avoided, the data processing efficiency is improved, the target file is combined through the file transmission information, the imperceptible file arrival event is converted into a perceptible, audible and processable file transmission information, the saving of thread resources is realized, and the timeliness of batch file processing operation is improved.
Optionally, the file transfer message may include file naming information, file summary information, and a threshold number of subfiles for the subfiles.
Optionally, the file merging module 430 includes:
The target sub-file determining unit is used for traversing the sub-files in the second file catalogue according to the pre-naming information in the file naming information, determining target sub-files and moving the target sub-files to a third file catalogue;
and the target file generating unit is used for merging the sub files in the third file directory according to the sequence of the post naming information in the file naming information to generate the target file when the number of the files in the third file directory reaches the sub file number threshold.
Alternatively, the subfiles stored in the third file directory may be files to be merged, and have the same pre-naming information.
Optionally, the target sub-file determining unit may be specifically configured to traverse the sub-files in the second file directory according to the pre-naming information in the file naming information to determine candidate sub-files, check the candidate sub-files according to the file summary information in the file naming information, and determine the candidate sub-files as target sub-files if the check is passed.
Alternatively, the pre-naming information may be file naming information of a parent file to which the child file belongs, and the post-naming information may be used to characterize a splitting order when the child file is split.
Optionally, the apparatus further comprises:
and the file replacing module is used for replacing the subfiles with the decrypted subfiles if the subfiles with the same naming information as the decrypted subfiles exist in the second file catalogue.
The data transmission device applied to the data receiver provided by the embodiment of the invention can execute the data transmission method applied to the data receiver provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example five
Fig. 5 is a schematic structural diagram of a data transmission device applied to a data sender according to a fifth embodiment of the present invention. As shown in fig. 5, the apparatus includes:
the file sending module 510 is configured to segment a target file into at least one sub-file, encrypt the sub-file by using a preset symmetric encryption algorithm, and send the sub-file to a data receiver in disorder, where naming information of the sub-file is determined according to a file name of the target file and a segmentation order of the sub-file;
and the message sending module 520 is configured to, after each sub-file is successfully sent, notify the distributed file monitoring tool to send a file transmission message of the sub-file to the data receiver, so that the data receiver performs merging of the target file according to the file transmission message, where the file transmission message includes naming information, file summary information and file path information of the sub-file.
According to the technical scheme, the target files are combined through the file transmission messages, the imperceptible file arrival event is converted into the perceptible, audible and processable file transmission message, the thread resource saving is realized, and the timeliness of batch file processing operation is improved.
The data transmission device applied to the data sender provided by the embodiment of the invention can execute the data transmission method applied to the data sender provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example six
Fig. 6 shows a schematic diagram of an electronic device 610 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 6, the electronic device 610 includes at least one processor 611, and a memory, such as a Read Only Memory (ROM) 612, a Random Access Memory (RAM) 613, etc., communicatively coupled to the at least one processor 611, where the memory stores computer programs executable by the at least one processor, and the processor 611 may perform various suitable actions and processes according to the computer programs stored in the Read Only Memory (ROM) 612 or the computer programs loaded from the storage unit 618 into the Random Access Memory (RAM) 613. In the RAM 613, various programs and data required for the operation of the electronic device 610 may also be stored. The processor 611, the ROM 612, and the RAM 613 are connected to each other by a bus 614. An input/output (I/O) interface 615 is also connected to bus 614.
Various components in the electronic device 610 are connected to I/O interfaces 615, including an input unit 616, such as a keyboard, mouse, etc., an output unit 617, such as various types of displays, speakers, etc., a storage unit 618, such as a magnetic disk, optical disk, etc., and a communication unit 619, such as a network card, modem, wireless communication transceiver, etc. The communication unit 619 allows the electronic device 610 to exchange information/data with other devices through computer networks, such as the internet, and/or various telecommunication networks.
Processor 611 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 611 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 611 performs the various methods and processes described above, such as a data transmission method.
In some embodiments, the data transmission method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 618. In some embodiments, some or all of the computer program may be loaded and/or installed onto the electronic device 610 via the ROM 612 and/or the communication unit 619. When the computer program is loaded into RAM 613 and executed by processor 611, one or more steps of the data transmission method described above may be performed. Alternatively, in other embodiments, the processor 611 may be configured to perform the data transmission method in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above can be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be a special or general purpose programmable processor, operable to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user, for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback), and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a Local Area Network (LAN), a Wide Area Network (WAN), a blockchain network, and the Internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.