[go: up one dir, main page]

CN112015594A - Backup method, device and equipment of rollback file and storage medium - Google Patents

Backup method, device and equipment of rollback file and storage medium Download PDF

Info

Publication number
CN112015594A
CN112015594A CN202010880807.4A CN202010880807A CN112015594A CN 112015594 A CN112015594 A CN 112015594A CN 202010880807 A CN202010880807 A CN 202010880807A CN 112015594 A CN112015594 A CN 112015594A
Authority
CN
China
Prior art keywords
file
byte data
backed
rollback
length
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.)
Pending
Application number
CN202010880807.4A
Other languages
Chinese (zh)
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.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202010880807.4A priority Critical patent/CN112015594A/en
Publication of CN112015594A publication Critical patent/CN112015594A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1464Management of the backup or restore process for networked environments
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Power Engineering (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the field of research and development management, and discloses a backup method, a backup device, backup equipment and a backup storage medium for a rollback file, which are used for solving the problem of low efficiency of searching the rollback file when a file is rolled back by gray release. The backup method of the rollback file comprises the following steps: acquiring byte data of a file to be backed up, wherein the byte data is the size of a storage space occupied by the file to be backed up; supplementing the byte data by adopting a message digest algorithm to obtain initialized byte data; performing cyclic linear calculation on the initialized byte data by using a preset buffer to obtain a safety information code; acquiring a time stamp of a file to be backed up; and splicing the timestamp and the safety information code by using a combination algorithm to obtain the name of the file to be backed up, determining the name of the file to be backed up as the name of the file to be backed up to obtain a rollback file, and storing the rollback file into a rollback folder. In addition, the invention also relates to a block chain technology, and the files to be backed up can be stored in the block chain.

Description

回滚文件的备份方法、装置、设备及存储介质Backup method, device, device and storage medium for rollback files

技术领域technical field

本发明涉及研发管理领域,尤其涉及一种回滚文件的备份方法、装置、设备及存储介质。The invention relates to the field of research and development management, and in particular, to a backup method, device, device and storage medium for rolling back files.

背景技术Background technique

随着计算机技术的不断发展与进步,计算机技术中的网络项目也需要不断的更新。在网络项目的更新中灰度发布是一种常用的更新方式,灰度发布是指根据特定的规则,挑选一部分用户访问项目的新版本,一部分用户仍旧访问项目老版本,待项目新版本的功能验证成功后,再将所有用户访问迁移到项目的新版本上来,完成了网络项目的更新。With the continuous development and progress of computer technology, network projects in computer technology also need to be constantly updated. In the update of network projects, grayscale release is a common update method. Grayscale release refers to selecting some users to access the new version of the project according to specific rules, while some users still access the old version of the project, waiting for the function of the new version of the project. After the verification is successful, all user access is migrated to the new version of the project, and the update of the network project is completed.

当灰度发布项目后,一旦发现项目的新版本出现问题就需要进行老版本的切换。在现有的技术中,服务器在执行文件回滚的功能时,不能精确找到所需回滚文件的文件名称,导致查找回滚文件的效率低下。When the project is released in Grayscale, once the new version of the project is found to have problems, the old version needs to be switched. In the prior art, when the server performs the file rollback function, it cannot accurately find the file name of the required rollback file, resulting in low efficiency of searching for the rollback file.

发明内容SUMMARY OF THE INVENTION

本发明的主要目的在于解决灰度发布在进行文件回滚时,查找回滚文件的效率低下的问题。The main purpose of the present invention is to solve the problem of low efficiency in searching for the rollback file when the file rollback is performed in grayscale publishing.

本发明第一方面提供了一种回滚文件的备份方法,包括:获取待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小;采用消息摘要算法对所述字节数据进行补充,得到初始化字节数据;利用预置缓存器对所述初始化字节数据进行循环线性计算,得到安全信息码;获取所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻;利用结合算法拼接所述时间戳与所述安全信息码,得到待备份文件名称,确定所述待备份文件名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。A first aspect of the present invention provides a backup method for rolling back files, including: acquiring byte data of a file to be backed up, wherein the byte data is the size of the storage space occupied by the file to be backed up; using a message digest The algorithm supplements the byte data to obtain initialized byte data; uses a preset buffer to perform cyclic linear calculation on the initialized byte data to obtain a security information code; obtains the timestamp of the file to be backed up, wherein, The time stamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up; the time stamp and the security information code are spliced using a combination algorithm to obtain the name of the file to be backed up, and the name of the file to be backed up is determined to be: Name the file to be backed up, obtain the rollback file, and save the rollback file in the rollback folder.

可选的,在本发明第一方面的第一种实现方式中,所述采用消息摘要算法对所述字节数据进行补充,得到初始化字节数据包括:采用消息摘要算法判断所述字节数据的长度是否等于预置字节长度;若所述字节数据的长度小于所述预置字节长度,则补充所述字节数据的长度,直到所述字节数据的长度达到所述预置字节长度,得到补充字节数据;若所述字节数据的长度等于所述预置字节长度,则将所述字节数据确定为待补充字节数据;在所述待补充字节数据的最后一位后添加扩展数据,得到初始化字节数据,其中,所述扩展数据为记录所述字节数据的长度的数据。Optionally, in the first implementation manner of the first aspect of the present invention, the using a message digest algorithm to supplement the byte data to obtain the initialized byte data includes: using a message digest algorithm to determine the byte data. Whether the length of the byte data is equal to the preset byte length; if the length of the byte data is less than the preset byte length, supplement the length of the byte data until the length of the byte data reaches the preset length byte length to obtain supplementary byte data; if the length of the byte data is equal to the preset byte length, the byte data is determined as the byte data to be supplemented; in the byte data to be supplemented Add extended data after the last bit of , to obtain initialized byte data, wherein the extended data is data recording the length of the byte data.

可选的,在本发明第一方面的第二种实现方式中,所述若所述字节数据的长度小于所述预置字节长度,则补充所述字节数据的长度,直到所述字节数据的长度达到所述预置字节长度,得到补充字节数据包括:若所述字节数据的长度小于所述预置字节长度,则根据预置公式计算需要补充字节数据的长度n,所述预置公式为:(n+m)mod512=448,其中,m为字节数据的长度,n为需要补充字节数据的长度,n、m均为正整数;在所述字节数据后补充长度为n的补充字节,得到待补充字节数据。Optionally, in the second implementation manner of the first aspect of the present invention, if the length of the byte data is less than the preset byte length, the length of the byte data is supplemented until the The length of the byte data reaches the preset byte length, and obtaining the supplementary byte data includes: if the length of the byte data is less than the preset byte length, calculating the amount of the byte data that needs to be supplemented according to the preset formula. Length n, the preset formula is: (n+m)mod512=448, where m is the length of the byte data, n is the length of the byte data to be supplemented, and both n and m are positive integers; A supplementary byte of length n is supplemented after the byte data to obtain the byte data to be supplemented.

可选的,在本发明第一方面的第三种实现方式中,所述利用预置缓存器对所述初始化字节数据进行循环线性计算,得到安全信息码包括:初始化所述预置缓存器,得到初始输入值,并将所述初始输入值输入到预置线性函数中,得到第一计算结果;将所述初始化字节数据平均分成四组,分别得到第一分组字节数据、第二分组字节数据、第三分组字节数据和第四分组字节数据;将所述第一计算结果与所述第一分组字节数据相加后输入到所述预置线性函数中,得到第二计算结果;将所述第二计算结果与所述第二分组字节数据相加后输入到所述预置线性函数中,得到第三计算结果;将所述第三计算结果与所述第三分组字节数据相加后输入到所述预置线性函数中,得到第四计算结果;将所述第四计算结果与所述第四分组字节数据相加后输入到所述预置线性函数中,得到第五计算结果;将所述第二计算结果、所述第三计算结果、所述第四计算结果和所述第五计算结果合并,得到安全信息码。Optionally, in a third implementation manner of the first aspect of the present invention, the using a preset buffer to perform cyclic linear calculation on the initialization byte data to obtain the security information code includes: initializing the preset buffer. , obtain the initial input value, and input the initial input value into the preset linear function to obtain the first calculation result; divide the initialized byte data into four groups on average to obtain the first grouped byte data, the second grouped byte data, third grouped byte data and fourth grouped byte data; adding the first calculation result and the first grouped byte data and inputting it into the preset linear function to obtain the first Second calculation result; add the second calculation result and the second grouped byte data and input it into the preset linear function to obtain a third calculation result; combine the third calculation result with the first After three groups of byte data are added and input into the preset linear function, a fourth calculation result is obtained; the fourth calculation result and the fourth group of byte data are added and input into the preset linear function In the function, a fifth calculation result is obtained; the second calculation result, the third calculation result, the fourth calculation result and the fifth calculation result are combined to obtain a security information code.

可选的,在本发明第一方面的第四种实现方式中,所述获取所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻包括:分别提取所述待备份文件的末次时刻以及当前时刻,其中,所述末次时刻包括末次访问时刻、末次修改时刻、末次更改时刻;分别计算所述末次访问时刻与所述当前时刻之间的第一时间间隔、所述末次修改时刻与所述当前时刻之间的第二时间间隔以及所述末次更改时刻分别与所述当前时刻之间的第三时间间隔;在所述第一时间间隔、所述第二时间间隔与所述第三时间间隔中筛选时间间隔数值最小的目标时间间隔,将所述目标时间间隔对应的末次时刻确定为所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻。Optionally, in a fourth implementation manner of the first aspect of the present invention, the time stamp of the file to be backed up is obtained, wherein the time stamp is used to indicate that the file to be backed up executes the last modification instruction corresponding to The time includes: extracting the last time and the current time of the file to be backed up, wherein the last time includes the last access time, the last modification time, and the last modification time; respectively calculate the last access time and the current time. The first time interval between the last modification time and the current time, the second time interval between the last modification time and the current time, and the third time interval between the last modification time and the current time respectively; at the first time The target time interval with the smallest value of the screening time interval among the interval, the second time interval and the third time interval, and the last time corresponding to the target time interval is determined as the time stamp of the file to be backed up, wherein the The time stamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up.

可选的,在本发明第一方面的第五种实现方式中,所述利用结合算法拼接所述时间戳与所述安全信息码,得到待备份文件名称,确定所述待备份文件名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中包括:采用结合算法分别提取待备份文件的时间戳与安全信息码;利用预置连接符将所述安全信息码拼接在所述时间戳之后,得到待备份文件名称,确定所述待备份文件名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。Optionally, in a fifth implementation manner of the first aspect of the present invention, the time stamp and the security information code are spliced together using a combination algorithm to obtain the name of the file to be backed up, and the name of the file to be backed up is determined to be the name of the file to be backed up. Describe the naming of the file to be backed up, obtain the rollback file, and save the rollback file in the rollback folder, including: using a combination algorithm to extract the time stamp and security information code of the file to be backed up respectively; After the security information code is spliced into the timestamp, the name of the file to be backed up is obtained, the name of the file to be backed up is determined to be the name of the file to be backed up, the rollback file is obtained, and the rollback file is saved to the back-up file. scroll folder.

可选的,在本发明第一方面的第六种实现方式中,所述获取待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小包括:读取待备份文件,并获取所述待备份文件中的多个文件数据信息;根据统计算法分别统计所述多个文件数据信息中每个文件数据信息的字节数,得到多个基本字节数;汇总所述多个基本字节数,得到所述待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小。Optionally, in a sixth implementation manner of the first aspect of the present invention, the obtaining byte data of the file to be backed up, wherein the byte data is the size of the storage space occupied by the file to be backed up includes: Read the file to be backed up, and obtain a plurality of file data information in the to-be-backed file; according to a statistical algorithm, respectively count the number of bytes of each file data information in the plurality of file data information, and obtain a plurality of basic bytes Summarize the plurality of basic byte numbers to obtain byte data of the file to be backed up, where the byte data is the size of the storage space occupied by the file to be backed up.

本发明第二方面提供了一种回滚文件的备份装置,包括:第一获取模块,用于获取待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小;补充模块,用于采用消息摘要算法对所述字节数据进行补充,得到初始化字节数据;计算模块,用于利用预置缓存器对所述初始化字节数据进行循环线性计算,得到安全信息码;第二获取模块,用于获取所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻;确定与保存模块,用于利用结合算法拼接所述时间戳与所述安全信息码,得到待备份文件名称,确定所述待备份文件名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。A second aspect of the present invention provides a backup device for rolling back files, including: a first obtaining module, configured to obtain byte data of a file to be backed up, wherein the byte data is the storage occupied by the file to be backed up The size of the space; the supplementary module is used to supplement the byte data by using the message digest algorithm to obtain initialized byte data; the calculation module is used to perform circular linear calculation on the initialized byte data by using the preset buffer, obtaining a security information code; a second obtaining module for obtaining the timestamp of the file to be backed up, wherein the timestamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up; determining and saving the module, It is used for splicing the time stamp and the security information code by using a combination algorithm, obtaining the name of the file to be backed up, determining that the name of the file to be backed up is the name of the file to be backed up, obtaining a rollback file, and rolling back the file. The file is saved to the rollback folder.

可选的,在本发明第二方面的第一种实现方式中,所述补充模块包括:判断单元,用于采用消息摘要算法判断所述字节数据的长度是否等于预置字节长度;第一确定单元,若所述字节数据的长度小于所述预置字节长度,则用于补充所述字节数据的长度,直到所述字节数据的长度达到所述预置字节长度,得到待补充字节数据;第二确定单元,若所述字节数据的长度等于所述预置字节长度,则用于将所述字节数据确定为待补充字节数据;添加单元,用于在所述补充字节数据的最后一位后添加扩展数据,得到初始化字节数据,其中,所述扩展数据为记录所述字节数据的长度的数据。Optionally, in the first implementation manner of the second aspect of the present invention, the supplementary module includes: a judgment unit, configured to use a message digest algorithm to judge whether the length of the byte data is equal to the preset byte length; a determining unit, if the length of the byte data is less than the preset byte length, it is used to supplement the length of the byte data until the length of the byte data reaches the preset byte length, Obtaining the byte data to be supplemented; the second determining unit, if the length of the byte data is equal to the preset byte length, is used to determine the byte data as the byte data to be supplemented; the adding unit, using Adding extended data after the last bit of the supplementary byte data to obtain initialized byte data, wherein the extended data is data recording the length of the byte data.

可选的,在本发明第二方面的第二种实现方式中,所述第一确定单元具体用于:若所述字节数据的长度小于所述预置字节长度,则根据预置公式计算需要补充字节数据的长度n,所述预置公式为:(n+m)mod512=448,其中,m为字节数据的长度,n为需要补充字节数据的长度,n、m均为正整数;在所述字节数据后补充长度为n的补充字节,得到待补充字节数据。Optionally, in the second implementation manner of the second aspect of the present invention, the first determination unit is specifically configured to: if the length of the byte data is less than the preset byte length, then according to the preset formula Calculate the length n of the byte data that needs to be supplemented. The preset formula is: (n+m)mod512=448, where m is the length of the byte data, n is the length of the byte data that needs to be supplemented, and both n and m are is a positive integer; after the byte data, supplementary bytes with a length of n are added to obtain the byte data to be supplemented.

可选的,在本发明第二方面的第三种实现方式中,所述计算模块具体用于:初始化所述预置缓存器,得到初始输入值,并将所述初始输入值输入到预置线性函数中,得到第一计算结果;将所述初始化字节数据平均分成四组,分别得到第一分组字节数据、第二分组字节数据、第三分组字节数据和第四分组字节数据;将所述第一计算结果与所述第一分组字节数据相加后输入到所述预置线性函数中,得到第二计算结果;将所述第二计算结果与所述第二分组字节数据相加后输入到所述预置线性函数中,得到第三计算结果;将所述第三计算结果与所述第三分组字节数据相加后输入到所述预置线性函数中,得到第四计算结果;将所述第四计算结果与所述第四分组字节数据相加后输入到所述预置线性函数中,得到第五计算结果;将所述第二计算结果、所述第三计算结果、所述第四计算结果和所述第五计算结果合并,得到安全信息码。Optionally, in a third implementation manner of the second aspect of the present invention, the computing module is specifically configured to: initialize the preset buffer, obtain an initial input value, and input the initial input value into a preset In the linear function, the first calculation result is obtained; the initialization byte data is equally divided into four groups, and the first grouped byte data, the second grouped byte data, the third grouped byte data and the fourth grouped byte are obtained respectively. data; add the first calculation result and the first grouped byte data and input it into the preset linear function to obtain a second calculation result; combine the second calculation result with the second grouping The byte data is added and input into the preset linear function to obtain a third calculation result; the third calculation result and the third grouped byte data are added and input into the preset linear function , obtain the fourth calculation result; add the fourth calculation result and the fourth grouped byte data and input it into the preset linear function to obtain the fifth calculation result; combine the second calculation result, The third calculation result, the fourth calculation result and the fifth calculation result are combined to obtain a security information code.

可选的,在本发明第二方面的第四种实现方式中,所述第二获取模块具体用于:分别提取所述待备份文件的末次时刻以及当前时刻,其中,所述末次时刻包括末次访问时刻、末次修改时刻、末次更改时刻;分别计算所述末次访问时刻与所述当前时刻之间的第一时间间隔、所述末次修改时刻与所述当前时刻之间的第二时间间隔以及所述末次更改时刻分别与所述当前时刻之间的第三时间间隔;在所述第一时间间隔、所述第二时间间隔与所述第三时间间隔中筛选时间间隔数值最小的目标时间间隔,将所述目标时间间隔对应的末次时刻确定为所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻。Optionally, in a fourth implementation manner of the second aspect of the present invention, the second acquisition module is specifically configured to: extract the last time and the current time of the file to be backed up, wherein the last time includes the last time. Access time, last modification time, and last modification time; respectively calculate the first time interval between the last access time and the current time, the second time interval between the last modification time and the current time, and all The third time interval between the last modification moment and the current moment respectively; in the first time interval, the second time interval and the third time interval, the target time interval with the smallest time interval value is screened, The last time corresponding to the target time interval is determined as the time stamp of the file to be backed up, where the time stamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up.

可选的,在本发明第二方面的第五种实现方式中,所述确定与保存模块具体用于:采用结合算法分别提取待备份文件的时间戳与安全信息码;利用预置连接符将所述安全信息码拼接在所述时间戳之后,得到待备份文件名称,确定所述待备份文件名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。Optionally, in a fifth implementation manner of the second aspect of the present invention, the determining and saving module is specifically configured to: extract the time stamp and security information code of the file to be backed up by using a combination algorithm; After the security information code is spliced into the timestamp, the name of the file to be backed up is obtained, the name of the file to be backed up is determined to be the name of the file to be backed up, the rollback file is obtained, and the rollback file is saved to the back-up file. scroll folder.

可选的,在本发明第二方面的第六种实现方式中,所述第一获取模块具体用于:读取待备份文件,并获取所述待备份文件中的多个文件数据信息;根据统计算法分别统计所述多个文件数据信息中每个文件数据信息的字节数,得到多个基本字节数;汇总所述多个基本字节数,得到所述待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小。Optionally, in a sixth implementation manner of the second aspect of the present invention, the first obtaining module is specifically configured to: read the file to be backed up, and obtain a plurality of file data information in the file to be backed up; The statistical algorithm separately counts the number of bytes of each file data information in the plurality of file data information to obtain a plurality of basic byte numbers; summarizes the plurality of basic byte numbers to obtain the byte data of the file to be backed up , wherein the byte data is the size of the storage space occupied by the file to be backed up.

本发明第三方面提供了一种回滚文件的备份设备,包括:存储器和至少一个处理器,所述存储器中存储有指令,所述存储器和所述至少一个处理器通过线路互连;所述至少一个处理器调用所述存储器中的所述指令,以使得所述回滚文件的备份设备执行上述的回滚文件的备份方法。A third aspect of the present invention provides a backup device for rolling back files, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected through a line; the At least one processor invokes the instructions in the memory, so that the backup device for rolling back files executes the above-mentioned backup method for rolling back files.

本发明的第四方面提供了一种计算机可读存储介质,所述计算机可用存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述的回滚文件的备份方法。A fourth aspect of the present invention provides a computer-readable storage medium, the computer-usable storage medium may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application required for at least one function Programs, etc.; the storage data area can store data created according to the use of blockchain nodes, etc. The computer-readable storage medium stores instructions, which when run on a computer, cause the computer to execute the above-mentioned backup method for rolling back files.

本发明提供的技术方案中,获取待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小;采用消息摘要算法对所述字节数据进行补充,得到初始化字节数据;利用预置缓存器对所述初始化字节数据进行循环线性计算,得到安全信息码;获取所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻;利用结合算法拼接所述时间戳与所述安全信息码,得到待备份文件名称,确定所述待备份文件名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。本发明实施例中,通过将时间戳与安全信息码结合的方式为回滚文件命名,使得回滚文件名称具有唯一性,从而提高了服务器查找回滚文件的效率。In the technical solution provided by the present invention, the byte data of the file to be backed up is obtained, wherein the byte data is the size of the storage space occupied by the file to be backed up; the byte data is supplemented by a message digest algorithm, Obtain initialization byte data; perform cyclic linear calculation on the initialization byte data by using a preset buffer to obtain a security information code; obtain the timestamp of the to-be-backed-up file, where the timestamp is used to indicate the to-be-backed-up file The time corresponding to the last modification instruction of the backup file is executed; the time stamp and the security information code are spliced together using a combination algorithm to obtain the name of the file to be backed up, and the name of the file to be backed up is determined to be the name of the file to be backed up, and the return is obtained. rollback file and save the rollback file in the rollback folder. In the embodiment of the present invention, the rollback file is named by combining the timestamp and the security information code, so that the rollback file name is unique, thereby improving the efficiency of the server to find the rollback file.

附图说明Description of drawings

图1为本发明实施例中回滚文件的备份方法的一个实施例示意图;1 is a schematic diagram of an embodiment of a backup method for rolling back files in an embodiment of the present invention;

图2为本发明实施例中回滚文件的备份方法的另一个实施例示意图;2 is a schematic diagram of another embodiment of a backup method for rolling back files in an embodiment of the present invention;

图3为本发明实施例中回滚文件的备份装置的一个实施例示意图;3 is a schematic diagram of an embodiment of a backup device for rolling back files in an embodiment of the present invention;

图4为本发明实施例中回滚文件的备份装置的另一个实施例示意图;4 is a schematic diagram of another embodiment of a backup device for rolling back files according to an embodiment of the present invention;

图5为本发明实施例中回滚文件的备份设备的一个实施例示意图。FIG. 5 is a schematic diagram of an embodiment of a backup device for rolling back files in an embodiment of the present invention.

具体实施方式Detailed ways

本发明实施例提供了一种回滚文件的备份方法、装置、设备及存储介质,通过将时间戳与安全信息码结合的方式为回滚文件命名,使得回滚文件名称具有唯一性,从而提高了服务器查找回滚文件的效率。Embodiments of the present invention provide a backup method, device, device and storage medium for rollback files. By combining a timestamp and a security information code, the rollback file is named, so that the rollback file name is unique, thereby improving the performance of the rollback file. It improves the efficiency of the server to find the rollback file.

本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if present) in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed steps or units, but may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.

为便于理解,下面对本发明实施例的具体流程进行描述,请参阅图1,本发明实施例中回滚文件的备份方法的一个实施例包括:For ease of understanding, the following describes the specific process of the embodiment of the present invention. Referring to FIG. 1, an embodiment of the backup method for rolling back files in the embodiment of the present invention includes:

101、获取待备份文件的字节数据,其中,字节数据为待备份文件所占存储空间的大小;101. Obtain byte data of the file to be backed up, where the byte data is the size of the storage space occupied by the file to be backed up;

可以理解的是,本发明的执行主体可以为回滚文件的备份装置,还可以是终端或者服务器,具体此处不做限定。本发明实施例以服务器为执行主体为例进行说明。It can be understood that the execution body of the present invention may be a backup device for rolling back files, and may also be a terminal or a server, which is not specifically limited here. The embodiments of the present invention are described by taking a server as an execution subject as an example.

服务器获取待备份文件所占存储空间大小的字节数据。The server obtains the byte data of the storage space occupied by the files to be backed up.

在对待备份文件进行命名时,必须保证待备份文件名称的唯一性,因此,服务器首先要获取待备份文件的字节数据,获取的字节数据明确指示了待备份文件所占空间大小,并利用待备份文件的字节数据计算安全信息码,最后与待备份文件的时间戳结合在一起,作为唯一的待备份文件的名称。需要强调的是,为进一步保证上述待备份文件的完整性以及安全性,上述待备份文件可以存储于一区块链中。When naming the files to be backed up, the uniqueness of the names of the files to be backed up must be guaranteed. Therefore, the server must first obtain the byte data of the files to be backed up, and the obtained byte data clearly indicates the size of the space occupied by the files to be backed up. The security information code is calculated from the byte data of the file to be backed up, and finally combined with the timestamp of the file to be backed up, as the unique name of the file to be backed up. It should be emphasized that, in order to further ensure the integrity and security of the above-mentioned files to be backed up, the above-mentioned files to be backed up can be stored in a blockchain.

102、采用消息摘要算法对字节数据进行补充,得到初始化字节数据;102. Use the message digest algorithm to supplement the byte data to obtain initialized byte data;

服务器采用消息摘要算法对字节数据进行补充,得到初始化字节数据。The server uses the message digest algorithm to supplement the byte data to obtain the initialized byte data.

在对待备份文件进行命名时,采用到了消息摘要算法,并利用消息摘要算法计算出一个与待备份文件字节数据相关的安全信息码,并将该安全信息码作为待备份文件名称的一部分。这里的消息摘要算法为MD5信息摘要算法(md5 message-digest algorithm,MD5),MD5是一种被广泛使用的密码散列函数,其可以根据输入数据产生出一个128位(16字节)的散列值,且这个散列值是唯一确定的,用于确保信息传输完整一致。When naming the file to be backed up, a message digest algorithm is used, and the message digest algorithm is used to calculate a security information code related to the byte data of the file to be backed up, and the security information code is used as a part of the name of the file to be backed up. The message digest algorithm here is MD5 message-digest algorithm (MD5). MD5 is a widely used cryptographic hash function, which can generate a 128-bit (16-byte) hash function according to the input data. Column value, and this hash value is uniquely determined to ensure complete and consistent information transmission.

进一步说明的是,安全信息码是MD5算法根据待备份文件的字节数据生成的,MD5码以512位分组来处理输入的字节数据,且每一分组又被划分为16个32位子分组,经过补位、扩展以及循环线性运算的处理后,得到由四个32位分组组成输出值,在将这四个32位分组级联后将生成一个128位散列值,得到安全信息码。It is further explained that the security information code is generated by the MD5 algorithm according to the byte data of the file to be backed up, the MD5 code processes the input byte data in 512-bit groups, and each group is divided into 16 32-bit subgroups, After the processing of complement, expansion and cyclic linear operation, the output value is obtained by four 32-bit groups. After the four 32-bit groups are concatenated, a 128-bit hash value will be generated to obtain the security information code.

103、利用预置缓存器对初始化字节数据进行循环线性计算,得到安全信息码;103. Use the preset buffer to perform cyclic linear calculation on the initialization byte data to obtain the security information code;

服务器利用预置缓存器对初始化字节数据进行循环线性计算,得到安全信息码。The server uses the preset buffer to perform circular linear calculation on the initialized byte data to obtain the security information code.

服务器待获取到待备份文件的初始化字节数据后,需要利用预置缓存器对该初始化字节数据进行循环线性计算,服务器首先初始化预置缓存器,得到四组初始输入值,然后将这四组初始输入值分别输入到预置线性函数中,得到第一计算结果,再将第一计算结果与初始化字节数据进行循环线性计算,得到另外四个计算结果,最后将得到的多个计算结果相结合,得到最终的安全信息码。After the server obtains the initialized byte data of the file to be backed up, it needs to use the preset buffer to perform cyclic linear calculation on the initialized byte data. The server first initializes the preset buffer to obtain four sets of initial input values, and then uses the four The initial input values of the group are respectively input into the preset linear functions to obtain the first calculation result, and then the first calculation result and the initialized byte data are subjected to circular linear calculation to obtain another four calculation results, and finally the obtained multiple calculation results Combined, the final security information code is obtained.

104、获取待备份文件的时间戳,其中,时间戳用于指示待备份文件执行最后一次更改指令对应的时刻;104. Obtain a timestamp of the file to be backed up, where the timestamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up;

服务器获取待备份文件用于指示待备份文件执行最后一次更改指令对应的时刻的时间戳。The server obtains the time stamp of the file to be backed up and is used to indicate the time corresponding to the last modification instruction of the file to be backed up.

可以理解的是,时间戳(timestamp)指的是一个能表示一份数据在某个特定时刻之前已经存在的、完整的、可验证的数据,通常是利用一个字符序表示唯一的某一时刻。这里的时间戳表示格式是:年月日时分秒,并且是将待备份文件执行最后一次操作的时刻作为时间戳,这里时间戳是用于指示待备份文件执行最后一次更改指令所对应的时刻,采取一个时刻作为待备份文件命名的一部分,降低待备份文件命名的重叠性,同时提高了待备份文件命名的唯一性标准。It can be understood that a timestamp refers to a complete and verifiable data that can indicate that a piece of data has existed before a certain time, usually using a character sequence to indicate a unique time. The timestamp representation format here is: year, month, day, hour, minute, second, and the time when the file to be backed up performs the last operation is used as the time stamp, where the time stamp is used to indicate the time corresponding to the last change instruction of the file to be backed up. Taking a moment as a part of the naming of the files to be backed up reduces the overlapping of the names of the files to be backed up, and at the same time improves the uniqueness of the naming of the files to be backed up.

105、利用结合算法拼接时间戳与安全信息码,得到待备份文件名称,确定待备份文件名称为待备份文件的命名,得到回滚文件,并将回滚文件保存到回滚文件夹中。105. Use a combination algorithm to splice the timestamp and the security information code to obtain the name of the file to be backed up, determine that the name of the file to be backed up is the name of the file to be backed up, obtain the rollback file, and save the rollback file in the rollback folder.

服务器利用结合算法拼接时间戳与安全信息码,得到待备份文件名称,确定待备份文件名称为待备份文件的命名,得到回滚文件,并将回滚文件保存到回滚文件夹中。The server uses a combination algorithm to splice the timestamp and the security information code to obtain the name of the file to be backed up, determines that the name of the file to be backed up is the name of the file to be backed up, obtains the rollback file, and saves the rollback file to the rollback folder.

需要说明的是,服务器待计算待备份文件的时间戳与安全信息码之后,利用结合算法将时间戳与安全信息码相结合,就得到了唯一的待备份文件的名称。结合算法是按照时间戳在前,安全信息码在后的排列顺序将时间戳与安全信息码拼接在一起的算法,之后服务器将拼接后的时间戳与安全信息码确定为待备份文件名称。在进行待备份文件名称的查询时,先进行时间戳的查询,之后再确定唯一的安全信息码,这样就能够准确的查询到待备份文件。It should be noted that, after the server calculates the time stamp and the security information code of the file to be backed up, the server combines the time stamp and the security information code with a combination algorithm to obtain a unique name of the file to be backed up. The combination algorithm is an algorithm that splices the timestamp and the security information code together according to the sequence of the timestamp first and the security information code last, and then the server determines the spliced timestamp and the security information code as the name of the file to be backed up. When querying the name of the file to be backed up, first query the timestamp, and then determine the unique security information code, so that the file to be backed up can be accurately queried.

本发明实施例中,通过将时间戳与安全信息码结合的方式为回滚文件命名,使得回滚文件名称具有唯一性,从而提高了服务器查找回滚文件的效率。In the embodiment of the present invention, the rollback file is named by combining the timestamp and the security information code, so that the rollback file name is unique, thereby improving the efficiency of the server to find the rollback file.

请参阅图2,本发明实施例中回滚文件的备份方法的另一个实施例包括:Referring to FIG. 2, another embodiment of the backup method for rolling back files in the embodiment of the present invention includes:

201、获取待备份文件的字节数据,其中,字节数据为待备份文件所占存储空间的大小;201. Obtain byte data of the file to be backed up, where the byte data is the size of the storage space occupied by the file to be backed up;

服务器获取待备份文件所占存储空间大小的字节数据。具体的:The server obtains the byte data of the storage space occupied by the files to be backed up. specific:

首先服务器读取待备份文件,并获取待备份文件中的多个文件数据信息;然后服务器根据统计算法分别统计多个文件数据信息中每个文件数据信息的字节数,得到多个基本字节数;最后服务器汇总多个基本字节数,得到用于指示待备份文件所占存储空间的大小的字节数据。First, the server reads the file to be backed up, and obtains multiple file data information in the to-be-backed up file; then the server counts the number of bytes of each file data information in the multiple file data information according to a statistical algorithm, and obtains multiple basic bytes Finally, the server aggregates multiple basic byte numbers to obtain byte data used to indicate the size of the storage space occupied by the files to be backed up.

在对待备份文件进行命名时,必须保证待备份文件名称的唯一性,因此,服务器首先要获取待备份文件的字节数据,获取的字节数据明确指示了待备份文件所占空间大小,并利用待备份文件的字节数据计算安全信息码,最后与待备份文件的时间戳结合在一起,作为唯一的待备份文件的名称。需要强调的是,为进一步保证上述待备份文件的完整性以及安全性,上述待备份文件可以存储于一区块链中。When naming the files to be backed up, the uniqueness of the names of the files to be backed up must be guaranteed. Therefore, the server must first obtain the byte data of the files to be backed up, and the obtained byte data clearly indicates the size of the space occupied by the files to be backed up. The security information code is calculated from the byte data of the file to be backed up, and finally combined with the timestamp of the file to be backed up, as the unique name of the file to be backed up. It should be emphasized that, in order to further ensure the integrity and security of the above-mentioned files to be backed up, the above-mentioned files to be backed up can be stored in a blockchain.

在获取待备份文件的字节数据时,首先服务器读取待备份文件,查询并获取待备份文件内的多个文件数据信息,待备份文件中存储有至少一个文件数据信息,这里的文件数据信息指的存储在待备份文件中的文件内容,然后服务器根据统计算法分别统计多个文件数据信息中的字节数,并得到多个基本字节数,这里的字节数指的是文件数据信息中内容所占的字节数,统计算法为文件内容中的一个英文字母、数字和英文格式下的标点是1字节,一个汉字和中文标点是2字节,利用统计算法即可计算出文件数据信息中内容所占的字节数,服务器在得到多个基本字节数之后,对个基本字节数进行汇总,也就是将所有的基本字节数进行加和,得到待备份文件的字节数据,一般情况下,统计算法能够实现计算文件数据信息内容所占字节数的效果,统计算法是本技术领域中的惯用手段,在本申请中并不对其进行赘述。When obtaining the byte data of the file to be backed up, the server first reads the file to be backed up, queries and obtains multiple file data information in the file to be backed up, and the file to be backed up stores at least one file data information, where the file data information Refers to the file content stored in the file to be backed up, and then the server counts the number of bytes in the data information of multiple files according to the statistical algorithm, and obtains multiple basic bytes, where the number of bytes refers to the file data information The number of bytes occupied by the content in the file. The statistical algorithm is that an English letter, number and punctuation in English format in the file content is 1 byte, and a Chinese character and Chinese punctuation are 2 bytes. The statistical algorithm can be used to calculate the file. The number of bytes occupied by the content in the data information. After the server obtains multiple basic bytes, it summarizes the basic bytes, that is, adds all the basic bytes to get the word of the file to be backed up. Section data, in general, a statistical algorithm can achieve the effect of calculating the number of bytes occupied by the information content of the file data. The statistical algorithm is a common method in the technical field and will not be described in detail in this application.

202、采用消息摘要算法对字节数据进行补充,得到初始化字节数据;202. Use a message digest algorithm to supplement the byte data to obtain initialized byte data;

服务器采用消息摘要算法对字节数据进行补充,得到初始化字节数据。具体的:The server uses the message digest algorithm to supplement the byte data to obtain the initialized byte data. specific:

服务器首先采用消息摘要算法判断字节数据的长度是否等于预置字节长度;若字节数据的长度小于预置字节长度,则服务器补充字节数据的长度,直到字节数据的长度达到预置字节长度,得到待补充字节数据;若字节数据的长度等于预置字节长度,则服务器将字节数据确定为待补充字节数据;最后服务器在待补充字节数据的最后一位后添加用于记录字节数据的长度扩展数据,得到初始化字节数据。The server first uses the message digest algorithm to determine whether the length of the byte data is equal to the preset byte length; if the length of the byte data is less than the preset byte length, the server supplements the length of the byte data until the length of the byte data reaches the preset length. Set the byte length to get the byte data to be supplemented; if the length of the byte data is equal to the preset byte length, the server determines the byte data as the byte data to be supplemented; finally, the server determines the byte data to be supplemented in the last byte of the byte data to be supplemented. Length extension data for recording byte data is added after the bit to obtain initialized byte data.

若字节数据的长度小于预置字节长度,则服务器补充字节数据的长度,直到字节数据的长度达到预置字节长度,得到补充字节数据。具体的:若字节数据的长度小于预置字节长度,则服务器根据预置公式计算需要补充字节数据的长度n,预置公式为:(n+m)mod512=448,其中,m为字节数据的长度,n为需要补充字节数据的长度,n、m均为正整数;服务器在字节数据后补充长度为n的补充字节,得到待补充字节数据。If the length of the byte data is less than the preset byte length, the server supplements the length of the byte data until the length of the byte data reaches the preset byte length to obtain supplementary byte data. Specifically: if the length of the byte data is less than the preset byte length, the server calculates the length n of the byte data to be supplemented according to the preset formula. The preset formula is: (n+m)mod512=448, where m is The length of the byte data, n is the length of the byte data to be supplemented, and both n and m are positive integers; the server supplements the byte data with supplementary bytes of length n to obtain the byte data to be supplemented.

在对待备份文件进行命名时,采用到了消息摘要算法,并利用消息摘要算法计算出一个与待备份文件字节数据相关的安全信息码,并将该安全信息码作为待备份文件名称的一部分。这里的消息摘要算法为MD5信息摘要算法(md5 message-digest algorithm,MD5),MD5是一种被广泛使用的密码散列函数,其可以根据输入数据产生出一个128位(16字节)的散列值,且这个散列值是唯一确定的,用于确保信息传输完整一致。When naming the file to be backed up, a message digest algorithm is used, and the message digest algorithm is used to calculate a security information code related to the byte data of the file to be backed up, and the security information code is used as a part of the name of the file to be backed up. The message digest algorithm here is MD5 message-digest algorithm (MD5). MD5 is a widely used cryptographic hash function, which can generate a 128-bit (16-byte) hash function according to the input data. Column value, and this hash value is uniquely determined to ensure complete and consistent information transmission.

进一步说明的是,若存在两个MD5信息码相同的待备份文件,说明这两个待备份文件完全相同,待备份文件中只要有一处不同,则对应产生的MD5码就完全不同,例如:待备份文件A中的文件内容比待备份文件B中的文件内容多出一个空格,两个待备份文件所产生的MD5均不同。It is further explained that if there are two files to be backed up with the same MD5 information code, it means that the two files to be backed up are exactly the same. As long as there is one difference in the files to be backed up, the corresponding generated MD5 codes are completely different, for example: to be backed up The file content in the backup file A has one more space than the file content in the to-be-backed-up file B, and the MD5 generated by the two to-be-backed up files are different.

利用MD5算法计算安全信息码时,服务器首先需要判断待备份文件的字节数据长度是否等于预置字节长度,若待备份文件字节数据的长度等于预置字节长度,服务器可以直接进行下一步的计算,若待备份文件字节数据的长度小于预置字节长度,服务器需要对字节数据进行补充。需要说明的是,这里的预置字节长度要远大于待备份文件的字节数据长度,因此,并不会出现待备份文件的字节数据长度大于预置字节长度的情况。When using the MD5 algorithm to calculate the security information code, the server first needs to determine whether the byte data length of the file to be backed up is equal to the preset byte length. If the byte data length of the to-be-backed file is equal to the preset byte length, the server can directly download One-step calculation, if the length of the byte data of the file to be backed up is less than the preset byte length, the server needs to supplement the byte data. It should be noted that the length of the preset byte here is much larger than the length of the byte data of the file to be backed up. Therefore, there is no situation where the length of the byte data of the file to be backed up is greater than the length of the preset byte.

服务器对字节数据进行补充的过程中,首先根据预置公式计算需要补充字节数据的长度n,也就是对字节数据按位补充,其中,利用到的预置公式为:(n+m)mod512=448,在式中:m为字节数据的长度,n为需要补充字节数据的长度,且n、m均为正整数,上述公式说明补充过后的字节数据需要满足最终的字节数据的位数对512求模的结果为448这一条件,也就是说字节数据补充后,其位数长度只差64位(bit)就是512的整数倍,即便字节数据的位数对512求模的结果正好是448也必须进行补位。字节数据在进行补充字节数位时,服务器首先在字节数据后补一个数字1,然后在其后补充n-1个数字0,直到整个补充字节数据的位数对512求模的结果正好为448,其中补充的字节数位至少为1位,而最多可为512位。In the process of supplementing the byte data, the server first calculates the length n of the byte data that needs to be supplemented according to the preset formula, that is, the byte data is supplemented bit by bit. The preset formula used is: (n+m )mod512=448, in the formula: m is the length of the byte data, n is the length of the byte data that needs to be supplemented, and n, m are both positive integers, the above formula shows that the supplemented byte data needs to meet the final word. The condition that the number of bits of the section data is modulo 512 is 448, that is to say, after the byte data is supplemented, the length of its bits is only 64 bits (bit), which is an integer multiple of 512, even if the number of bytes of the byte data is an integer multiple of 512. The result of modulo 512 is that 448 must also be complemented. When the byte data is supplemented with byte digits, the server first adds a number 1 after the byte data, and then adds n-1 numbers 0 after it, until the number of bits of the entire supplementary byte data is modulo 512. Exactly 448, with at least 1 supplementary byte and a maximum of 512 bits.

服务器在完成补充字节数据位数的操作后,需将一个表示数据原始长度的64bit数据补在最后,这64bit数据是利用二进制描述补充字节数据没有补位前的长度,当完成补充及扩展数据的描述后,得到初始化字节数据的长度是512的整数倍,然后服务器对初始化字节数据进行循环线性计算,得到安全信息码。进一步说明的是,若字节数据的长度满足预置字节长度,服务器也需要对字节数据进行补充,将标识数据原始长度的64bit数据补充在字节数据之后即可,得到初始化字节数据。After the server completes the operation of supplementing the number of bytes of data, it needs to supplement a 64-bit data representing the original length of the data. After the description of the data, it is obtained that the length of the initialized byte data is an integer multiple of 512, and then the server performs cyclic linear calculation on the initialized byte data to obtain the security information code. It is further explained that if the length of the byte data meets the preset byte length, the server also needs to supplement the byte data, and the 64-bit data that identifies the original length of the data can be supplemented after the byte data to obtain the initialized byte data. .

203、利用预置缓存器对初始化字节数据进行循环线性计算,得到安全信息码;203. Use the preset buffer to perform cyclic linear calculation on the initialization byte data to obtain a security information code;

服务器利用预置缓存器对初始化字节数据进行循环线性计算,得到安全信息码。具体的:The server uses the preset buffer to perform circular linear calculation on the initialized byte data to obtain the security information code. specific:

服务器首先初始化预置缓存器,得到初始输入值,并将初始输入值输入到预置线性函数中,得到第一计算结果;其次服务器将初始化字节数据平均分成四组,分别得到第一分组字节数据、第二分组字节数据、第三分组字节数据和第四分组字节数据;然后服务器将第一计算结果与第一分组字节数据相加后输入到预置线性函数中,得到第二计算结果;服务器将第二计算结果与第二分组字节数据相加后输入到预置线性函数中,得到第三计算结果;服务器将第三计算结果与第三分组字节数据相加后输入到预置线性函数中,得到第四计算结果;服务器再将第四计算结果与第四分组字节数据相加后输入到预置线性函数中,得到第五计算结果;最后服务器将第二计算结果、第三计算结果、第四计算结果和第五计算结果合并,得到安全信息码。The server first initializes the preset buffer to obtain the initial input value, and inputs the initial input value into the preset linear function to obtain the first calculation result; secondly, the server divides the initialization byte data into four groups on average to obtain the first grouping word respectively. byte data, the second packet byte data, the third packet byte data, and the fourth packet byte data; then the server adds the first calculation result and the first packet byte data and inputs it into the preset linear function to obtain The second calculation result; the server adds the second calculation result and the second grouped byte data and inputs it into the preset linear function to obtain the third calculation result; the server adds the third calculation result and the third grouped byte data Then input it into the preset linear function to obtain the fourth calculation result; the server adds the fourth calculation result and the fourth packet byte data and inputs it into the preset linear function to obtain the fifth calculation result; The second calculation result, the third calculation result, the fourth calculation result and the fifth calculation result are combined to obtain the security information code.

服务器待获取到待备份文件的初始化字节数据后,需要利用预置缓存器对该初始化字节数据进行循环线性计算,服务器首先初始化预置缓存器,得到四组初始输入值,然后将这四组初始输入值分别输入到预置线性函数中,得到第一计算结果,再将第一计算结果与初始化字节数据进行循环线性计算,最后将得到的多个计算结果相结合,得到最终的安全信息码。After the server obtains the initialized byte data of the file to be backed up, it needs to use the preset buffer to perform cyclic linear calculation on the initialized byte data. The server first initializes the preset buffer to obtain four sets of initial input values, and then uses the four The initial input values of the group are respectively input into the preset linear functions to obtain the first calculation result, and then the first calculation result and the initialized byte data are subjected to cyclic linear calculation, and finally the multiple calculation results obtained are combined to obtain the final security. information code.

服务器在进行循环线性计算时,服务器首先初始化预置缓存器,得到四组初始输入值,分别为A:01 23 45 67;B:89ab cd ef;C:fe dc ba 98;D:76 54 32 10。然后服务器将四组初始输入值分别输入到预置线性函数中,这里的运算是对初始值以512位数据段为单位进行处理的,经过处理后服务器得到第一计算结果。服务器得到第一计算结果后,将初始化字节数据平均分为四组,分别得到第一分组字节数据、第二分组字节数据、第三分组字节数据和第四分组字节数据,服务器将第一计算结果与第一分组字节数据相加后输入到预置线性函数中,得到第二计算结果,服务器将第二计算结果与第二分组字节数据相加后输入到预置线性函数中,得到第三计算结果,服务器将第三计算结果与第三分组字节数据相加后输入到预置线性函数中,得到第四计算结果,服务器将第四计算结果与第四分组字节数据相加后输入到预置线性函数中,得到第五计算结果,在进行四轮线性处理后,服务器将得到的第二计算结果、第三计算结果、第四计算结果和第五计算结果合并,得到最终的安全信息码。When the server performs circular linear calculation, the server first initializes the preset buffer, and obtains four sets of initial input values, which are A: 01 23 45 67; B: 89ab cd ef; C: fe dc ba 98; D: 76 54 32 10. Then the server inputs the four groups of initial input values into the preset linear function respectively. The operation here is to process the initial values in units of 512-bit data segments. After processing, the server obtains the first calculation result. After obtaining the first calculation result, the server divides the initialization byte data into four groups equally, and obtains the first group byte data, the second group byte data, the third group byte data and the fourth group byte data respectively. Add the first calculation result and the first grouped byte data and input it into the preset linear function to obtain the second calculation result. The server adds the second calculation result and the second grouped byte data and then inputs it into the preset linear function. In the function, the third calculation result is obtained, the server adds the third calculation result and the third grouped byte data and inputs it into the preset linear function to obtain the fourth calculation result, and the server combines the fourth calculation result with the fourth grouped word. After adding the section data and inputting it into the preset linear function, the fifth calculation result is obtained. After four rounds of linear processing, the server will obtain the second calculation result, the third calculation result, the fourth calculation result and the fifth calculation result. Merge to get the final security information code.

204、获取待备份文件的时间戳,其中,时间戳用于指示待备份文件执行最后一次更改指令对应的时刻;204. Obtain a timestamp of the file to be backed up, where the timestamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up;

服务器获取待备份文件用于指示待备份文件执行最后一次更改指令对应的时刻的时间戳。具体的:The server obtains the time stamp of the file to be backed up and is used to indicate the time corresponding to the last modification instruction of the file to be backed up. specific:

服务器首先分别提取待备份文件的末次时刻以及当前时刻,其中,末次时刻包括末次访问时刻、末次修改时刻、末次更改时刻;其次服务器分别计算末次访问时刻与当前时刻之间的第一时间间隔、末次修改时刻与当前时刻之间的第二时间间隔以及末次更改时刻分别与当前时刻之间的第三时间间隔;最后服务器在第一时间间隔、第二时间间隔与第三时间间隔中筛选时间间隔数值最小的目标时间间隔,将目标时间间隔对应的末次时刻确定为待备份文件的时间戳,其中,时间戳用于指示待备份文件执行最后一次更改指令对应的时刻。The server first extracts the last time and the current time of the file to be backed up, where the last time includes the last access time, the last modification time, and the last modification time; secondly, the server calculates the first time interval between the last access time and the current time, the last time The second time interval between the modification time and the current time and the third time interval between the last modification time and the current time respectively; finally, the server filters the time interval values in the first time interval, the second time interval and the third time interval For the minimum target time interval, the last time corresponding to the target time interval is determined as the time stamp of the file to be backed up, where the time stamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up executed.

可以理解的是,时间戳(timestamp)指的是一个能表示一份数据在某个特定时刻之前已经存在的、完整的、可验证的数据,通常是利用一个字符序表示唯一的某一时刻。这里的时间戳表示格式是:年月日时分秒,并且是将待备份文件执行最后一次操作的时刻作为时间戳,这里时间戳是用于指示待备份文件执行最后一次更改指令所对应的时刻,采取一个时刻作为待备份文件命名的一部分,降低待备份文件命名的重叠性,同时提高了待备份文件命名的唯一性标准。It can be understood that a timestamp refers to a complete and verifiable data that can indicate that a piece of data has existed before a certain time, usually using a character sequence to indicate a unique time. The timestamp representation format here is: year, month, day, hour, minute, second, and the time when the file to be backed up performs the last operation is used as the time stamp, where the time stamp is used to indicate the time corresponding to the last change instruction of the file to be backed up. Taking a moment as a part of the naming of the files to be backed up reduces the overlapping of the names of the files to be backed up, and at the same time improves the uniqueness of the naming of the files to be backed up.

需要说明的是,这里服务器对待备份文件执行最后一次操作可能为:存取、修改或更改,所对应的时刻分别为末次访问时刻、末次修改时刻、末次更改时刻。末次访问时刻用于指示待备份文件最后一次被存取的时刻,这里指的是读取待备份文件中的内容,并不包括读取待备份文件节点上的内容;末次修改时刻用于指示待备份文件最后一次被修改的时刻,这里的修改指的是待备份文件中的内容被服务器修改;末次更改时刻用于指示待备份文件最后一次被修改的时刻,这里的修改指的是待备份文件的性质被服务器修改,如:待备份文件的所属者或权限被修改。服务器获取执行这些指令的最后一次操作,并将这些末次操作时刻与当前时刻进行比对,筛选出与当前时刻之间时间间隔最短的末次操作时刻作为待备份文件的时间戳。It should be noted that the last operation performed by the server on the backup file may be: access, modification or change, and the corresponding times are the last access time, the last modification time, and the last modification time. The last access time is used to indicate the time when the file to be backed up is last accessed. This refers to reading the content of the file to be backed up, but does not include reading the content on the node of the file to be backed up; the last modification time is used to indicate the time to be backed up. The time when the backup file was last modified, the modification here refers to the content of the file to be backed up being modified by the server; the last modification time is used to indicate the time when the file to be backed up was last modified, and the modification here refers to the file to be backed up The nature of the file is modified by the server, for example, the owner or authority of the file to be backed up is modified. The server obtains the last operation of executing these instructions, compares the last operation time with the current time, and selects the last operation time with the shortest time interval from the current time as the timestamp of the file to be backed up.

举例说明,服务器在待备份文件中的多个末次操作时刻,得到末次访问时刻为2019年05月06日12时24分30秒,得到末次修改时刻为2019年05月06日12时25分30秒,得到末次更改时刻为2019年05月06日12时26分30秒,获取到当前时刻为2019年05月06日12时28分30秒,根据不同的时刻信息,可以得出当前时刻与末次访问时刻之间的第一时间间隔为4分钟,当前时刻与末次修改时刻之间的第二时间间隔为3分钟,当前时刻与末次更改时刻之间的第三时间间隔为2分钟,因此选择末次更改时刻的数据作为该待备份文件的时间戳,时间戳的格式为20190506122630。For example, the server obtains the last access time at 12:24:30 on May 06, 2019, and the last modification time is at 12:25:30 on May 6, 2019 for the last operation time in the file to be backed up. Second, the last change time is 12:26:30 on May 06, 2019, and the current time is 12:28:30 on May 06, 2019. According to different time information, the current time and The first time interval between the last access time is 4 minutes, the second time interval between the current time and the last modification time is 3 minutes, and the third time interval between the current time and the last modification time is 2 minutes, so choose The data at the last change time is used as the timestamp of the file to be backed up, and the format of the timestamp is 20190506122630.

205、采用结合算法分别提取待备份文件的时间戳与安全信息码;205. Use a combination algorithm to extract the timestamp and the security information code of the file to be backed up respectively;

服务器采用结合算法分别提取待备份文件的时间戳与安全信息码。The server uses a combination algorithm to extract the time stamp and security information code of the files to be backed up respectively.

需要说明的是,服务器通过计算得到待备份文件的时间戳与安全信息码之后,需要将时间戳与安全信息码相结合,使其得到唯一的待备份文件的名称。在利用结合算法拼接时间戳与安全信息码之前,首先需要获取到待备份文件的时间戳与安全信息码。It should be noted that, after the server obtains the time stamp and the security information code of the file to be backed up by calculation, the server needs to combine the time stamp and the security information code to obtain a unique name of the file to be backed up. Before using the combined algorithm to splicing the time stamp and the security information code, it is first necessary to obtain the time stamp and security information code of the file to be backed up.

206、利用预置连接符将安全信息码拼接在时间戳之后,得到待备份文件名称,确定待备份文件名称为待备份文件的命名,得到回滚文件,并将回滚文件保存到回滚文件夹中。206. Use the preset connector to splice the security information code after the time stamp, obtain the name of the file to be backed up, determine that the name of the file to be backed up is the name of the file to be backed up, obtain the rollback file, and save the rollback file to the rollback file in the folder.

服务器利用预置连接符将安全信息码拼接在时间戳之后,得到待备份文件名称,确定待备份文件名称为待备份文件的命名,得到回滚文件,并将回滚文件保存到回滚文件夹中。The server uses the preset connector to splicing the security information code after the timestamp, obtains the name of the file to be backed up, determines that the name of the file to be backed up is the name of the file to be backed up, obtains the rollback file, and saves the rollback file to the rollback folder middle.

可以理解的是,结合算法是按照时间戳在前,安全信息码在后的排列顺序将时间戳与安全信息码拼接在一起的算法,之后服务器将拼接后的时间戳与安全信息码确定为待备份文件名称。在进行待备份文件名称的查询时,先进行时间戳的查询,之后再确定唯一的安全信息码,这样就能够准确的查询到待备份文件。需要说明的是,为了更好的区分时间戳与安全信息码,在拼接时间戳与安全信息码时,需要在两者之间加入一个预置连接符,在本申请中的预置连接符为“_”,这样生成的待备份文件名称更直观更具有辨识度。It can be understood that the combination algorithm is an algorithm that splices the timestamp and the security information code together according to the order of the timestamp and the security information code, and then the server determines the spliced timestamp and the security information code as pending. Backup file name. When querying the name of the file to be backed up, first query the timestamp, and then determine the unique security information code, so that the file to be backed up can be accurately queried. It should be noted that, in order to better distinguish the time stamp and the security information code, when splicing the time stamp and the security information code, a preset connector needs to be added between the two, and the preset connector in this application is "_", the name of the file to be backed up generated in this way is more intuitive and more recognizable.

例如:服务器计算得到的时间戳为:20190910180245,安全信息码为:3b4ea74b42c390e3dd526ef0c488364e,则最终得到的待备份文件名称为:20190910180245_3b4ea74b42c390e3dd526ef0c488364e。For example, the timestamp calculated by the server is: 20190910180245, and the security information code is: 3b4ea74b42c390e3dd526ef0c488364e, then the final name of the file to be backed up is: 20190910180245_3b4ea74b42c390e3dd526ef0c488364e.

进一步说明的是,回滚是指当程序或数据出错时,将程序或数据恢复到最近一个正确版本的行为。在回滚的过程中就要明确具体回滚到哪一个正确的版本,一般的,回滚版本的查询是通过文件名称进行筛查的,唯一的文件名对应唯一的版本,这样在执行回滚的过程中,就不会出现回滚版本错误,回滚失败的现象。若服务器在灰度发布后的测试中遇到了问题,需要执行文件回滚操作,则服务器首先获取到所需的文件回滚请求,这里的文件回滚请求用于指示服务器需要具体回滚到某一个待备份文件,其内容为明确指出需要回滚到某个待备份文件的名称,待服务器查询到与回滚文件请求对应的待备份文件后,服务器将待备份文件分别传输到部署单元下每一台服务器上,以覆盖原有的文件,实现待备份文件回滚替换,完成服务器发布的文件回滚指令。To further illustrate, rollback refers to the act of restoring a program or data to the last correct version when an error occurs in the program or data. During the rollback process, it is necessary to specify which correct version to roll back to. Generally, the query of the rollback version is screened by the file name, and the unique file name corresponds to the unique version, so that the rollback is executed. During the process, there will be no rollback version errors and rollback failures. If the server encounters a problem in the test after the grayscale release and needs to perform a file rollback operation, the server first obtains the required file rollback request. The file rollback request here is used to indicate that the server needs to roll back to a specific file. A to-be-backed-up file whose content is a name that clearly indicates that the file to be backed up needs to be rolled back. After the server queries the to-be-backed up file corresponding to the rollback file request, the server transfers the to-be-backed up file to each file under the deployment unit. On one server, overwrite the original file, realize the rollback and replacement of the file to be backed up, and complete the file rollback instruction issued by the server.

本发明实施例中,通过将时间戳与安全信息码结合的方式为回滚文件命名,使得回滚文件名称具有唯一性,从而提高了服务器查找回滚文件的效率。In the embodiment of the present invention, the rollback file is named by combining the timestamp and the security information code, so that the rollback file name is unique, thereby improving the efficiency of the server to find the rollback file.

上面对本发明实施例中回滚文件的备份方法进行了描述,下面对本发明实施例中回滚文件的备份装置进行描述,请参阅图3,本发明实施例中回滚文件的备份装置一个实施例包括:The backup method for rolling back files in the embodiment of the present invention has been described above. The following describes the backup device for rolling back files in the embodiment of the present invention. Please refer to FIG. 3 , an embodiment of the backup device for rolling back files in the embodiment of the present invention. include:

第一获取模块301,用于获取待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小;The first obtaining module 301 is used to obtain the byte data of the file to be backed up, wherein the byte data is the size of the storage space occupied by the file to be backed up;

补充模块302,用于采用消息摘要算法对所述字节数据进行补充,得到初始化字节数据;A supplementary module 302, configured to supplement the byte data by using a message digest algorithm to obtain initialized byte data;

计算模块303,用于利用预置缓存器对所述初始化字节数据进行循环线性计算,得到安全信息码;The calculation module 303 is used to perform circular linear calculation on the initialization byte data by using a preset buffer to obtain a security information code;

第二获取模块304,用于获取所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻;The second obtaining module 304 is configured to obtain the timestamp of the file to be backed up, wherein the timestamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up;

确定与保存模块305,用于利用结合算法拼接所述时间戳与所述安全信息码,得到待备份文件名称,确定所述待备份文件的名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。The determining and saving module 305 is used for splicing the time stamp and the security information code using a combination algorithm to obtain the name of the file to be backed up, determining the name of the file to be backed up as the name of the file to be backed up, and obtaining the rollback file , and save the rollback file to the rollback folder.

本发明实施例中,通过将时间戳与安全信息码结合的方式为回滚文件命名,使得回滚文件名称具有唯一性,从而提高了服务器查找回滚文件的效率。In the embodiment of the present invention, the rollback file is named by combining the timestamp and the security information code, so that the rollback file name is unique, thereby improving the efficiency of the server to find the rollback file.

请参阅图4,本发明实施例中回滚文件的备份装置的另一个实施例包括:Referring to FIG. 4 , another embodiment of the backup apparatus for rolling back files according to the embodiment of the present invention includes:

第一获取模块301,用于获取待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小;The first obtaining module 301 is used to obtain the byte data of the file to be backed up, wherein the byte data is the size of the storage space occupied by the file to be backed up;

补充模块302,用于采用消息摘要算法对所述字节数据进行补充,得到初始化字节数据;A supplementary module 302, configured to supplement the byte data by using a message digest algorithm to obtain initialized byte data;

计算模块303,用于利用预置缓存器对所述初始化字节数据进行循环线性计算,得到安全信息码;The calculation module 303 is used to perform circular linear calculation on the initialization byte data by using a preset buffer to obtain a security information code;

第二获取模块304,用于获取所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻;The second obtaining module 304 is configured to obtain the timestamp of the file to be backed up, wherein the timestamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up;

确定与保存模块305,用于利用结合算法拼接所述时间戳与所述安全信息码,得到待备份文件名称,确定所述待备份文件的名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。The determining and saving module 305 is used for splicing the time stamp and the security information code using a combination algorithm to obtain the name of the file to be backed up, determining the name of the file to be backed up as the name of the file to be backed up, and obtaining the rollback file , and save the rollback file to the rollback folder.

可选的,补充模块302包括:Optionally, the supplementary module 302 includes:

判断单元3021,用于采用消息摘要算法判断所述字节数据的长度是否等于预置字节长度;Judging unit 3021, for using message digest algorithm to judge whether the length of the byte data is equal to the preset byte length;

第一确定单元3022,若所述字节数据的长度小于所述预置字节长度,则用于补充所述字节数据的长度,直到所述字节数据的长度达到所述预置字节长度,得到待补充字节数据;The first determining unit 3022 is used to supplement the length of the byte data if the length of the byte data is less than the preset byte length until the length of the byte data reaches the preset byte length, get the byte data to be supplemented;

第二确定单元3023,若所述字节数据的长度等于所述预置字节长度,则用于将所述字节数据确定为待补充字节数据;The second determination unit 3023, if the length of the byte data is equal to the preset byte length, is used to determine the byte data as the byte data to be supplemented;

添加单元3024,用于在所述待补充字节数据的最后一位后添加扩展数据,得到初始化字节数据,其中,所述扩展数据为记录所述字节数据的长度的数据。The adding unit 3024 is configured to add extended data after the last bit of the byte data to be supplemented to obtain initialized byte data, where the extended data is data recording the length of the byte data.

可选的,第一确定单元3022还可以具体用于:Optionally, the first determining unit 3022 may also be specifically used for:

若所述字节数据的长度小于所述预置字节长度,则根据预置公式计算需要补充字节数据的长度n,所述预置公式为:(n+m)mod512=448,其中,m为字节数据的长度,n为需要补充字节数据的长度,n、m均为正整数;If the length of the byte data is less than the preset byte length, the length n of the byte data to be supplemented is calculated according to the preset formula, and the preset formula is: (n+m)mod512=448, wherein, m is the length of the byte data, n is the length of the byte data to be supplemented, and both n and m are positive integers;

在所述字节数据后补充长度为n的补充字节,得到待补充字节数据。A supplementary byte of length n is supplemented after the byte data to obtain the byte data to be supplemented.

可选的,计算模块303还可以具体用于:Optionally, the computing module 303 can also be specifically used for:

初始化所述预置缓存器,得到初始输入值,并将所述初始输入值输入到预置线性函数中,得到第一计算结果;Initializing the preset buffer to obtain an initial input value, and inputting the initial input value into a preset linear function to obtain a first calculation result;

将所述初始化字节数据平均分成四组,分别得到第一分组字节数据、第二分组字节数据、第三分组字节数据和第四分组字节数据;The initialization byte data is evenly divided into four groups, and the first grouped byte data, the second grouped byte data, the third grouped byte data and the fourth grouped byte data are obtained respectively;

将所述第一计算结果与所述第一分组字节数据相加后输入到所述预置线性函数中,得到第二计算结果;adding the first calculation result to the first grouped byte data and inputting it into the preset linear function to obtain a second calculation result;

将所述第二计算结果与所述第二分组字节数据相加后输入到所述预置线性函数中,得到第三计算结果;adding the second calculation result and the second packet byte data and inputting it into the preset linear function to obtain a third calculation result;

将所述第三计算结果与所述第三分组字节数据相加后输入到所述预置线性函数中,得到第四计算结果;adding the third calculation result to the third packet byte data and inputting it into the preset linear function to obtain a fourth calculation result;

将所述第四计算结果与所述第四分组字节数据相加后输入到所述预置线性函数中,得到第五计算结果;The fourth calculation result is added to the fourth packet byte data and then input into the preset linear function to obtain the fifth calculation result;

将所述第二计算结果、所述第三计算结果、所述第四计算结果和所述第五计算结果合并,得到安全信息码。The second calculation result, the third calculation result, the fourth calculation result and the fifth calculation result are combined to obtain a security information code.

可选的,第二获取模块304还可以具体用于:Optionally, the second obtaining module 304 may also be specifically used for:

分别提取所述待备份文件的末次时刻以及当前时刻,其中,所述末次时刻包括末次访问时刻、末次修改时刻、末次更改时刻;Extracting the last time and the current time of the file to be backed up respectively, wherein the last time includes the last access time, the last modification time, and the last modification time;

分别计算所述末次访问时刻与所述当前时刻之间的第一时间间隔、所述末次修改时刻与所述当前时刻之间的第二时间间隔以及所述末次更改时刻分别与所述当前时刻之间的第三时间间隔;Calculate the first time interval between the last access time and the current time, the second time interval between the last modification time and the current time, and the difference between the last modification time and the current time, respectively. the third time interval between;

在所述第一时间间隔、所述第二时间间隔与所述第三时间间隔中筛选时间间隔数值最小的目标时间间隔,将所述目标时间间隔对应的末次时刻确定为所述待备份文件的时间戳,其中,所述时间戳用于指示所述待备份文件执行最后一次更改指令对应的时刻。The target time interval with the smallest time interval value among the first time interval, the second time interval and the third time interval is screened, and the last time corresponding to the target time interval is determined as the time interval of the file to be backed up. Timestamp, wherein the timestamp is used to indicate the time corresponding to the last modification instruction of the file to be backed up.

可选的,确定与保存模块305还可以具体用于:Optionally, the determining and saving module 305 can also be specifically used for:

采用结合算法分别提取待备份文件的时间戳与安全信息码;The time stamp and security information code of the file to be backed up are extracted by a combined algorithm;

利用预置连接符将所述安全信息码拼接在所述时间戳之后,得到待备份文件名称,确定所述待备份文件名称为所述待备份文件的命名,得到回滚文件,并将所述回滚文件保存到回滚文件夹中。The security information code is spliced after the timestamp by using a preset connector to obtain the name of the file to be backed up, determine that the name of the file to be backed up is the name of the file to be backed up, obtain a rollback file, and store the file to be backed up. The rollback file is saved to the rollback folder.

可选的,第一获取模块301还可以具体用于:Optionally, the first obtaining module 301 may also be specifically used for:

读取待备份文件,并获取所述待备份文件中的多个文件数据信息;Read the file to be backed up, and obtain a plurality of file data information in the file to be backed up;

根据统计算法分别统计所述多个文件数据信息中每个文件数据信息的字节数,得到多个基本字节数;According to a statistical algorithm, the number of bytes of each file data information in the plurality of file data information is separately counted to obtain a plurality of basic byte numbers;

汇总所述多个基本字节数,得到所述待备份文件的字节数据,其中,所述字节数据为所述待备份文件所占存储空间的大小。Summarize the plurality of basic byte numbers to obtain byte data of the file to be backed up, where the byte data is the size of the storage space occupied by the file to be backed up.

本发明实施例中,通过将时间戳与安全信息码结合的方式为回滚文件命名,使得回滚文件名称具有唯一性,从而提高了服务器查找回滚文件的效率。In the embodiment of the present invention, the rollback file is named by combining the timestamp and the security information code, so that the rollback file name is unique, thereby improving the efficiency of the server to find the rollback file.

上面图3和图4从模块化功能实体的角度对本发明实施例中的回滚文件的备份装置进行详细描述,下面从硬件处理的角度对本发明实施例中回滚文件的备份设备进行详细描述。3 and 4 above describe in detail the backup device for rolling back files in the embodiment of the present invention from the perspective of modular functional entities, and the following describes the backup device for rolling back files in the embodiment of the present invention in detail from the perspective of hardware processing.

图5是本发明实施例提供的一种回滚文件的备份设备的结构示意图,该回滚文件的备份设备500可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)510(例如,一个或一个以上处理器)和存储器520,一个或一个以上存储应用程序533或数据532的存储介质530(例如一个或一个以上海量存储设备)。其中,存储器520和存储介质530可以是短暂存储或持久存储。存储在存储介质530的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对回滚文件的备份设备500中的一系列指令操作。更进一步地,处理器510可以设置为与存储介质530通信,在回滚文件的备份设备500上执行存储介质530中的一系列指令操作。5 is a schematic structural diagram of a backup device for rolling back files according to an embodiment of the present invention. The backup device 500 for rolling back files may vary greatly due to different configurations or performance, and may include one or more processors Central processing units (CPU) 510 (eg, one or more processors) and memory 520 , one or more storage media 530 (eg, one or more mass storage devices) that store application programs 533 or data 532 . Among them, the memory 520 and the storage medium 530 may be short-term storage or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the backup device 500 for rolling back files. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the backup device 500 for rolling back files.

回滚文件的备份设备500还可以包括一个或一个以上电源540,一个或一个以上有线或无线网络接口550,一个或一个以上输入输出接口560,和/或,一个或一个以上操作系统531,例如Windows Serve,Mac OS X,Unix,Linux,FreeBSD等等。本领域技术人员可以理解,图5示出的回滚文件的备份设备结构并不构成对回滚文件的备份设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。The backup device 500 for rolling back files may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and/or, one or more operating systems 531, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD and many more. Those skilled in the art can understand that the structure of the backup device for the rollback file shown in FIG. 5 does not constitute a limitation on the backup device for the rollback file, and may include more or less components than those shown in the figure, or combine some components , or a different component arrangement.

进一步地,所述计算机可用存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。Further, the computer usable storage medium may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function, and the like; using the created data, etc.

本发明还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,该计算机可读存储介质也可以为易失性计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行所述回滚文件的备份方法的步骤。The present invention also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium may also be a volatile computer-readable storage medium. The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to execute the steps of the method for backing up a rollback file.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above may refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, removable hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A backup method of a rollback file is characterized by comprising the following steps:
acquiring byte data of a file to be backed up, wherein the byte data is the size of a storage space occupied by the file to be backed up;
supplementing the byte data by adopting a message digest algorithm to obtain initialized byte data;
performing cyclic linear calculation on the initialized byte data by using a preset buffer to obtain a safety information code;
acquiring a time stamp of the file to be backed up, wherein the time stamp is used for indicating the time corresponding to the last change instruction executed by the file to be backed up;
and splicing the timestamp and the safety information code by using a combination algorithm to obtain a name of a file to be backed up, determining the name of the file to be backed up as the name of the file to be backed up to obtain a rollback file, and storing the rollback file into a rollback folder.
2. The method for backing up a rollback file according to claim 1, wherein said supplementing said byte data with a message digest algorithm to obtain initialized byte data comprises:
judging whether the length of the byte data is equal to a preset byte length by adopting a message digest algorithm;
if the length of the byte data is smaller than the preset byte length, supplementing the length of the byte data until the length of the byte data reaches the preset byte length to obtain byte data to be supplemented;
if the length of the byte data is equal to the preset byte length, determining the byte data as byte data to be supplemented;
and adding extension data after the last bit of the byte data to be supplemented to obtain initialized byte data, wherein the extension data is data for recording the length of the byte data.
3. The method for backing up a rollback file according to claim 2, wherein if the length of the byte data is smaller than the preset byte length, the length of the byte data is supplemented until the length of the byte data reaches the preset byte length, and obtaining byte data to be supplemented includes:
if the length of the byte data is less than the preset byte length, calculating the length n of the byte data needing to be supplemented according to a preset formula, wherein the preset formula is as follows: (n + m) mod512 ═ 448, where m is the length of byte data, n is the length of byte data to be supplemented, and n and m are both positive integers;
and supplementing the supplementary bytes with the length of n behind the byte data to obtain the byte data to be supplemented.
4. The method for backing up a rollback file according to claim 1, wherein said performing a circular linear calculation on said initialization byte data using a pre-buffer to obtain a security information code comprises:
initializing the preset buffer to obtain an initial input value, and inputting the initial input value into a preset linear function to obtain a first calculation result;
averagely dividing the initialization byte data into four groups to respectively obtain first grouping byte data, second grouping byte data, third grouping byte data and fourth grouping byte data;
adding the first calculation result and the first grouped byte data and inputting the result into the preset linear function to obtain a second calculation result;
adding the second calculation result and the second byte data to be input into the preset linear function to obtain a third calculation result;
adding the third calculation result and the third packet byte data, and inputting the result into the preset linear function to obtain a fourth calculation result;
adding the fourth calculation result and the fourth grouped byte data and inputting the result into the preset linear function to obtain a fifth calculation result;
and combining the second calculation result, the third calculation result, the fourth calculation result and the fifth calculation result to obtain a safety information code.
5. The method for backing up a rollback file according to claim 1, wherein the obtaining a timestamp of the file to be backed up, wherein the timestamp is used to indicate a time corresponding to a last change instruction executed by the file to be backed up, includes:
respectively extracting the last time and the current time of the file to be backed up, wherein the last time comprises the last access time, the last modification time and the last change time;
respectively calculating a first time interval between the last access time and the current time, a second time interval between the last modification time and the current time and a third time interval between the last modification time and the current time;
and screening a target time interval with the smallest time interval value from the first time interval, the second time interval and the third time interval, and determining the last time corresponding to the target time interval as a time stamp of the file to be backed up, wherein the time stamp is used for indicating the time corresponding to the last change instruction executed by the file to be backed up.
6. The method for backing up a rollback file according to claim 1, wherein the splicing the timestamp and the security information code using a binding algorithm to obtain a name of a file to be backed up, determining that the name of the file to be backed up is the name of the file to be backed up, obtaining the rollback file, and storing the rollback file in a rollback folder comprises:
respectively extracting the time stamp and the safety information code of the file to be backed up by adopting a combination algorithm;
splicing the safety information code after the time stamp by using a preset connector to obtain a name of a file to be backed up, determining the name of the file to be backed up as the name of the file to be backed up to obtain a rollback file, and storing the rollback file into a rollback folder.
7. The method for backing up a rollback file according to any one of claims 1-6, wherein the obtaining byte data of the file to be backed up, wherein the byte data is the size of the storage space occupied by the file to be backed up, comprises:
reading a file to be backed up, and acquiring a plurality of file data information in the file to be backed up;
respectively counting the byte number of each file data information in the plurality of file data information according to a counting algorithm to obtain a plurality of basic byte numbers;
summarizing the basic byte numbers to obtain byte data of the file to be backed up, wherein the byte data is the size of the storage space occupied by the file to be backed up.
8. A backup apparatus for a rollback file, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring byte data of a file to be backed up, and the byte data is the size of a storage space occupied by the file to be backed up;
the supplement module is used for supplementing the byte data by adopting a message digest algorithm to obtain initialized byte data;
the calculation module is used for performing cyclic linear calculation on the initialized byte data by utilizing a preset buffer to obtain a safety information code;
the second obtaining module is used for obtaining a timestamp of the file to be backed up, wherein the timestamp is used for indicating the moment corresponding to the last change instruction executed by the file to be backed up;
and the determining and storing module is used for splicing the timestamp and the safety information code by using a combination algorithm to obtain a name of the file to be backed up, determining the name of the file to be backed up as the name of the file to be backed up to obtain a rollback file, and storing the rollback file into a rollback folder.
9. A backup device for a rollback file, the backup device comprising: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invokes the instructions in the memory to cause the rollback file backup device to perform the rollback file backup method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of backing up a rollback file according to any one of claims 1-7.
CN202010880807.4A 2020-08-27 2020-08-27 Backup method, device and equipment of rollback file and storage medium Pending CN112015594A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010880807.4A CN112015594A (en) 2020-08-27 2020-08-27 Backup method, device and equipment of rollback file and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010880807.4A CN112015594A (en) 2020-08-27 2020-08-27 Backup method, device and equipment of rollback file and storage medium

Publications (1)

Publication Number Publication Date
CN112015594A true CN112015594A (en) 2020-12-01

Family

ID=73503809

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010880807.4A Pending CN112015594A (en) 2020-08-27 2020-08-27 Backup method, device and equipment of rollback file and storage medium

Country Status (1)

Country Link
CN (1) CN112015594A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113037854A (en) * 2021-03-22 2021-06-25 平安国际智慧城市科技股份有限公司 Method, device and equipment for monitoring tail gas of motor vehicle and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1365063A (en) * 2001-12-12 2002-08-21 湖南省公安厅户政服务中心 New method for veriying citizenship
CN104503864A (en) * 2014-11-20 2015-04-08 北京世纪高蓝科技有限公司 Method and device for file backup based on local area network
CN106603244A (en) * 2016-12-30 2017-04-26 北京海泰方圆科技股份有限公司 Digital right management protection method and device
CN110457628A (en) * 2019-07-05 2019-11-15 平安国际智慧城市科技股份有限公司 Webpage edition correcting method, device, equipment and storage medium
CN110858191A (en) * 2018-08-24 2020-03-03 北京三星通信技术研究有限公司 File processing method and device, electronic equipment and readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1365063A (en) * 2001-12-12 2002-08-21 湖南省公安厅户政服务中心 New method for veriying citizenship
CN104503864A (en) * 2014-11-20 2015-04-08 北京世纪高蓝科技有限公司 Method and device for file backup based on local area network
CN106603244A (en) * 2016-12-30 2017-04-26 北京海泰方圆科技股份有限公司 Digital right management protection method and device
CN110858191A (en) * 2018-08-24 2020-03-03 北京三星通信技术研究有限公司 File processing method and device, electronic equipment and readable storage medium
CN110457628A (en) * 2019-07-05 2019-11-15 平安国际智慧城市科技股份有限公司 Webpage edition correcting method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113037854A (en) * 2021-03-22 2021-06-25 平安国际智慧城市科技股份有限公司 Method, device and equipment for monitoring tail gas of motor vehicle and storage medium
CN113037854B (en) * 2021-03-22 2024-01-23 平安国际智慧城市科技股份有限公司 Method, device, equipment and storage medium for monitoring tail gas of motor vehicle

Similar Documents

Publication Publication Date Title
JP6884128B2 (en) Data deduplication device, data deduplication method, and data deduplication program
AU2001296665B2 (en) System for identifying common digital sequences
US5732265A (en) Storage optimizing encoder and method
JP5468620B2 (en) Method and apparatus for content-aware data partitioning and data deduplication
US10853324B2 (en) Generating a data stream with a predictable change rate
US9305005B2 (en) Merging entries in a deduplication index
CN103699585B (en) Methods, devices and systems for file metadata storage and file recovery
US10235134B1 (en) Rotating bit values while generating a large, non-compressible data stream
US20100262797A1 (en) Virtual machine data backup
US10218764B2 (en) Generating a large, non-compressible data stream
US8768901B1 (en) Method and apparatus for selectively storing blocks of data on a server
HK1214378A1 (en) Optimizing data block size for deduplication
WO2015066719A2 (en) Use of solid state storage devices and the like in data deduplication
AU2001296665A1 (en) System for identifying common digital sequences
US11544150B2 (en) Method of detecting source change for file level incremental backup
US9094195B2 (en) Protecting de-duplication repositories against a malicious attack
US10163371B1 (en) Rotating bit values based on a data structure while generating a large, non-compressible data stream
US11593304B2 (en) Browsability of backup files using data storage partitioning
WO2015096847A1 (en) Method and apparatus for context aware based data de-duplication
US9256503B2 (en) Data verification
CN112015594A (en) Backup method, device and equipment of rollback file and storage medium
WO2018156503A1 (en) Methods for performing data deduplication on data blocks at granularity level and devices thereof
CN113204556A (en) Storage method, system, terminal and storage medium based on low-order hash label
CN108399152A (en) Compression expression method, system, storage medium and the rule match device of digital search tree
WO2020088211A1 (en) Data compression method and related apparatus, and data decompression method and related apparatus

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