A method of avoiding waste third party cloud memory space

文档序号:1755022 发布日期:2019-11-29 浏览:2次 中文

阅读说明:本技术 一种避免浪费第三方云存储空间的方法 (A method of avoiding waste third party cloud memory space ) 是由 毕明 于 2019-08-15 设计创作,主要内容包括:本发明公开了一种避免浪费第三方云存储空间的方法。本发明设通知消息中的文件在服务端保存的属性有:文件哈希值、文件大小、文件类型、文件存储方式、文件网络地址、文件是否已发送属性。本发明采用先上传至本地服务器,待用户确认发送消息后再上传文件至第三方云存储空间的方法,杜绝了用户在消息发送前删除文件、修改文件带来的第三方存储空间和流量的浪费。本发明当有相同文件哈希值的文件出现时,不再进行上传操作,提高了效率并避免了重复文件上传带来的第三方存储空间和流量的浪费。(The invention discloses a kind of methods for avoiding waste third party cloud memory space.The present invention sets the file in notification message to be had in the attribute that server-side saves: whether file cryptographic Hash, file size, file type, document storage mode, file network address, file have sent attribute.The present invention is using local server is first uploaded to, and upper transmitting file has prevented the waste that user deletes file, modifies file bring third party memory space and flow before message is sent to the method for third party cloud memory space again after user confirms and sends message.The present invention no longer carries out upload operation when there is the file of same file cryptographic Hash to occur, and improves efficiency and avoids the waste that duplicate file uploads bring third party memory space and flow.)

1. a kind of method for avoiding waste third party cloud memory space, it is characterised in that include the following steps:

If the file in notification message has in the attribute that server-side saves: file cryptographic Hash, file size, file type, file Whether storage mode, file network address, file have sent attribute;

When step 1, user's select file, using web browser calculation document cryptographic Hash, file size, file type, and access Local server inquires the whether existing this document of local server according to file cryptographic Hash, if it exists then by file storage side Formula is set as local server storage, sets the corresponding network address of local server store path for file network address, It no longer needs to carry out file upload operation at this time;If it does not exist, then the whether existing this document of third party cloud memory space is inquired, if In the presence of then the storage of third party cloud memory space is set by document storage mode, third party cloud is set by file network address and is deposited The corresponding network address in space is stored up, no longer needs to carry out file upload operation at this time;If local server and third party cloud storage are empty Between this document is all not present, create temp directory in local server, the subdirectory named with the date created under temp directory The format of A, date are YYYYMMDD, recycle mature piecemeal uploading file that file is uploaded to the catalogue of local server In A;Local server storage is set by document storage mode after uploading successfully, sets local service for file network address The corresponding network address of device store path is set as "No" for whether file has sent attribute;

Step 2 obtains document storage mode, behind file network address in step 1, by file cryptographic Hash, file size and text Part type, storage mode, network address are stored to database;User, which clicks, sends message, after message is sent successfully, by file Attribute whether is sent and has been set as "Yes", recipient will access this document according to file network address;The storage side of file at this time Formula is according to the different situations in step 1, it would be possible to be local server storage or the storage of third party cloud memory space: if depositing When storage mode is that third party cloud memory space stores, it will not need to carry out other operations to file;If storage mode is local clothes When business device storage, then upper transmitting file is opened to the system task of third party cloud memory space, this task first step will be according to file Cryptographic Hash inquire the whether existing identical file of third party cloud memory space again, then terminated task if it exists, and updating Document storage mode is the storage of third party cloud memory space, and it is corresponding to set third party cloud memory space for file network address Network address;Then upper transmitting file is to third party cloud memory space if it does not exist, and after uploading successfully, will update document storage mode is The storage of third party cloud memory space, and the corresponding network address of third party cloud memory space is set by file network address;

Step 3, in step 1 if local server and third party cloud memory space are all not present this document, file successfully on After the temp directory for reaching local server, if user selects to delete multimedia file, modification multimedia file, directly delete Or the file of modification local server storage;If the transmission of user's cancellation notice message, due to the file of local server storage It is stored in the subdirectory A named with the date in step 1, system can open the deleting file in temp directory of the task daily, protect Extra file is demonstrate,proved to be deleted.

2. a kind of method for avoiding waste third party cloud memory space according to claim 1, it is characterised in that described It is as follows to delete temporary catalog file flow of task:

Date C on the day of acquisition system and the date D before three days, format are all YYYYMMDD, traverse the subdirectory of temp directory, If there is the subdirectory of entitled D, the subdirectory is traversed, obtains the corresponding network address of All Files under the subdirectory;According to File network address lookup database directly deletes file if no record and whether has sent attribute according to file if there is record Judge whether to delete;If it is "No" that whether part, which has sent attribute, directly deletion file then illustrates there is message if "Yes" File in record is directed toward the address, and this document cannot be deleted;Having the case where record may be due to transmitting file upper in step 2 To third party cloud memory space system task upload failure, at this time first by the subdirectory of file copy to entitled C simultaneously more The file network address recorded in new database, is then turned on the system task of transmitting file to third party cloud memory space.

Technical field

The present invention relates to Computer Applied Technology, especially a kind of method for avoiding waste third party cloud memory space.

Background technique

Heap file resource can be generated in the use process of various web application and app application, for example sends multimedia The Miscellaneous Documents resources such as picture, video, the document that may be attached to when message.Storing these accessory resources over time needs Want massive storage space.Many products can buy the third party cloud memory space of profession, and more being stored using third party cloud is empty Between also imply that cost is bigger certainly.

Illustrate the operation for wasting third party cloud memory space so that web application sends the notification message comprising file as an example. In order to promote user experience, reduction user clicks response time when sending message, generally requires when user chooses file, Asynchronous that file is uploaded to third party cloud memory space, such user, which clicks, will not need to carry out time-consuming text again when sending message Part upload operation.If user deletes file, modification file, cancellation message before clicking transmission message and sends, originally uploaded File to third party cloud memory space will will become discarded record, to waste third party cloud memory space.Or it uses Family has selected identical file when sending different notification messages, and repetition is uploaded to third party cloud memory space and similarly causes Waste.

Summary of the invention

The present invention is directed to above-mentioned scene, provides a kind of method for avoiding waste third party cloud memory space.The present invention exists While guaranteeing user experience, discarded record and duplicate file can be prevented to be uploaded to third party cloud memory space, to reduce cloud Carrying cost.

It is illustrated so that web application sends the notification message comprising file as an example:

If the file in notification message has in the attribute that server-side saves: file cryptographic Hash, file size, file type, Whether document storage mode, file network address, file have sent.

When step 1, user's select file, using the cryptographic Hash, size and type of web browser calculation document, and access Local server inquires the whether existing this document of local server according to file cryptographic Hash, if it exists then by file storage side Formula is set as local server storage, sets the corresponding network address of local server store path for file network address, It no longer needs to carry out file upload operation at this time.If it does not exist, then the whether existing this document of third party cloud memory space is inquired, if In the presence of then the storage of third party cloud memory space is set by document storage mode, third party cloud is set by file network address and is deposited The corresponding network address in space is stored up, no longer needs to carry out file upload operation at this time.If local server and third party cloud storage are empty Between this document is all not present, create temp directory in local server, the subdirectory named with the date created under temp directory The format of A, date are YYYYMMDD, recycle mature piecemeal uploading file that file is uploaded to the catalogue of local server In A.Local server storage is set by document storage mode after uploading successfully, sets local service for file network address The corresponding network address of device store path is set as "No" for whether file has sent attribute.

Step 2 obtains document storage mode, behind file network address in step 1, by the cryptographic Hash of file, size and Type, storage mode, network address are stored to database.User clicks transmission message The no attribute that sent is set as "Yes", and recipient will access this document according to file network address.The storage mode of file at this time According to the different situations in step 1, it would be possible to be local server storage or the storage of third party cloud memory space.If storage When mode is that third party cloud memory space stores, it will not need to carry out other operations to file.If storage mode is local service When device stores, then upper transmitting file is opened to the system task of third party cloud memory space, this task first step will be according to file Cryptographic Hash inquires the whether existing identical file of third party cloud memory space again, if it exists then terminated task, and updates text Part storage mode is the storage of third party cloud memory space, sets the corresponding net of third party cloud memory space for file network address Network address.Then upper transmitting file is to third party cloud memory space if it does not exist, is the by update document storage mode after uploading successfully The storage of tripartite's cloud storage space, and the corresponding network address of third party cloud memory space is set by file network address.

Step 3, in step 1 if local server and third party cloud memory space are all not present this document, file at After function is uploaded to the temp directory of local server, if user selects to delete multimedia file, modification multimedia file, directly The file of local server storage is deleted or modified.If the transmission of user's cancellation notice message, due to local server storage File is stored in the subdirectory A named with the date in step 1, and system can open times for deleting file in temp directory daily Business guarantees that extra file is deleted.

It is as follows to delete temporary catalog file flow of task:

Date C and the date D before three days, format on the day of acquisition current system are all YYYYMMDD, traverse temp directory Subdirectory traverse the subdirectory if there is the subdirectory of entitled D, obtain the corresponding network of All Files under the subdirectory Address.According to file network address lookup database, if no record directly delete file, if there is record, according to file whether Send whether determined property can delete.If it is "No" that whether part, which has sent attribute, file is directly deleted, if "Yes", then Illustrate there is the file in Message Record to be directed toward the address, this document cannot be deleted.Having the case where record may be due to step 2 In the system task of upper transmitting file to third party cloud memory space upload failure, at this time first by file copy to the son of entitled C The file network address recorded in catalogue while more new database, being then turned on transmitting file to third party cloud memory space is System task.

The present invention has the beneficial effect that:

Present invention use is first uploaded to local server, goes up transmitting file again after user confirms and sends message to third party cloud The method of memory space, prevented user message send before delete file, modification file bring third party memory space and The waste of flow.

The present invention no longer carries out upload operation, improves efficiency and keep away when there is the file of same file cryptographic Hash to occur The waste that duplicate file uploads bring third party memory space and flow is exempted from.

Specific embodiment

A method of avoid waste third party cloud memory space that from capable of preventing useless text while guaranteeing user experience Part and duplicate file are uploaded to third party cloud memory space, to reduce cloud storage cost.

It is illustrated so that web application sends the notification message comprising file as an example:

If the file in notification message has in the attribute that server-side saves: file cryptographic Hash, file size, file type, Whether document storage mode, file network address, file have sent.

When step 1, user's select file, using the cryptographic Hash, size and type of web browser calculation document, and access Local server inquires the whether existing this document of local server according to file cryptographic Hash, if it exists then by file storage side Formula is set as local server storage, sets the corresponding network address of local server store path for file network address, It no longer needs to carry out file upload operation at this time.If it does not exist, then the whether existing this document of third party cloud memory space is inquired, if In the presence of then the storage of third party cloud memory space is set by document storage mode, third party cloud is set by file network address and is deposited The corresponding network address in space is stored up, no longer needs to carry out file upload operation at this time.If local server and third party cloud storage are empty Between this document is all not present, create temp directory in local server, the subdirectory named with the date created under temp directory The format of A, date are YYYYMMDD, recycle mature piecemeal uploading file that file is uploaded to the catalogue of local server In A.Local server storage is set by document storage mode after uploading successfully, sets local service for file network address The corresponding network address of device store path is set as "No" for whether file has sent attribute.

Step 2 obtains document storage mode, behind file network address in step 1, by the cryptographic Hash of file, size and Type, storage mode, network address are stored to database.User clicks transmission message The no attribute that sent is set as "Yes", and recipient will access this document according to file network address.The storage mode of file at this time According to the different situations in step 1, it would be possible to be local server storage or the storage of third party cloud memory space.If storage When mode is that third party cloud memory space stores, it will not need to carry out other operations to file.If storage mode is local service When device stores, then upper transmitting file is opened to the system task of third party cloud memory space, this task first step will be according to file Cryptographic Hash inquires the whether existing identical file of third party cloud memory space again, if it exists then terminated task, and updates text Part storage mode is the storage of third party cloud memory space, sets the corresponding net of third party cloud memory space for file network address Network address.Then upper transmitting file is to third party cloud memory space if it does not exist, is the by update document storage mode after uploading successfully The storage of tripartite's cloud storage space, and the corresponding network address of third party cloud memory space is set by file network address.

Step 3, in step 1 if local server and third party cloud memory space are all not present this document, file at After function is uploaded to the temp directory of local server, if user selects to delete multimedia file, modification multimedia file, directly The file of local server storage is deleted or modified.If the transmission of user's cancellation notice message, due to local server storage File is stored in the subdirectory A named with the date in step 1, and system can open times for deleting file in temp directory daily Business guarantees that extra file is deleted.

It is as follows to delete temporary catalog file flow of task:

Date C and the date D before three days, format on the day of acquisition current system are all YYYYMMDD, traverse temp directory Subdirectory traverse the subdirectory if there is the subdirectory of entitled D, obtain the corresponding network of All Files under the subdirectory Address.According to file network address lookup database, if no record directly delete file, if there is record, according to file whether Send whether determined property can delete.If it is "No" that whether part, which has sent attribute, file is directly deleted, if "Yes", then Illustrate there is the file in Message Record to be directed toward the address, this document cannot be deleted.Having the case where record may be due to step 2 In the system task of upper transmitting file to third party cloud memory space upload failure, at this time first by file copy to the son of entitled C The file network address recorded in catalogue while more new database, being then turned on transmitting file to third party cloud memory space is System task.

5页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种数据迁移方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类