File distribution method and system, computer equipment and storage medium
By building an edge storage cluster between the terminal and the device and using file identifiers for file distribution, the problem of large bandwidth usage and unstable distribution in the prior art is solved, and more efficient and stable file distribution is achieved.
Patent Information
- Application Number
- CN202311342400.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-17
- Publication Date
- 2025-04-18
AI Technical Summary
In the process of file distribution between different terminals or devices, the prior art usually relies on cloud download, which leads to a large amount of bandwidth in the public network and may cause file distribution failure when the public network is abnormal.
By building an edge storage cluster between the local and client, file identification is used for file distribution. If the file is stored on the local side, it is stored at the edge; if the file is stored at the cloud, it is downloaded to the local side and stored at the edge. The client selects the download source edge node in the edge storage cluster according to the file identity, and downloads it through the cloud if it fails to download.
It reduces the use of public network bandwidth during file distribution, improves the stability of file distribution, reduces the client's dependence on the local side, and improves the flexibility and fault tolerance of the distribution system.
Smart Images

Figure CN119854280A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data distribution technology, and in particular to a file distribution method, system, computer equipment and storage medium. Background Art
[0002] With the development of intelligent technology, the types of electronic products that people come into contact with in daily life are becoming increasingly diverse, among which terminals or devices with interactive functions are being used more and more widely. Based on terminals or devices with interactive functions, a variety of interactive activities can be realized, such as online meetings, online teaching or commercial exhibitions. In interactive activities, file distribution between different terminals or devices may be involved. In related technologies, different terminals or devices download files through the cloud, and downloading files through the cloud usually occupies public network bandwidth and occupies more public network resources. Summary of the invention
[0003] Based on this, it is necessary to provide a file distribution method, device, system, computer equipment, storage medium and computer program product that reduce the occupation of public network resources in response to the above technical problems.
[0004] In a first aspect, the present application provides a file distribution method, which is applied to a local end, where both the local end and the client end serve as edge nodes and form an edge storage cluster; the method comprises:
[0005] Get the file identifier corresponding to the file to be distributed;
[0006] If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier;
[0007] When there is a file identifier in the edge storage directory of this end, a file download instruction carrying the file identifier is sent to the client that is the target of file distribution. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0008] In one of the embodiments, obtaining a file according to a source of obtaining the file identifier includes: downloading the file from the cloud when the file identifier is obtained based on a cloud storage directory; obtaining the file in the local storage directory when the file identifier is obtained based on a local storage directory, and sending the file to the cloud for backup storage by the cloud.
[0009] In one of the embodiments, the method further includes: when the files in the edge storage directory of the local end are out of sync with the files in the cloud storage directory, downloading the files in the cloud storage directory to the local storage directory.
[0010] In one of the embodiments, there are multiple clients; before sending a file download instruction carrying a file identifier to a client that is a file distribution target, it also includes: obtaining address information of each client, and establishing a communication connection with the corresponding client based on each address information; sending the address information of each client to each client, and the address information is used to indicate that different clients establish a communication connection with each other.
[0011] In one of the embodiments, the method also includes: obtaining the local metadata corresponding to the local end, the local metadata including the edge node list information corresponding to each file stored in the edge storage cluster, the edge node list information is used to characterize the edge nodes storing the corresponding files; when there is a file update in the edge storage directory of the local end, updating the edge node list information in the local metadata, and synchronizing the updated local metadata to the edge nodes in the edge storage cluster.
[0012] In one of the embodiments, the local metadata also includes edge file information corresponding to each file stored in the edge storage directory of the local end, and the edge file information includes the edge storage address and cloud storage address of the file; the method also includes: when receiving a file download request from an edge node in an edge storage cluster, obtaining the corresponding edge storage address in the edge file information according to the file identifier in the file download request; according to the edge storage address, obtaining the corresponding file in the edge storage directory of the local end, and if the corresponding file is obtained, distributing the corresponding file to the edge node that initiates the file download request; if the file is not obtained, returning an acquisition failure message to the edge node that initiates the file download request, and the acquisition failure message is used to instruct the edge node that initiates the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
[0013] In a second aspect, the present application further provides a local end, including:
[0014] A first acquisition module, used to acquire a file identifier corresponding to a file to be distributed;
[0015] A second acquisition module is used to acquire the file according to the acquisition source of the file identifier when there is no file identifier in the edge storage directory of the local end, and edge store the file on the local end, and update the edge storage directory of the local end based on the file identifier;
[0016] The sending module is used to send a file download instruction carrying the file identifier to the client as the file distribution target when there is a file identifier in the edge storage directory of the local end. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0017] In a third aspect, the present application provides a file distribution method, which is applied to a client, where both the client and the local terminal serve as edge nodes and form an edge storage cluster; the method includes:
[0018] Obtaining a file download instruction sent by the local end, the file download instruction including a file identifier corresponding to the file to be downloaded;
[0019] According to the file identifier, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded based on the selected edge node;
[0020] If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0021] In one embodiment, selecting an edge node as a download source in an edge storage cluster according to a file identifier, and downloading the file based on the selected edge node includes:
[0022] Obtain client metadata corresponding to the client, where the client metadata includes edge node list information corresponding to each file stored in the edge storage cluster, where the edge node list information is used to represent edge nodes storing corresponding files;
[0023] According to the busyness of each edge node in the edge node list information corresponding to the file, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded through the edge node as the download source;
[0024] When receiving an acquisition failure message returned by the edge node as the download source, an edge node as the download source is reselected in the edge storage cluster to download the file.
[0025] In one embodiment, the client metadata further includes edge file information corresponding to each file stored in the edge storage directory of the client, and the edge file information includes an edge storage address and a cloud storage address of the file; and the method further includes:
[0026] When receiving a file download request from an edge node in the edge storage cluster, obtaining a corresponding edge storage address in the edge file information according to a file identifier in the file download request;
[0027] According to the edge storage address, the corresponding file is obtained in the edge storage directory of the client, and if obtained, the corresponding file is distributed to the edge node that initiates the file download request;
[0028] If the file is not obtained, an acquisition failure message is returned to the edge node that initiated the file download request. The acquisition failure message is used to instruct the edge node that initiated the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
[0029] In a fourth aspect, the present application further provides a client, including:
[0030] An acquisition module is used to acquire a file download instruction sent by the local end, where the file download instruction includes a file identifier corresponding to the file to be downloaded;
[0031] A first distribution module, configured to select an edge node as a download source in the edge storage cluster according to the file identifier, and download the file based on the selected edge node;
[0032] The second distribution module is used to download the file through the cloud when the file is not downloaded through the edge storage cluster.
[0033] In a fifth aspect, the present application also provides a file distribution system, including:
[0034] The local end and the client end, both the local end and the client end serve as edge nodes and form an edge storage cluster;
[0035] The local end is used to obtain the file identifier corresponding to the file to be distributed. If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier; if the file identifier exists in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target;
[0036] The client is used to select an edge node as a download source in the edge storage cluster according to the file identifier carried in the file download instruction, and download the file based on the selected edge node. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0037] In a sixth aspect, the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0038] Get the file identifier corresponding to the file to be distributed;
[0039] If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier;
[0040] If there is a file identifier in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0041] Alternatively, implement the following steps:
[0042] Obtaining a file download instruction sent by the local end, the file download instruction including a file identifier corresponding to the file to be downloaded;
[0043] According to the file identifier, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded based on the selected edge node;
[0044] If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0045] In a seventh aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0046] Get the file identifier corresponding to the file to be distributed;
[0047] If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier;
[0048] If there is a file identifier in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0049] Alternatively, implement the following steps:
[0050] Obtaining a file download instruction sent by the local end, the file download instruction including a file identifier corresponding to the file to be downloaded;
[0051] According to the file identifier, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded based on the selected edge node;
[0052] If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0053] In an eighth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0054] Get the file identifier corresponding to the file to be distributed;
[0055] If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier;
[0056] If there is a file identifier in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0057] Alternatively, implement the following steps:
[0058] Obtaining a file download instruction sent by the local end, the file download instruction including a file identifier corresponding to the file to be downloaded;
[0059] According to the file identifier, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded based on the selected edge node;
[0060] If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0061] In the above-mentioned file distribution method, device, system, computer equipment, storage medium and computer program product, the local end obtains the file identifier corresponding to the file to be distributed, and when the file identifier does not exist in the edge storage directory of the local end, the file to be distributed is edge stored by the local end, so that at least one edge node in the edge storage cluster formed by the local end and the client stores the file to be distributed. On this basis, the local end sends a file download instruction carrying the file identifier to the client, and the client can find which edge nodes in the edge storage cluster store the file based on the file identifier, and download the file through the edge node storing the file.
[0062] Since the client does not need to download files through the public network, but downloads files through the corresponding local area network of the edge storage cluster, it can improve the situation where the public network bandwidth is occupied when there are many file download requests. At the same time, even abnormal files on the public network can still be distributed normally, which can improve the stability of file distribution. In addition, although downloading files through the edge storage cluster also uses the local area network to download files, when downloading files, not all clients download files from the local end. Instead, both the local end and the client act as edge nodes, and the client selects an edge node from all edge nodes based on the file identifier, and downloads the file through the selected edge node. In this way, the distribution pressure caused by all clients downloading files from the local end can be reduced. Finally, even if the client fails to download the file through the edge storage cluster, it can still download the file through the cloud. Through the synergy between cloud services and edge storage services, the stability of file distribution can be further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 A schematic diagram of an implementation scenario of cloud distribution in one embodiment;
[0064] Figure 2 A schematic diagram of an implementation scenario of local area network distribution in one embodiment;
[0065] Figure 3 A schematic diagram of an implementation scenario of a file distribution method in an embodiment;
[0066] Figure 4 A schematic diagram of a process flow of a file distribution method in an embodiment;
[0067] Figure 5 is a schematic diagram of a cloud storage format in one embodiment;
[0068] Figure 6 is a schematic diagram of a metadata storage format in one embodiment;
[0069] Figure 7 A schematic diagram of a data structure of metadata in an embodiment;
[0070] Figure 8 is a flowchart of a file distribution method in another embodiment;
[0071] Fig. 9 is a flowchart of a file distribution method in yet another embodiment;
[0072] Fig.10 A schematic diagram of a process of establishing a communication connection and initializing metadata in one embodiment;
[0073] Fig.11 A schematic diagram of a system consisting of a teacher terminal and a student terminal in one embodiment;
[0074] Fig.12 is a structural block diagram of the local end in an embodiment;
[0075] Fig.13 A structural block diagram of a client in one embodiment;
[0076] Fig.14 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0077] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0078] It is understood that the terms "first", "second", etc. used in this application can be used in this article to describe various professional terms, but unless otherwise specified, these professional terms are not limited by these terms. These terms are only used to distinguish one professional term from another professional term. For example, without departing from the scope of this application, the third preset threshold and the fourth preset threshold can be the same or different.
[0079] Currently, when different terminals or devices conduct online interactive activities, file distribution may be involved. Usually, data distribution between different terminals or devices is achieved through a local area network or the cloud.
[0080] For distributing files through the cloud, take the different terminals as the teacher and the student as an example. The process of distributing files between the teacher and the student can be referred to Figure 1 .exist Figure 1 In the process, the teacher can first upload the file to the cloud and store it through the cloud storage service. Therefore, the teacher can distribute the cloud storage address to the student through the TCP (Transmission Control Protocol) connection, and the student can download the file from the cloud based on the cloud storage address. Figure 1 The connection between the teacher end and the student end and the cloud can be established using HTTPS (Hypertext Transfer Protocol Secure).
[0081] It is understandable that distributing files through the cloud may occupy more public network bandwidth when there are many access requests from students. At the same time, the file distribution performance will also be affected when the public network bandwidth performance is poor. When the public network is abnormal, it will cause the inability to distribute files.
[0082] In addition to distributing files through the cloud, you can also distribute files through the local area network. For distributing files through the local area network, taking the teacher and student terminals as an example, the process of distributing files between the teacher and student terminals can be referred to Figure 2 .exist Figure 2 In the process of teaching, the teacher can send file download instructions to the student through TCP connection. The student can request to download files from the teacher based on the file download instructions through HTTP (Hypertext Transfer Protocol) connection or FTP (File Transfer Protocol) connection.
[0083] It is understandable that distributing files through a LAN will cause greater distribution pressure on the teacher side when there are more access requests from the student side. In addition, since both the teacher side and the student side are in the LAN, when the teacher side is used across devices, the files are all in the former LAN, which will cause the files on the teacher side to be unable to be synchronized.
[0084] In view of the above problems, the present application provides a file distribution method. The method can be applied between the local terminal and the client, and can be applied to the following examples: Figure 3 In the application environment shown. Among them, the client 102, the local terminal 104 and the cloud 106 can all be used as participating terminals for file distribution, the local terminal 104 can be used as the main control terminal for interactive activities, and the client 102 can be used as a controlled terminal when participating in file distribution. This embodiment of the application does not specifically limit this. The local terminal 104 and the client 102 can communicate with each other.
[0085] The communication connection is established through the network, and the file distribution is performed based on the communication connection. Of course, different clients 102 can be connected to each other through the network. The network can be a local area network, which is not specifically limited in the embodiment of the present application. Among them, the files and related data generated by the interactive activities can be stored separately in the data storage system, or can be stored in the local terminal 104, which is not specifically limited in the embodiment of the present application.
[0086] Therefore, both the client 102 and the local end 104 can serve as edge nodes and form an edge storage cluster. The local end 104 obtains the file identifier corresponding to the file to be distributed; when the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier; when the file identifier exists in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target. Based on the file identifier, the client 102 downloads the file through the edge node in the edge storage cluster, and when the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud 106. Among them, the client 102 and the local end 104 can both be terminals or devices that can run applications for file distribution, such as personal computers, tablet computers or mobile phones, etc., and the embodiments of the present application do not specifically limit this.
[0087] In some embodiments, see Figure 4 , provides a file distribution method. This method is applied to Figure 1 The local end 104 in FIG. 1 is taken as an example for explanation.
[0088] Among them, the local terminal 104 and the client 102 can perform interactive activities through a communication connection. The interactive activities can refer to online activities achieved through network connections between different devices, such as online meetings, online teaching, or online business exhibitions, etc., which are not specifically limited in the embodiments of the present application. During the interactive activities, files can be distributed between the local terminal 104 and the client 102.
[0089] For ease of understanding, in the process of explaining the method process provided by the embodiment of the present application, when it is necessary to visualize the interactive activity for example, the embodiment of the present application will be explained by taking online teaching as an example. Thus, this end 104 can be specifically a teacher end, and the client 102 can be specifically a student end. The embodiment of the present application does not specifically limit the types of the end and the client. Among them, both the teacher end and the student end can serve as edge nodes and form an edge storage cluster. Accordingly, the method provided by the embodiment of the present application includes the following steps:
[0090] 402. Obtain a file identifier corresponding to the file to be distributed.
[0091] Specifically, edge storage refers to a data storage method that stores data directly at the data collection point without distributing the collected data to a central server (or cloud storage) for storage through the network (instantly). An edge node refers to a terminal or device that participates in edge storage, which exists as a node in an edge storage cluster. A file identifier is a unique identifier for a file and can be generated based on the content of the file. This embodiment of the present application does not specifically limit this. When obtaining a file identifier, the user on this end can select the file to be distributed by selecting it from the corresponding list in the file storage directory, thereby obtaining the file identifier corresponding to the selected file.
[0092] 404. When the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier.
[0093] It is understandable that the edge storage directory of this end may or may not have pre-stored files to be distributed. In the case where files to be distributed are pre-stored in the edge storage directory, a corresponding file identifier of the file may exist in the edge storage directory. In addition, in addition to the edge storage directory on the local end, there is also an edge storage directory on the client. It should be noted that although the edge storage directory and the corresponding edge storage service are both present on the local disk, compared to the files stored on the local disk and the local storage directory, the edge storage directory and the corresponding edge storage service may be imperceptible to the users of this end and the users of the client. Such a setting can ensure the security of the files.
[0094] Combined with the previous steps, it can be known that the source of obtaining the file identifier is used to indicate where the local end obtains the file identifier of the file to be distributed. Since the files to be distributed may be stored in different locations, such as on a local disk or on the cloud, the acquisition sources may be different. Specifically, if the files to be distributed are stored on the cloud, the source of obtaining the file identifier may correspond to the cloud, and the method for obtaining the files to be distributed may be to select files from the corresponding list in the cloud storage directory. If the files to be distributed are stored on a local disk, the source of obtaining the file identifier may correspond to the local end, and the method for obtaining the files to be distributed may be to select files from the corresponding list in the local storage directory.
[0095] From this, it can be seen that different sources of obtaining file identifiers will result in different ways of obtaining files. After obtaining the file, the file to be distributed can be edge stored on this end, and the corresponding file identifier can be updated in the edge storage directory of this section at the same time. It should be noted that the reason why the file to be distributed is edge stored on this end is because this end is also an edge node in the edge storage cluster. Edge storage on this end can ensure that there is at least one edge node in the edge storage cluster that stores the file to be distributed, so that the client can download the file normally later.
[0096] 406. When a file identifier exists in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client that is the target of file distribution. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0097] Specifically, "when there is a file identifier in the edge storage directory of the local end", it can be that the file is not edge stored through the local end, and the file identifier exists in the edge storage directory itself. It can also be that after the file is edge stored through the local end, the file identifier is updated in the edge storage directory. The "client as the file distribution target" can be one or more; it can be all clients in the edge storage cluster or some clients, and the embodiments of the present application do not specifically limit this.
[0098] After receiving the download instruction, the client can find which edge nodes in the edge storage cluster store the file to be distributed based on the file identifier, and download the file through the edge node storing the file. Considering the possibility of unexpected situations, if the client fails to download the file through the edge storage cluster, it can further download the file through the cloud.
[0099] In the above-mentioned file distribution method, the local end obtains the file identifier corresponding to the file to be distributed. When the file identifier does not exist in the edge storage directory of the local end, the local end performs edge storage on the file to be distributed, so that at least one edge node in the edge storage cluster formed by the local end and the client stores the file to be distributed. On this basis, the local end sends a file download instruction carrying the file identifier to the client, and the client can find which edge nodes in the edge storage cluster store the file based on the file identifier, and download the file through the edge node storing the file.
[0100] Since the client does not need to download files through the public network, but downloads files through the corresponding local area network of the edge storage cluster, it can improve the situation where the public network bandwidth is occupied when there are many file download requests. At the same time, even abnormal files on the public network can still be distributed normally, which can improve the stability of file distribution. In addition, although downloading files through the edge storage cluster also uses the local area network to download files, when downloading files, not all clients download files from the local end. Instead, both the local end and the client act as edge nodes, and the client selects an edge node from all edge nodes based on the file identifier, and downloads the file through the selected edge node. In this way, the distribution pressure caused by all clients downloading files from the local end can be reduced. Finally, even if the client fails to download the file through the edge storage cluster, it can still download the file through the cloud. Through the synergy between cloud services and edge storage services, the stability of file distribution can be further improved.
[0101] In some embodiments, obtaining a file according to the source of the file identifier includes: when the file identifier is obtained based on a cloud storage directory, downloading the file from the cloud; when the file identifier is obtained based on a local storage directory, obtaining the file in the local storage directory, and sending the file to the cloud for backup storage by the cloud.
[0102] As can be seen from the previous content, the source of the file identifier can be the cloud or the local disk. Therefore, the embodiments of the present application can be divided into two ways of obtaining files. Specifically, if the file identifier is obtained by the user of this end by selecting the file in the corresponding list of the cloud storage directory, the file can be downloaded from the cloud. If the file identifier is obtained by the user of this end by selecting the file in the corresponding list of the local storage directory, the file can be obtained from the local storage directory. Since the file is obtained from the local end, the cloud may not necessarily store the file. In order to ensure that the file can be downloaded from the cloud when needed later, the file can also be sent to the cloud for backup storage in the cloud.
[0103] For more information about cloud storage files, see Figure 5 .exist Figure 5 In the example, the file cloud identifier can be a unique identifier of the file related to cloud storage, such as a UUID (Universally Unique Identifier) or a code generated by a snowflake algorithm. The file cloud storage address is used to indicate the storage location of the file in the cloud, and the file content cid is the file identifier.
[0104] In the above embodiment, since files can be obtained in two ways, the file distribution sources of the users on the local side are expanded when distributing files, thereby improving convenience. In the case of obtaining files through the cloud, the users on the local side can distribute files that are not stored in the storage directory of the local side when using different terminals, thereby improving the convenience of file distribution. In the case of obtaining files through the local side, the files obtained from the storage directory of the local side can be synchronized to the cloud for storage, so that the files can be downloaded from the cloud when needed later, thereby improving the stability of file distribution.
[0105] In some embodiments, the method further comprises:
[0106] When the files in the local edge storage directory are out of sync with the files in the cloud storage directory, download the files in the cloud storage directory to the local storage directory.
[0107] It is understandable that the user of this end may use different terminals across. For example, taking this end as the teacher's end, the teacher may change different electronic classrooms to teach, and thus use terminals in different electronic classrooms. This may result in the teacher storing certain files on the terminal in a certain electronic classroom, while these files are not stored on the terminals in other electronic classrooms. When the teacher uses the corresponding terminal in other electronic classrooms, these files cannot be used.
[0108] Therefore, before the user of the local terminal uses the local terminal, it can be determined whether the files in the edge storage directory of the local terminal are synchronized with the files in the cloud storage directory. If they are not synchronized, the files in the cloud storage directory can be downloaded to the edge storage directory of the local terminal for synchronization. It should be noted that the specific execution sequence of the synchronization process can be executed when the user of the local terminal logs in to the local terminal, or it can be executed during the initialization of the local terminal, and the embodiments of the present application do not specifically limit this.
[0109] In the above embodiment, since the files stored in the cloud storage directory can be synchronized to the edge storage directory of the local end when the cloud storage directory is out of sync with the edge storage directory of the local end, convenience is provided for the users of the local end when the users of the local end use different terminals.
[0110] In some embodiments, there are multiple clients; before sending a file download instruction carrying a file identifier to a client that is a file distribution target, it also includes: obtaining address information of each client, and establishing a communication connection with the corresponding client based on each address information; sending the address information of each client to each client, and the address information is used to indicate that different clients establish a communication connection with each other.
[0111] Specifically, this end usually exists as the controller of the interactive activities, such as the teacher end can control the student end to carry out teaching activities. Thus, this end can obtain the address information of each client, such as the teacher end can obtain the address information of all student ends in the electronic classroom when teaching in the electronic classroom for interaction. Wherein, the address information can be specifically an IP address, which is not specifically limited in the embodiments of the present application. Thus, based on the address information, this end can establish a communication connection with each client. At the same time, this end can also send the address information to each client so that each client can establish a communication connection with the remaining clients.
[0112] In the above embodiment, since the number of clients can be multiple, this end can issue file download instructions to multiple clients, thereby improving the concurrency of file distribution. At the same time, since the subsequent file download is based on the edge storage cluster, even if the local end establishes a communication connection with multiple clients, different clients will not download all files from the local end, thereby improving the distribution concurrency while not causing greater distribution pressure on the local end. In addition, by sending different address information to each client through the local end, it can provide a basis for establishing an edge storage cluster, and the convenience is also improved compared to each client obtaining it from the remaining clients in sequence by sending it directly from the local end.
[0113] In some embodiments, the method further comprises:
[0114] Obtain the local metadata corresponding to the local end. The local metadata includes the edge node list information corresponding to each file stored in the edge storage cluster. The edge node list information is used to characterize the edge nodes storing the corresponding files. If there is a file update in the edge storage directory of the local end, update the edge node list information in the local metadata, and synchronize the updated local metadata to the edge nodes in the edge storage cluster.
[0115] Among them, each edge node in the edge storage cluster can apply metadata. The metadata corresponding to the local end can be called local metadata, and the metadata corresponding to the client can be called client metadata. Metadata can be stored locally, mainly used to describe the files stored in the edge storage cluster, and can include edge node list information corresponding to each file stored in the edge storage cluster. For a certain file stored in the edge storage cluster, the edge node list information corresponding to the file can indicate which edge nodes in the edge storage cluster store the file. The edge node list information can include edge node names to characterize the edge nodes that store the file.
[0116] It should be noted that the metadata corresponding to each edge node in the edge storage cluster and the included edge node list information can be consistent. That is, each edge node can know which edge nodes store the corresponding files for each file stored in the edge storage cluster through its own metadata. Therefore, when a file needs to be downloaded through the edge storage cluster, each edge node can determine the download source based on its own metadata.
[0117] As one of the edge nodes and the main sender of files, when there is a file update in the edge storage directory of the local end, the message can be synchronized to the remaining edge nodes in the edge storage cluster, so that the remaining edge nodes can download the file from the local end later. Therefore, when there is a file update in the edge storage directory of the local end, the edge node list information in the metadata of the local end can be updated at the same time and synchronized to the remaining edge nodes.
[0118] In the above embodiment, each edge node may correspond to its own metadata, and the metadata may be used to describe the file status stored in the edge storage cluster, and the edge node list information in the metadata may be used as global information to indicate which edge nodes store each file. In the case of file updates in the edge storage directory of the local end, the edge node list information in the metadata of the local end may be updated and synchronized to the remaining edge nodes, so that the remaining edge nodes may download the files from the local end in the future, thereby improving the stability of file distribution.
[0119] In some embodiments, the local metadata further includes edge file information corresponding to each file stored in the edge storage directory of the local end, and the edge file information includes the edge storage address and cloud storage address of the file; the method further includes:
[0120] When receiving a file download request from an edge node in the edge storage cluster, obtaining a corresponding edge storage address in the edge file information according to a file identifier in the file download request;
[0121] According to the edge storage address, the corresponding file is obtained in the edge storage directory of the local end, and if obtained, the corresponding file is distributed to the edge node that initiates the file download request;
[0122] If the file is not obtained, an acquisition failure message is returned to the edge node that initiated the file download request. The acquisition failure message is used to instruct the edge node that initiated the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
[0123] Specifically, since the local end also acts as an edge node in the edge storage cluster, the local end may also receive file download requests sent by the remaining edge nodes. In order to facilitate the local end to find the corresponding file in the edge storage directory of the local end when receiving the file download request, the local end metadata may also include edge file information corresponding to the file stored in the edge storage directory of the local end, and the edge file information may include an edge storage address to characterize the specific storage location of the file in the edge storage directory.
[0124] Therefore, when the local end receives a file download request, the corresponding edge storage address can be obtained in the edge file information according to the file identifier in the file download request. According to the edge storage address, the corresponding file is obtained in the edge storage directory of the local end and distributed to the edge node that initiated the file download request. It is understandable that due to reasons such as accidental deletion, the corresponding file may not be found in the edge storage directory of the local end. At this time, a failed acquisition message can be returned to indicate that the edge node that initiated the file download request downloads the file through another edge node.
[0125] In addition, as can be seen from the previous content, if the file is not downloaded through the edge storage cluster, it can also be downloaded through the cloud. Therefore, the cloud storage address in the edge file information can be used to assist in downloading files from the cloud. Specifically, when this end returns a failed acquisition message to the edge node that initiated the file download request, it can carry the cloud storage address corresponding to the file to be distributed, so that the corresponding edge node can download the file through the cloud if the file cannot be downloaded through the edge storage cluster.
[0126] It should be noted that, in addition to edge node list information and edge file information, metadata may also include other information, such as the current edge node name, the local edge node name (which may be the teacher's edge node name), and the address information of all edge nodes. The specific storage content of metadata may be as follows: Figure 6 As shown, Figure 6 Each field in can be used to store a content of metadata. The data structure of metadata can be referred to as follows Figure 7 The code shown in Figure 7 In the figure, nodeName represents the name of the current edge node, teacherNodeName represents the name of the teacher-side edge node, nodeAddressMap represents the address information of all edge nodes, curNodeFileInfo represents the edge file information, and fileAllNodeMap represents the edge node list information.
[0127] In the above embodiment, the metadata may also include edge file information. The edge storage address in the edge file information may represent the storage location of the file in the edge storage directory of the local end, and the cloud storage address may represent the storage location of the file in the cloud. Through the edge storage address, the local end may obtain the files stored in the edge storage directory and distribute them to the edge node that initiates the file download request. If the file is not obtained, the local end may return an acquisition failure message to the edge node that initiates the file download request to instruct the edge node that initiates the file download request to download the file from another edge node. In addition, if the file cannot be downloaded through the edge storage cluster, the file can also be downloaded through the cloud based on the cloud storage address. Through the above multiple processes, the stability of file distribution can be improved.
[0128] The above process mainly uses the local terminal as the execution subject to illustrate the file distribution method provided by the embodiment of the present application. Figure 8 , provides a file distribution method. This method is applied to Figure 1 Taking the client 102 in the example as an example, the method provided in the embodiment of the present application includes the following steps:
[0129] 802. Obtain a file download instruction sent by the local end, where the file download instruction includes a file identifier corresponding to the file to be downloaded.
[0130] 804. Select an edge node as a download source in the edge storage cluster according to the file identifier, and download the file based on the selected edge node.
[0131] It is understandable that for a file to be downloaded, there may be edge storage directories of multiple edge nodes in the edge storage cluster storing the file, so that one of the edge nodes can be selected to download the file.
[0132] 806. If the file is not downloaded through the edge storage cluster, download the file through the cloud.
[0133] As can be seen from the previous content, the file may not be downloaded through the edge storage cluster, so the client can download the file through the cloud.
[0134] In the above file distribution method, the local end sends a file download instruction carrying a file identifier to the client. Based on the file identifier, the client can find which edge nodes in the edge storage cluster store the file and download the file through the edge node storing the file.
[0135] Since the client does not need to download files through the public network, but downloads files through the corresponding local area network of the edge storage cluster, it can improve the situation where the public network bandwidth is occupied when there are many file download requests. At the same time, even abnormal files on the public network can still be distributed normally, which can improve the stability of file distribution. In addition, although downloading files through the edge storage cluster also uses the local area network to download files, when downloading files, not all clients download files from the local end. Instead, both the local end and the client act as edge nodes, and the client selects an edge node from all edge nodes based on the file identifier, and downloads the file through the selected edge node. In this way, the distribution pressure caused by all clients downloading files from the local end can be reduced. Finally, even if the client fails to download the file through the edge storage cluster, it can still download the file through the cloud. Through the synergy between cloud services and edge storage services, the stability of file distribution can be further improved.
[0136] In some embodiments, according to the file identifier, selecting an edge node as a download source in the edge storage cluster, and downloading the file based on the selected edge node includes:
[0137] Obtain client metadata corresponding to the client, where the client metadata includes edge node list information corresponding to each file stored in the edge storage cluster, where the edge node list information is used to represent edge nodes storing corresponding files;
[0138] According to the busyness of each edge node in the edge node list information corresponding to the file, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded through the edge node as the download source;
[0139] When receiving an acquisition failure message returned by the edge node as the download source, an edge node as the download source is reselected in the edge storage cluster to download the file.
[0140] Specifically, the relevant description of the metadata can refer to the previous content, which will not be repeated here. The busyness of each edge node in the edge node list information can be characterized by the resource ratio. For example, it can be characterized by the network resource ratio or the processing resource ratio. The higher the ratio, the higher the busyness. In actual implementation, when selecting an edge node as a download source, you can select an edge node with a lower busyness, such as the edge node with the lowest busyness. The embodiment of the present application does not specifically limit this. Reselect the edge node as the download source in the edge storage cluster, and you can select the edge node with the second lowest busyness. The subsequent reselection process is analogous.
[0141] In the above embodiment, each edge node may correspond to its own metadata, and the metadata may be used to describe the file status stored in the edge storage cluster, and the edge node list information in the metadata may be used as global information to characterize which edge nodes store each file. The client may select and download the file through the edge node storing the file according to the edge node list information in the metadata and the busyness of the edge node. Since the edge node can be selected according to the busyness, the download efficiency when downloading files can be improved. In addition, in the case of failure to download through the selected edge node, the edge node may be reselected to download the file, thereby improving the stability when distributing files.
[0142] In some embodiments, the client metadata further includes edge file information corresponding to each file stored in the edge storage directory of the client, the edge file information including the edge storage address and the cloud storage address of the file; the method further includes:
[0143] When receiving a file download request from an edge node in the edge storage cluster, obtaining a corresponding edge storage address in the edge file information according to a file identifier in the file download request;
[0144] According to the edge storage address, the corresponding file is obtained in the edge storage directory of the client, and if obtained, the corresponding file is distributed to the edge node that initiates the file download request;
[0145] If the file is not obtained, an acquisition failure message is returned to the edge node that initiated the file download request. The acquisition failure message is used to instruct the edge node that initiated the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
[0146] Specifically, referring to the above content, the client as an edge node may receive the file download request sent by the remaining edge nodes. The specific implementation process can refer to the relevant description when the client is used as the download source, which will not be repeated here.
[0147] In the above embodiment, the metadata may also include edge file information. The edge storage address in the edge file information may represent the storage location of the file in the edge storage directory of the client, and the cloud storage address may represent the storage location of the file in the cloud. Through the edge storage address, the client can obtain the files stored in the edge storage directory and distribute them to the edge node that initiates the file download request. If the file is not obtained, the client may return a failed acquisition message to the edge node that initiates the file download request to instruct the edge node that initiates the file download request to download the file from another edge node. In addition, if the file cannot be downloaded through the edge storage cluster, the file can also be downloaded through the cloud based on the cloud storage address. Through the above multiple processes, the stability of file distribution can be improved.
[0148] For ease of understanding, the interactive activity involved in the embodiment of the present application is online teaching, the terminal is the teacher terminal, and the client is the student terminal. Fig. 9 , the specific implementation can be shown in the following process steps:
[0149] 902. The teacher terminal starts teaching and obtains the address information of all student terminals in the electronic classroom. The teacher terminal establishes a communication connection with each student terminal based on the address information of each student terminal, and sends the address information of all student terminals to each student terminal, so that communication connections are established between different student terminals.
[0150] The communication connection can be established through WebSocket technology. After the communication connection is established, the metadata of each edge node can also be initialized. Specifically, each edge node can read the metadata stored locally, and the teacher can synchronize the files in the cloud storage directory to the edge storage directory of the local end. At the same time, the metadata of different edge nodes can also be synchronized. The process of establishing communication connection and initializing metadata can be referred to Fig.10 , the system architecture based on communication connection can be referred to Fig.11 .
[0151] 904. If the teacher selects the file to be distributed through the corresponding list of the cloud storage directory and the corresponding file identifier does not exist in the edge storage directory of the teacher, the corresponding file can be downloaded from the cloud and edge stored; if the teacher selects the file to be distributed through the corresponding list based on the local storage directory and the corresponding file identifier does not exist in the edge storage directory of the teacher, the file can be obtained from the local storage directory, edge stored, and sent to the cloud for storage.
[0152] Among them, after the file is edge stored, the file identifier will exist in the edge storage directory on the teacher's side.
[0153] 906. If the file identifier exists in the edge storage directory of the teacher's end, a file download instruction carrying the file identifier may be sent to the client.
[0154] 908. The student terminal selects an edge node as a download source in the edge storage cluster according to the file identifier in the file download instruction, and downloads the file based on the selected edge node; if the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0155] In the above-mentioned file distribution method, the teacher end obtains the file identifier corresponding to the file to be distributed. If the file identifier does not exist in the edge storage directory of the teacher end, the teacher end performs edge storage for the file to be distributed, so that at least one edge node in the edge storage cluster formed by the teacher end and the student end stores the file to be distributed. On this basis, the teacher end sends a file download instruction carrying the file identifier to the student end, and the client can find which edge nodes in the edge storage cluster store the file based on the file identifier, and download the file through the edge node storing the file.
[0156] Since the student end does not need to download files through the public network, but downloads files through the corresponding local area network of the edge storage cluster, it can improve the situation where the public network bandwidth is occupied when there are many file download requests. At the same time, even if the public network abnormal files can still be distributed normally, the stability of file distribution can be improved. In addition, although the local area network is also used to download files through the edge storage cluster, when downloading files, not all student ends download files from this end. Instead, the teacher end and the student end are both edge nodes, and the student end selects an edge node from all edge nodes based on the file identifier, and downloads the file through the selected edge node. In this way, the distribution pressure caused by all student ends downloading files from the teacher end can be reduced. Finally, even if the student end fails to download the file through the edge storage cluster, it can still download the file through the cloud. Through the synergy between cloud services and edge storage services, the stability of file distribution can be further improved.
[0157] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0158] Based on the same inventive concept, the embodiment of the present application also provides a file distribution system, including a local end and a client end, where both the local end and the client end serve as edge nodes and form an edge storage cluster;
[0159] The local end is used to obtain the file identifier corresponding to the file to be distributed. If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier; if the file identifier exists in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target;
[0160] The client is used to select an edge node as a download source in the edge storage cluster according to the file identifier carried in the file download instruction, and download the file based on the selected edge node. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0161] Based on the same inventive concept, the embodiment of the present application also provides a file distribution device for implementing the file distribution method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more file distribution device embodiments provided below can refer to the limitations on the file distribution method above, and will not be repeated here.
[0162] In one embodiment, Fig.12 As shown, a local end is provided, where the local end and the client are both edge nodes and form an edge storage cluster. The local end includes: a first acquisition module 1202, a second acquisition module 1204 and a sending module 1206, wherein:
[0163] The first acquisition module 1202 is used to acquire a file identifier corresponding to a file to be distributed;
[0164] The second acquisition module 1204 is used to acquire the file according to the acquisition source of the file identifier when there is no file identifier in the edge storage directory of the local end, and edge store the file on the local end, and update the edge storage directory of the local end based on the file identifier;
[0165] The sending module 1206 is used to send a file download instruction carrying the file identifier to the client as the file distribution target when there is a file identifier in the edge storage directory of the local end. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0166] In some embodiments, the second acquisition module 1204 is also used to download files from the cloud when the file identifier is obtained based on the cloud storage directory; when the file identifier is obtained based on the local storage directory, obtain the file in the local storage directory and send the file to the cloud for backup storage by the cloud.
[0167] In some embodiments, the second acquisition module 1204 is further used to download files in the cloud storage directory to the local storage directory when the files in the edge storage directory of the local end are out of sync with the files in the cloud storage directory.
[0168] In some embodiments, there are multiple clients; the first acquisition module 1202 is also used to obtain the address information of each client, and establish a communication connection with the corresponding client based on each address information; the address information of each client is sent to each client, and the address information is used to indicate that different clients establish a communication connection with each other.
[0169] In some embodiments, the sending module 1206 is also used to obtain the local metadata corresponding to the local end, and the local metadata includes the edge node list information corresponding to each file stored in the edge storage cluster, and the edge node list information is used to characterize the edge nodes storing the corresponding files; when there is a file update in the edge storage directory of the local end, the edge node list information in the local metadata is updated, and the updated local metadata is synchronized to the edge nodes in the edge storage cluster.
[0170] In some embodiments, the metadata of the local end also includes edge file information corresponding to each file stored in the edge storage directory of the local end, and the edge file information includes the edge storage address and cloud storage address of the file; the sending module 1206 is also used to obtain the corresponding edge storage address in the edge file information according to the file identifier in the file download request when receiving a file download request from an edge node in the edge storage cluster; according to the edge storage address, obtain the corresponding file in the edge storage directory of the local end, and if the file is obtained, distribute the corresponding file to the edge node that initiates the file download request; if the file is not obtained, return a retrieval failure message to the edge node that initiates the file download request, and the retrieval failure message is used to instruct the edge node that initiates the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
[0171] In one embodiment, Fig.13 As shown, a client is provided, where both the local end and the client serve as edge nodes and form an edge storage cluster. The client includes: an acquisition module 1302, a first distribution module 1304 and a second distribution module 1306, wherein:
[0172] An acquisition module 1302 is used to acquire a file download instruction sent by the local end, where the file download instruction includes a file identifier corresponding to the file to be downloaded;
[0173] A first distribution module 1304 is used to select an edge node as a download source in the edge storage cluster according to the file identifier, and download the file based on the selected edge node;
[0174] The second distribution module 1306 is configured to download the file through the cloud if the file is not downloaded through the edge storage cluster.
[0175] In some embodiments, the first distribution module 1304 is used to obtain client metadata corresponding to the client, the client metadata includes edge node list information corresponding to each file stored in the edge storage cluster, the edge node list information is used to characterize the edge nodes storing the corresponding files; according to the busyness of each edge node in the edge node list information corresponding to the file, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded through the edge node as the download source; in the case of receiving an acquisition failure message returned by the edge node as the download source, an edge node as the download source is re-selected in the edge storage cluster to download the file.
[0176] In some embodiments, the client metadata also includes edge file information corresponding to each file stored in the edge storage directory of the client, and the edge file information includes the edge storage address and cloud storage address of the file; the first distribution module 1304 is also used to, when receiving a file download request from an edge node in the edge storage cluster, obtain the corresponding edge storage address in the edge file information according to the file identifier in the file download request; according to the edge storage address, obtain the corresponding file in the edge storage directory of the client, and if the file is obtained, distribute the corresponding file to the edge node that initiates the file download request; if the file is not obtained, return a retrieval failure message to the edge node that initiates the file download request, and the retrieval failure message is used to instruct the edge node that initiates the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
[0177] In the above local end and client, the local end obtains the file identifier corresponding to the file to be distributed. When the file identifier does not exist in the edge storage directory of the local end, the file to be distributed is edge stored by the local end, so that at least one edge node in the edge storage cluster formed by the local end and the client stores the file to be distributed. On this basis, the local end sends a file download instruction carrying the file identifier to the client, and the client can find which edge nodes in the edge storage cluster store the file based on the file identifier, and download the file through the edge node storing the file.
[0178] Since the client does not need to download files through the public network, but downloads files through the corresponding local area network of the edge storage cluster, it can improve the situation where the public network bandwidth is occupied when there are many file download requests. At the same time, even abnormal files on the public network can still be distributed normally, which can improve the stability of file distribution. In addition, although downloading files through the edge storage cluster also uses the local area network to download files, when downloading files, not all clients download files from the local end. Instead, both the local end and the client act as edge nodes, and the client selects an edge node from all edge nodes based on the file identifier, and downloads the file through the selected edge node. In this way, the distribution pressure caused by all clients downloading files from the local end can be reduced. Finally, even if the client fails to download the file through the edge storage cluster, it can still download the file through the cloud. Through the synergy between cloud services and edge storage services, the stability of file distribution can be further improved.
[0179] For the specific definition of the local terminal and the client terminal, please refer to the definition of the file distribution method above, which will not be repeated here. Each module in the above-mentioned file distribution device can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0180] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.14As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a file distribution method is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0181] Those skilled in the art will understand that Fig.14 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0182] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0183] Get the file identifier corresponding to the file to be distributed;
[0184] If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier;
[0185] If there is a file identifier in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0186] Alternatively, implement the following steps:
[0187] Obtaining a file download instruction sent by the local end, the file download instruction including a file identifier corresponding to the file to be downloaded;
[0188] According to the file identifier, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded based on the selected edge node;
[0189] If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0190] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0191] Get the file identifier corresponding to the file to be distributed;
[0192] If the file identifier does not exist in the edge storage directory of the local end, the file is obtained according to the acquisition source of the file identifier, and the file is edge stored in the local end, and the edge storage directory of the local end is updated based on the file identifier;
[0193] If there is a file identifier in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client as the file distribution target. The file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0194] Alternatively, implement the following steps:
[0195] Obtaining a file download instruction sent by the local end, the file download instruction including a file identifier corresponding to the file to be downloaded;
[0196] According to the file identifier, an edge node as a download source is selected in the edge storage cluster, and the file is downloaded based on the selected edge node;
[0197] If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
[0198] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0199] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0200] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0201] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A file distribution method, characterized in that: Applied to the local end, the local end and the client both serve as edge nodes and form an edge storage cluster; the method includes: Get the file identifier corresponding to the file to be distributed; If the file identifier does not exist in the edge storage directory of the local end, obtain the file according to the acquisition source of the file identifier, edge store the file on the local end, and update the edge storage directory of the local end based on the file identifier; In the case where the file identifier exists in the edge storage directory of the local end, a file download instruction carrying the file identifier is sent to the client serving as the file distribution target, and the file download instruction is used to instruct the client to download the file through the edge node in the edge storage cluster based on the file identifier. If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
2. The method according to claim 1, characterized in that The step of acquiring the file according to the acquisition source of the file identifier includes: In a case where the file identifier is obtained based on a cloud storage directory, downloading the file from the cloud; In the case where the file identifier is obtained based on the local storage directory, the file is obtained in the local storage directory and sent to the cloud for backup storage by the cloud.
3. The method according to claim 2, characterized in that The method further comprises: When the files in the edge storage directory of the local end are out of sync with the files in the cloud storage directory, the files in the cloud storage directory are downloaded to the local storage directory.
4. The method according to claim 1, characterized in that: The number of the client terminals is multiple; before the file download instruction carrying the file identifier is sent to the client terminal as the file distribution target, the method further includes: Acquire address information of each client, and establish a communication connection with the corresponding client based on each address information; The address information of each client is sent to each client, where the address information is used to indicate that different clients establish communication connections with each other.
5. The method according to claim 1, characterized in that: The method further comprises: Acquire local metadata corresponding to the local end, wherein the local metadata includes edge node list information corresponding to each file stored in the edge storage cluster, and the edge node list information is used to represent the edge node storing the corresponding file; When there is a file update in the edge storage directory of the local end, the edge node list information in the local metadata is updated, and the updated local metadata is synchronized to the edge nodes in the edge storage cluster.
6. The method according to claim 5, characterized in that The local metadata also includes edge file information corresponding to each file stored in the edge storage directory of the local end, and the edge file information includes the edge storage address and cloud storage address of the file; the method also includes: When receiving a file download request from an edge node in the edge storage cluster, obtaining a corresponding edge storage address in the edge file information according to a file identifier in the file download request; According to the edge storage address, obtain the corresponding file in the edge storage directory of the local end, and if obtained, distribute the corresponding file to the edge node that initiates the file download request; If the file is not obtained, an acquisition failure message is returned to the edge node that initiated the file download request, and the acquisition failure message is used to instruct the edge node that initiated the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
7. A file distribution method, characterized in that: Applied to a client, the client and the local end are both edge nodes and form an edge storage cluster; the method includes: Obtaining a file download instruction sent by the local end, wherein the file download instruction includes a file identifier corresponding to a file to be downloaded; According to the file identifier, selecting an edge node as a download source in the edge storage cluster, and downloading the file based on the selected edge node; If the file is not downloaded through the edge storage cluster, the file is downloaded through the cloud.
8. The method according to claim 7, characterized in that The step of selecting an edge node as a download source in the edge storage cluster according to the file identifier, and downloading the file based on the selected edge node includes: Acquire client metadata corresponding to the client, wherein the client metadata includes edge node list information corresponding to each file stored in the edge storage cluster, and the edge node list information is used to represent edge nodes storing corresponding files; According to the busyness of each edge node in the edge node list information corresponding to the file, select an edge node as a download source in the edge storage cluster, and download the file through the edge node as the download source; When receiving an acquisition failure message returned by the edge node as the download source, an edge node as the download source is reselected in the edge storage cluster to download the file.
9. The method according to claim 8, characterized in that The client metadata also includes edge file information corresponding to each file stored in the edge storage directory of the client, and the edge file information includes an edge storage address and a cloud storage address of the file; the method also includes: When receiving a file download request from an edge node in the edge storage cluster, obtaining a corresponding edge storage address in the edge file information according to a file identifier in the file download request; According to the edge storage address, obtain the corresponding file in the edge storage directory of the client, and if obtained, distribute the corresponding file to the edge node that initiates the file download request; If the file is not obtained, an acquisition failure message is returned to the edge node that initiated the file download request, and the acquisition failure message is used to instruct the edge node that initiated the file download request to download the corresponding file through the remaining edge nodes in the edge storage cluster.
10. A file distribution system, characterized in that: include: The local end and the client end, both of which serve as edge nodes and form an edge storage cluster; The local end is used to obtain a file identifier corresponding to a file to be distributed, and if the file identifier does not exist in the edge storage directory of the local end, obtain the file according to the acquisition source of the file identifier, and edge store the file on the local end, and update the edge storage directory of the local end based on the file identifier; if the file identifier exists in the edge storage directory of the local end, send a file download instruction carrying the file identifier to a client that is a file distribution target; The client is used to select an edge node as a download source in the edge storage cluster according to the file identifier carried in the file download instruction, and download the file based on the selected edge node, and download the file through the cloud if the file is not downloaded through the edge storage cluster.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.