WO2018177333A1 - 镜像分发方法、镜像获取方法及装置 - Google Patents

镜像分发方法、镜像获取方法及装置 Download PDF

Info

Publication number
WO2018177333A1
WO2018177333A1 PCT/CN2018/080944 CN2018080944W WO2018177333A1 WO 2018177333 A1 WO2018177333 A1 WO 2018177333A1 CN 2018080944 W CN2018080944 W CN 2018080944W WO 2018177333 A1 WO2018177333 A1 WO 2018177333A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
ipfs
metadata
identifier
node device
Prior art date
Application number
PCT/CN2018/080944
Other languages
English (en)
French (fr)
Inventor
谢可杨
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP18777174.6A priority Critical patent/EP3591940B1/en
Publication of WO2018177333A1 publication Critical patent/WO2018177333A1/zh
Priority to US16/589,729 priority patent/US11388220B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3297Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving time stamps, e.g. generation of time stamps
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the present disclosure relates to the field of network technologies, and in particular, to a mirror distribution method, a mirror acquisition method, and an apparatus.
  • a distributed file system is a system that can manage massive amounts of data.
  • a distributed file system can deploy applications for multiple node devices within a system.
  • the distributed file system can build the container on each node device.
  • the container can provide an isolated running environment for the application.
  • the distributed file system needs to distribute the collection of user state files required for the container to run, that is, The image of the container is distributed.
  • the current distributed file system includes a central repository server, a controller, a tracker, a plurality of node device agents, and a plurality of node devices for providing mirrored storage services, wherein the controller is configured to perform data interaction with the central repository server, and Manage multiple node device agents for image distribution; the tracker is used to track the image download status of each node device, each node device agent corresponds to one node device, and manages the mirror download of the corresponding node device.
  • the image distribution process specifically includes:
  • the controller downloads the image from the central repository server to the local mirror warehouse of the controller, and delivers the mirrored download task to each node device agent.
  • the node device agent checks whether the mirror layer does not exist on all node devices by calling the tracker for each mirror layer of the image. If yes, the node device agent invokes the node device managed by itself. Downloading the mirroring layer from the local mirroring warehouse of the controller. If not, the node device can be called to download the mirroring layer from the node device that has already stored the mirroring layer. After the downloading is completed, the node device can serve as a node. The node device is distributed to provide downloading of the mirror layer for other node devices.
  • the controller needs to download the image from the central warehouse server and distribute it to each node device, and the multi-layer control of the controller and the node device agent can realize the image distribution of the plurality of node devices, and the distribution efficiency is low.
  • the embodiments of the present disclosure provide a mirroring distribution method, a mirroring method, and an apparatus, which can solve the problem of low efficiency of prior art distribution.
  • the technical solution is as follows:
  • a method for image distribution comprising: generating, according to a plurality of block data of a first image, an interstellar file system IPFS metadata of the first image and an IPFS metadata of the first image.
  • the identifier, the IPFS metadata of the first image includes a mirror image of the first image, a name of the node device, and a name and address information of the plurality of block data of the first image, where the first image is
  • the IPFS metadata identifier is used to index the IPFS metadata of the first image; storing the plurality of block data of the first image to a storage location in the IPFS repository of the node device corresponding to the address information;
  • the first mirrored IPFS metadata identifier is added to the distributed hash table DHT of the distributed file system, and the DHT includes an IPFS metadata identifier of a mirror image issued by a plurality of node devices in the distributed file system.
  • the node device may locally build and store the image without relying on the central warehouse server, and generate an IPFS metadata identifier corresponding to the mirrored IPFS metadata according to the plurality of block data of the image.
  • the method of adding the IPFS metadata identifier to the DHT is implemented to implement the image distribution, so that other node devices can obtain the image based on the DHT. The whole process can be carried out between the node devices without the control of other devices, and the efficiency is high.
  • the adding the first mirrored IPFS metadata identifier to the DHT includes: receiving a publishing request for the first image, where the publishing request carries the first And obtaining an IPFS metadata identifier of the first image, and adding an IPFS metadata identifier of the first image to the DHT according to the mirrored identifier of the first image.
  • the node device may obtain the IPFS metadata identifier corresponding to the first mirrored IPFS metadata according to the image identifier of the first image carried by the publishing request, and add the IPFS metadata identifier to the DHT.
  • the way to achieve the release of the first image The node device only needs to add the IPFS metadata identifier of the first image to the DHT without releasing the block data of the first image, thereby reducing the transmission amount of the mirrored data and improving the utilization of the storage space, thereby reducing the entire system. s expenses.
  • the first mirrored IPFS metadata further includes version information of the first image
  • the storing the plurality of block data of the first image to the The storage location corresponding to the address information in the IPFS repository of the node device includes: determining, according to the mirror identifier of the first image, whether a second image exists in the IPFS repository of the node device, where the second image is The image identifier is the same as the image identifier of the first image; if the second image is present and the version information of the second image is different from the version information of the first image, the plurality of the first image is The block data is stored to a storage location in the IPFS repository of the node device that corresponds to the address information.
  • the node device may store the first image of the new version into the IPFS repository of the node device, so as to implement the update of the original mirrored version of the same name.
  • the generating the IPFS metadata identifier of the first image includes:
  • the node device may generate an IPFS metadata identifier of the first image by using a mirroring service custom encoding and hash encoding, and provide a manner for generating an IPFS metadata identifier.
  • a method for obtaining a mirror image includes: receiving a request for acquiring a first image, where the obtaining request carries a mirror image of the first image; and according to a mirror image of the first image, Determining whether there is an IPFS metadata identifier of the first image in the DHT, where the DHT includes an IPFS metadata identifier of a mirror image published by a plurality of node devices in the distributed file system, where the IPFS metadata identifier of the first image is used for Indexing the IPFS metadata of the first image; if the IPFS metadata identifier of the first image is present, acquiring the IPFS metadata corresponding to the IPFS metadata identifier of the first image; and the IPFS according to the first image Metadata, obtaining the first image.
  • the node device may initiate an acquisition request for the first image, obtain the IPFS metadata corresponding to the IPFS metadata identifier of the first image based on the DHT, and release the first according to the IPFS metadata.
  • a mirrored node device obtains the first image to the local.
  • the acquisition of the image may be triggered by the node device actively initiating the acquisition request, and the acquisition of the image may be performed between the node devices without the control of other devices, and the efficiency is high.
  • the determining, according to the image identifier of the first image, whether the IPFS metadata identifier of the first image exists in the DHT includes: The image ID of the first image is obtained by the mirroring service, and the IPFS metadata identifier of the first image is obtained.
  • the node device may obtain the IPFS metadata identifier of the first image by using the hash code and the mirroring service to obtain the IPFS metadata identifier of the first image, and determine whether the IPFS metadata identifier of the first image exists in the DHT.
  • the acquiring the IPFS metadata corresponding to the IPFS metadata identifier of the first image includes: sending an acquisition request to the DHT, where the obtaining request is used to acquire The IPFS metadata corresponding to the IPFS metadata identifier of the first image is queried by the DHT from a plurality of node devices in the distributed file system, and the IPFS metadata of the first image is obtained; and the request result returned by the DHT is received.
  • the request result carries the IPFS metadata of the first image.
  • the node device may send an acquisition request to the DHT according to the IPFS metadata identifier of the first image, and return, by the DHT, the IPFS metadata corresponding to the IPFS metadata identifier of the first image, providing a The way to obtain IPFS metadata based on the IPFS metadata identifier.
  • the obtaining, according to the IPFS metadata of the first image, the acquiring the first image comprises: according to the first part of the IPFS metadata of the first image Obtaining, by the node device where the first image is located, the plurality of block data of the first image, according to the name of the node device and the address information of the plurality of block data of the first image, according to the first image Determining, by the plurality of block data, the first image; or determining target block data according to the name of the plurality of block data of the first image included in the IPFS metadata of the first image, and according to the first The name of the node device where the first image is located and the address information of the target block data included in the mirrored IPFS metadata, and the target block data is acquired from the node device where the first image is located, and according to the target block Obtaining, by the data, the block data of the first image that is already in the IPFS repository of the node device, where the target block data is not present in the pluralit
  • the node device may acquire all block data of the first image from other node devices according to the IPFS metadata of the first image, and obtain a complete first image according to the block data, or may The other node device obtains the partial block data of the first image, and obtains the complete first image according to the partial block data and another partial block data that the node device has stored, and provides a plurality of IPFS metadata according to the first image. The way to get the first image.
  • a mirror image distribution apparatus comprising a plurality of function modules, the plurality of function modules being configured to perform the image distribution method provided by the first aspect, and any possible implementation thereof.
  • a fourth aspect provides a mirroring acquiring device, where the device includes a plurality of functional modules, and the plurality of functional modules are configured to perform the image capturing method provided by the second aspect and any possible implementation manner thereof.
  • a node device in a fifth aspect, includes: a processor; a memory for storing processor-executable instructions; and the executable instructions are configured to: perform, according to the plurality of block data of the first image, Generating the interpreter file system IPFS metadata of the first image and the IPFS metadata identifier of the first image, where the IPFS metadata of the first image includes a mirror image of the first image, and a name of the node device Name and address information of the plurality of block data of the first image, the IPFS metadata identifier of the first image is used to index IPFS metadata of the first image; and multiple blocks of the first image are Data is stored in a storage location of the IPFS repository of the node device corresponding to the address information; adding the IPFS metadata identifier of the first image to a distributed hash table DHT of the distributed file system, the DHT The IPFS metadata identifier of the image published by the multiple node devices in the distributed file system is included.
  • the executable instruction is configured to: receive a publishing request for the first image, the publishing request carries a mirror image of the first image; and according to the image of the first image Identifying, acquiring an IPFS metadata identifier of the first image, and adding an IPFS metadata identifier of the first image to the DHT.
  • the executable instruction is configured to: determine, according to the mirror identifier of the first image, whether a second image exists in an IPFS repository of the node device, and the mirror image of the second image The identifier is the same as the mirror image of the first image; if the second image is present and the version information of the second image is different from the version information of the first image, the plurality of blocks of the first image are The data is stored to a storage location in the IPFS repository of the node device that corresponds to the address information.
  • the executable instruction is configured to: perform mirroring service custom encoding and hash encoding on the mirror image of the first image to obtain an IPFS metadata identifier of the first image.
  • a node device includes: a processor; a memory for storing processor-executable instructions; and the executable instruction is configured to: receive an acquisition request for the first image, where The obtaining request carries the image identifier of the first image; determining, according to the image identifier of the first image, whether the IPFS metadata identifier of the first image exists in the DHT, where the DHT includes multiple The IPFS metadata identifier of the mirror image issued by the node device, the IPFS metadata identifier of the first image is used to index the IPFS metadata of the first image; if the IPFS metadata identifier of the first image exists, the The IPFS metadata corresponding to the IPFS metadata of the first image is obtained; and the first image is obtained according to the IPFS metadata of the first image.
  • the mirroring service of the first image is encoded by a custom code and a hash code to obtain an IPFS metadata identifier of the first image; and determining whether the DHT exists in the DHT.
  • a mirrored IPFS metadata identifier is encoded by a custom code and a hash code to obtain an IPFS metadata identifier of the first image; and determining whether the DHT exists in the DHT.
  • the executable instruction is configured to: send an acquisition request to the DHT, where the obtaining request is used to acquire IPFS metadata corresponding to the IPFS metadata identifier of the first image,
  • the DHT queries and acquires the IPFS metadata of the first image from multiple node devices in the distributed file system, and receives the result of the request returned by the DHT, where the request result carries the IPFS metadata of the first image.
  • the executable instruction is configured to: perform, according to the IPFS metadata of the first image, a name of a node device where the first image is located, and multiple blocks of the first image Acquiring, by the node device where the first image is located, the plurality of block data of the first image, and acquiring the first image according to the plurality of block data of the first image; or, according to the The name of the plurality of block data of the first image included in the mirrored IPFS metadata, determining the target block data, and according to the node device where the first mirror is included according to the IPFS metadata of the first image And the address information of the target block data, the target block data is obtained from the node device where the first image is located, and according to the target block data and the first one already existing in the IPFS repository of the node device
  • the mirrored block data acquires the first image, and the target block data is block data of the plurality of block data of the first image that is not present in the IPFS warehouse of the node device.
  • a seventh aspect a computer readable storage medium having stored therein executable instructions loaded by a processor and executed to implement the first aspect or the first aspect described above An image distribution method provided by any of the possible implementations.
  • a computer readable storage medium in which executable instructions are stored, which are loaded and executed by a processor to implement the second or second aspect described above
  • the image acquisition method provided by any of the possible implementations.
  • FIG. 1 is a schematic structural diagram of a distributed file system according to an embodiment of the present disclosure
  • FIG. 2 is a schematic structural diagram of a node device 101 according to an embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of a node device 300 according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic flowchart of a mirror image distribution method according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of a mirroring construction process according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of a mirroring release process according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of a mirroring distribution process according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of a node device according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a mirror image distribution apparatus according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram of a storage module 902 according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of a mirror image acquiring apparatus according to an embodiment of the present disclosure.
  • FIG. 1 is a schematic structural diagram of a distributed file system according to an embodiment of the present disclosure.
  • the distributed file system includes at least two node devices, such as a first node device 101 and a second node device 102.
  • the first and second are used for description purposes only, and are not used to indicate the relative importance of the node devices. In fact, the status of each node device is equal, that is, each node device can achieve the same function.
  • Each node device of the distributed file system shares the Bit Torrent protocol and implements data transmission between the node devices based on the bit stream protocol.
  • any of the node devices in the distributed file system can be implemented by a physical device, such as a computer, a mobile terminal, or a server.
  • Each node device can include multiple functional modules to provide multiple services.
  • the first node device 101 may include a running container service module, a warehouse service module, and an InterPlanetary File System (IPFS) repository.
  • IPFS InterPlanetary File System
  • the container service module can construct a mirror and provide a container service, for example, initiate a service request, including initiating a storage mirror data request, issuing a mirror request, and obtaining a mirror request; the warehouse service module can undertake the service of the container service module, and provide the mirror warehouse by using IPFS. Services, such as receiving and processing business requests initiated by the container service module; IPFS repositories can provide IPFS services, including distributed storage and distribution services, such as storing mirrored data, including metadata and block data for storage images.
  • the request can be communicated between the container service module, the warehouse service module, and the IPFS repository.
  • the request can be a HyperText Transfer Protocol (HTTP) request.
  • HTTP HyperText Transfer Protocol
  • the steps performed by the node device may actually be performed in cooperation by one or more functional modules of the node device, as will be described in the steps of subsequent embodiments.
  • FIG. 3 is a schematic structural diagram of a node device 300 according to an embodiment of the present disclosure.
  • the node device may be used to perform the image distribution method provided in the following embodiments.
  • the node device 300 includes:
  • the node device 300 can include a radio frequency (RF) circuit 110, a memory 120 including one or more computer readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, and wireless fidelity (Wireless).
  • RF radio frequency
  • a Fidelity, WiFi) module 170 a processor 180 including one or more processing cores, and a power supply 190 and the like.
  • FIG. 3 does not constitute a limitation to a node device, and may include more or fewer components than those illustrated, or some components may be combined, or different component arrangements. among them:
  • the RF circuit 110 can be used for transmitting and receiving information or during a call, and receiving and transmitting signals. Specifically, after receiving downlink information of the base station, the downlink information is processed by one or more processors 180. In addition, the data related to the uplink is sent to the base station. .
  • the RF circuit 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, and a Low Noise Amplifier (LNA). , duplexer, etc.
  • RF circuitry 110 can also communicate with the network and other devices via wireless communication.
  • Wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division Multiple) Access, CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • SMS Short Messaging Service
  • the memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by running software programs and modules stored in the memory 120.
  • the memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to The data created by the use of the node device 300 (such as audio data, phone book, etc.) and the like.
  • memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 120 may also include a memory controller to provide access to memory 120 by processor 180 and input unit 130.
  • the input unit 130 can be configured to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
  • input unit 130 can include touch-sensitive surface 131 as well as other input devices 132.
  • Touch-sensitive surface 131 also referred to as a touch display or trackpad, can collect touch operations on or near the user (such as a user using a finger, stylus, etc., on any suitable object or accessory on touch-sensitive surface 131 or The operation near the touch-sensitive surface 131) and driving the corresponding connecting device according to a preset program.
  • the touch-sensitive surface 131 can include two portions of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 180 is provided and can receive commands from the processor 180 and execute them.
  • the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 130 can also include other input devices 132.
  • other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • Display unit 140 can be used to display information entered by the user or information provided to the user and various graphical user interfaces of node device 300, which can be composed of graphics, text, icons, video, and any combination thereof.
  • the display unit 140 may include a display panel 141.
  • the display panel 141 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch-sensitive surface 131 may cover the display panel 141, and when the touch-sensitive surface 131 detects a touch operation thereon or nearby, it is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event The type provides a corresponding visual output on display panel 141.
  • touch-sensitive surface 131 and display panel 141 are implemented as two separate components to implement input and input functions, in some embodiments, touch-sensitive surface 131 can be integrated with display panel 141 for input. And output function.
  • Node device 300 may also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the node device 300 moves to the ear. And / or backlight.
  • the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • gesture of the mobile phone such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which can be configured by the node device 300, No longer.
  • the audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the node device 300.
  • the audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and then processed by the audio data output processor 180, sent to the other node device via the RF circuit 110, or outputted to the memory 120 for further processing.
  • the audio circuit 160 may also include an earbud jack to provide communication of the peripheral earphones with the node device 300.
  • WiFi is a short-range wireless transmission technology
  • the node device 300 can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 170, which provides wireless broadband Internet access for users.
  • FIG. 3 shows the WiFi module 170, it can be understood that it does not belong to the essential configuration of the node device 300, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 180 is the control center of the node device 300, connecting various portions of the entire handset with various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120.
  • the various functions and processing data of the node device 300 are executed to perform overall monitoring of the mobile phone.
  • the processor 180 may include one or more processing cores; optionally, the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, and an application. Etc.
  • the modem processor primarily handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 180.
  • the node device 300 further includes a power source 190 (such as a battery) for supplying power to the various components.
  • a power source 190 such as a battery
  • the power source can be logically connected to the processor 180 through the power management system to manage charging, discharging, and power management through the power management system.
  • Power supply 190 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
  • the node device 300 may further include a camera, a Bluetooth module, and the like, and details are not described herein again.
  • the display unit of the node device is a touch screen display
  • the node device further includes a memory, and executable instructions, wherein the executable instructions are stored in the memory and configured to be executed by one or more processors.
  • the executable instructions are used to perform the node device side method in the embodiment shown in FIG. 4 described below.
  • a computer readable storage medium such as a memory storing executable instructions executable by a processor and executed to perform the mirroring in the embodiment of FIG. 4 described below Distribution method.
  • the computer readable storage medium may be a read-only memory (ROM), a random-access memory (RAM), a compact disc read-only memory (CD-ROM), Tapes, floppy disks, and optical data storage devices.
  • FIG. 4 is a schematic flowchart diagram of a mirror image distribution method according to an embodiment of the present disclosure.
  • the image distribution method is applied to a distributed file system, and the distributed file system includes at least two node devices.
  • the first node device and the second node device are taken as an example for description.
  • the image distribution method may include:
  • the first node device constructs a first image.
  • the first node device may be any node device in the distributed file system, and the first node device may construct a new image during the running process. This new image is the first image in step 401.
  • the mirror image data of the first image may include a form file, a configuration file, and a mirror layer file, wherein the form file is used to record the configuration file and the mirror layer file information of the first image; the configuration file (config) is used for recording the first file.
  • the information of a mirror runtime and the dependencies between mirror layers; the layer files are the application data of the first image, and the collection of mirror layers constitutes the complete first image.
  • the mirror data of the first mirrors described above can be processed as the block data of the first mirror.
  • the construction of the first image may actually be completed by the container service module in the first node device.
  • a data storage request may be initiated through the build interface to request storage of the plurality of block data of the first image into the IPFS repository.
  • the first node device may publish the first image to the distributed file system. Considering that the data volume of the plurality of block data of the first image is large, in order to reduce the amount of data to be distributed, the first node device may generate related data with a small amount of data according to the plurality of block data of the first image, and The related data is published to the distributed file system, so that other node devices can obtain the first image according to the related data.
  • the first node device generates the IPFS metadata of the first image and the IPFS metadata identifier of the first image according to the plurality of block data of the first image, where the IPFS metadata of the first image includes the first image.
  • the image identifier, the name of the first node device, the name and address information of the plurality of block data of the first image, and the IPFS metadata identifier of the first image is used to index the IPFS metadata of the first image.
  • the image identifier may be a mirror name, a mirror number, or the like.
  • the image name may be an image file name or an image file name abbreviation
  • the image number may be a string composed of letters or numbers.
  • the IPFS repository has a specified data structure organization specification, such as the Merkle Database Availability Group (DAG) specification.
  • DAG Merkle Database Availability Group
  • the generated related data conforms to the data structure organization specification of the IPFS warehouse.
  • the generating process of the related data may include: the first node device may organize the plurality of block data of the first image according to the Merkle DAG algorithm, and generate IPFS metadata of the first image conforming to the data structure organization specification of the IPFS warehouse, and the The first mirrored IPFS metadata is used as the related data.
  • This IPFS metadata can be used to describe IPFS objects.
  • the first node device can also generate the first IPFS metadata of the first image.
  • the mirrored IPFS metadata identifier may perform image service custom coding and hash coding on the mirror image identifier of the first image to obtain an IPFS metadata identifier of the first image.
  • the address information of the plurality of block data of the first image included in the IPFS metadata of the first image may be indirect address information, for example, a hash value of the plurality of block data.
  • the hash value of the plurality of block data can be generated during the construction of the first image.
  • the storage location of the block data at the first node device may be determined according to the hash value of the block data.
  • the IPFS metadata of the first image includes the image identifier of the first image, the name of the first node device, and the name and address information of the plurality of block data of the first image.
  • the IPFS metadata of the first image may further include version information of the first image.
  • the generation of the IPFS metadata and the IPFS metadata identifier of the first image may be actually performed by the warehouse service module in the first node device, that is, the warehouse service module receives the container service module initiated. After the data storage request, the IPFS metadata of the first image and the IPFS metadata identifier of the first image may be generated according to the plurality of block data of the first image.
  • the first node device stores the plurality of block data of the first image to a storage location corresponding to the address information in the IPFS repository of the first node device.
  • the first node device may store the plurality of block data to a storage location in the IPFS repository corresponding to the address information of the plurality of block data, In a possible implementation manner, for each block data, the first node device may determine, according to the hash value of the block data, a storage location of the block data in the first node device.
  • the first node device may also store the first mirrored IPFS metadata and the IPFS metadata identifier while storing the plurality of block data of the first image.
  • the first node device may store the IPFS metadata and the IPFS metadata identifier in a piece of local storage space accessible by the IPFS service according to an organization principle of the local database.
  • the first node device may store the IPFS metadata and the IPFS metadata identifier in the correspondence relationship record table.
  • the corresponding node record table may be maintained in the IPFS repository of the first node device.
  • the relationship record table is used to record the correspondence between the mirrored IPFS metadata identifier and the IPFS metadata.
  • the IPFS metadata of the first image may also include the version information of the first image in step 402.
  • the step 403 may include: determining, by the first node device, the IPFS repository of the first node device according to the mirror image identifier of the first image. Whether the second image is already in existence, and the image identifier of the second image is the same as the image identifier of the first image; if the second image is present and the version information of the second image is different from the version information of the first image, The plurality of block data of the first image is stored to a storage location in the IPFS repository of the first node device corresponding to the address information.
  • the first node device may store the first image of the new version into the IPFS repository of the first node device, thereby implementing an update of the original mirrored version of the same name.
  • the storage of the first mirrored IPFS metadata, the first mirrored plurality of block data, and the first mirrored IPFS metadata identifier may be actually completed by the warehouse service module in the first node device.
  • Steps 401 to 403 are processes in which the first node device constructs the first image and stores the first image.
  • the first node device adds the IPFS metadata identifier of the first image to a distributed hash table (DHT) of the distributed file system, where the DHT includes a mirror image of multiple node devices in the distributed file system. IPFS metadata identifier.
  • DHT distributed hash table
  • the IPFS metadata or the first image of the first image is sent to the DWT by adding the IPFS metadata identifier of the first image to the DHT.
  • the purpose of the distributed file system is that, when the other node device needs to acquire the first image, the IPFS metadata identifier of the first image in the DHT can be used to obtain the first corresponding to the IPFS metadata identifier of the first image.
  • a mirrored IPFS metadata to obtain a complete first image.
  • the step 404 can be actually completed by the warehouse service module of the first node device. Accordingly, the step 404 can include the following steps a to b:
  • a. Receive a publishing request for the first image, where the publishing request carries the image identifier of the first image.
  • the container service module in the first node device may generate a publishing request for the first image, and send the request to the warehouse service module through the publishing interface of the container service module, and the warehouse service module receives the Publish the request.
  • the IPFS metadata identifier of the first image corresponding to the first mirrored IPFS metadata, and the IPFS metadata of the first image is obtained from the local storage space of the first node device.
  • the logo is added to the DHT.
  • the first node device locally stores the IPFS metadata of the first image and the corresponding IPFS metadata identifier, where the IPFS metadata of the first image includes the image identifier of the first image.
  • the first node device may obtain the IPFS metadata of the first image that includes the image identifier of the first image according to the image identifier of the first image, and obtain the IPFS metadata identifier of the first image.
  • the first node device may obtain, from the correspondence relationship record table, an IPFS metadata identifier of the first image corresponding to the first mirrored IPFS metadata.
  • the warehouse service module may locally retrieve the image identifier of the first image carried in the publishing request, and locally obtain the first information from the first node device.
  • the mirrored IPFS metadata is identified, and the IPFS metadata identifier of the first image is added to the DHT to implement the release of the first image.
  • the first node device may send a release success message to the first node device to notify the first node device that the first image is successfully published.
  • the first node device adds the IPFS metadata identifier of the first image to the DHT to implement the issuance of the IPFS metadata or the first image of the first image, so that other nodes can pass the IPFS.
  • the metadata identifier retrieves and acquires the IPFS metadata of the first image, and obtains the complete first image. Since the block data of the first image does not need to be released, the transmission amount of the mirrored data can be reduced, and the utilization of the storage space is increased, thereby reducing the overhead of the entire system.
  • the above steps 401 to 404 are processes in which the first node device constructs, stores, and publishes the image. If the first node device does not publish the image after the image is built, the image can only be used by the first node device itself, and the image is used by the first node device. After the IPFS metadata identifier is advertised to the DHT, the other node can obtain the IPFS metadata of the mirror based on the IPFS metadata identifier of the mirror in the DHT, and obtain a complete image based on the IPFS metadata.
  • the second node device receives an acquisition request for the first image, where the acquisition request carries the image identifier of the first image.
  • the container service module in the second node device may generate an acquisition request for the first image, and send it to the warehouse service module in the second node device through the distribution interface of the container service module. Receiving the acquisition request by the warehouse service module.
  • the second node device determines, according to the mirroring identifier of the first image, whether the first mirrored IPFS metadata identifier exists in the DHT, where the first mirrored IPFS metadata identifier is used to index the first mirrored IPFS metadata.
  • the first node device in the step 402 may perform the mirroring service custom encoding and hash encoding on the mirroring identifier of the first image to obtain the IPFS metadata identifier of the first image. Accordingly, the step 406 may be performed.
  • the second node device performs a mirroring service custom encoding and hash encoding on the mirrored identifier of the first image to obtain an IPFS metadata identifier of the first image; and the second node device determines whether the first mirrored IPFS exists in the DHT. Metadata identifier.
  • the determining, by the second node device, the IPFS metadata identifier of the first image may include: the warehouse service module of the second node device sends a query request to the DHT, and is used to query whether the first mirrored IPFS exists in the DHT.
  • the metadata identifier, the query request carries the IPFS metadata identifier of the first image, and the query result is returned by the DHT, for example, the IPFS metadata identifier of the first image exists or the IPFS metadata identifier of the first image does not exist.
  • the second node device may obtain the IPFS metadata identifier of the first image according to the rule of the first node device to generate the IPFS metadata identifier, and obtain the IPFS metadata identifier of the first image according to the DHT, and then the IPFS of the first image according to the DHT.
  • the result of the query of the metadata identifier determines whether the IPFS metadata identifier of the first image exists in the DHT, and provides a manner of determining whether the first mirrored IPFS metadata identifier exists in the DHT according to the image identifier of the first image.
  • the second node device acquires IPFS metadata corresponding to the IPFS metadata identifier of the first image.
  • the step 407 may include: if the query result is that the IPFS metadata identifier of the first image exists in the DHT, the warehouse service module of the second node device may send an acquisition request to the DHT, The IPFS metadata corresponding to the IPFS metadata identifier is obtained, and the acquisition request carries the IPFS metadata identifier of the first image.
  • the DFS queries and acquires IPFS metadata corresponding to the IPFS metadata identifier of the first image from multiple node devices in the distributed file system according to the specified query mechanism according to the IPFS metadata identifier of the first image carried by the DHT. And returning a result of the request to the second node device, the result of the request carrying the IPFS metadata of the first image.
  • the second node device may store the IPFS metadata of the first image to the second node device.
  • DHT can use an optimized query algorithm, such as the mainline DHT (Mainline DHT) algorithm, based on the nearest node principle.
  • the embodiment of the present disclosure is described by taking the IPFS metadata identifier of the first image in the DHT as an example, and if the query result is that the IPFS metadata identifier of the first image does not exist in the DHT, the distributed file system is The IPFS metadata of the first image does not exist, that is, the first image does not exist in the distributed file system.
  • the second node device can construct the first image by itself, and the construction is the same as the construction of the first image by the first node device in step 401.
  • the second node device acquires the first image according to the IPFS metadata of the first image.
  • step 408 can be implemented in the following two ways:
  • the second node device may use the name of the node device where the first image is included and the address information of the plurality of block data of the first image included in the IPFS metadata of the first image, from the node where the first image is located.
  • the device acquires the plurality of block data of the first image, and obtains the complete first image to the local according to the plurality of block data of the first image.
  • the node device where the first image is located may be the first node device.
  • This method is directed to the case where the second node device acquires all the block data of the first image.
  • the second node device may obtain all the block data of the first image from the first node device according to the IPFS metadata of the first image.
  • the second node device may perform a hash operation on the hash value according to the address information of the block data, such as a hash value, to obtain a storage location of the block data in the first node device, and further The block data can be obtained from the storage location.
  • the second node device may acquire the block data from the storage location of the first node device according to a bitstream protocol.
  • the second node device may determine the target block data according to the name of the plurality of block data of the first image included in the IPFS metadata of the first image, and according to the IPFS metadata of the first image.
  • the name of the node device where the first image is located and the address information of the target block data, the target block data is obtained from the node device where the first image is located, and according to the target block data and the IPFS repository of the second node device
  • the existing block image data of the first image acquires the first image
  • the target block data is block data of the plurality of block data of the first image that is not present in the IPFS warehouse of the second node device.
  • the second node device may compare the names of the plurality of block data included in the IPFS metadata of the first image with the IPFS warehouse of the second node device.
  • the name of multiple block data to determine the target block data.
  • the plurality of block data included in the IPFS metadata of the first image is: block data A, block data B, and block data C
  • the plurality of block data in the IPFS warehouse of the second node device is: block data A
  • the block data D and the block data E, the target block data can be determined as: block data B and block data C.
  • the second node device may obtain the target block data from the corresponding node device, and then obtain the first data according to the target block data and another partial block data of the first image existing in the IPFS repository of the second node device. A mirror image.
  • the second node device may acquire the complete first image according to the acquired block data B, the block data C, and the existing block data A.
  • the second node device may obtain all the block data of the first image from the other node devices according to the IPFS metadata of the first image, and obtain the first image according to the entire block data, or obtain the first image part from the other node device.
  • the block data is obtained, and the first image is obtained according to the partial block data and another partial block data that has been stored by the second node device, and a plurality of manners for obtaining the first image according to the first mirrored IPFS metadata are provided.
  • the above steps 405 to 408 are processes in which the second node device acquires the first image.
  • the image distribution and acquisition method provided by the embodiment of the present disclosure may specifically include: a mirrored build (see FIG. 5), a mirrored release (see FIG. 6), and a mirrored acquisition (see FIG. 7).
  • a mirrored build see FIG. 5
  • a mirrored release see FIG. 6
  • a mirrored acquisition see FIG. 7
  • the block data of each image is distributed and stored in each node, and each node only needs to issue the metadata identifier corresponding to the metadata of the mirror image owned by the node, thereby reducing the mirror data.
  • the warehouse service module is implemented in a separate service manner.
  • the warehouse service module can also be the middleware of the container service module, that is, directly in the container service module.
  • the services provided by the warehouse service module are implemented in the form of function calls. Taking step 402 as an example, the generation of the IPFS metadata and the IPFS metadata identifier of the first image can be actually completed by the container service module calling the specified function.
  • the first node device may locally build and store the image without relying on the central warehouse server, and then generate IPFS metadata corresponding to the mirrored IPFS metadata according to the plurality of block data of the image.
  • the logo is distributed to the DHT by adding the IPFS metadata identifier to the DHT.
  • the second node device may initiate an acquisition request for the first image, obtain the IPFS metadata corresponding to the IPFS metadata identifier of the first image, and obtain the IPFS metadata from the first node according to the IPFS metadata of the first image. Get the image to local. The whole process can be carried out between the node devices without the control of other devices, and the efficiency is high.
  • FIG. 9 is a schematic structural diagram of a mirror image distribution apparatus according to an embodiment of the present disclosure.
  • the apparatus includes a generation module 901, a storage module 902, and a distribution module 903.
  • the generating module 901 is configured to generate the inter-star file system IPFS metadata of the first image and the IPFS metadata identifier of the first image according to the plurality of block data of the first image, where the IPFS metadata of the first image includes the first a mirrored image identifier, a name of the node device, and a name and address information of the plurality of block data of the first image, where the IPFS metadata identifier of the first image is used to index the IPFS metadata of the first image;
  • the storage module 902 is configured to store the plurality of block data of the first image to a storage location in the IPFS warehouse of the node device corresponding to the address information;
  • the issuing module 903 is configured to add the IPFS metadata identifier of the first image to the distributed hash table DHT of the distributed file system, where the DHT includes the IPFS metadata of the image published by the multiple node devices in the distributed file system. logo.
  • the publishing module 903 is configured to perform the process of adding the IPFS metadata identifier of the first image to the DHT in the foregoing step 404.
  • the storage module 902 includes:
  • the determining sub-module is configured to perform the process of determining, in the step 403, whether the second image of the first image is already in the IPFS repository of the node device.
  • the storage submodule is configured to perform the process of storing the plurality of block data of the first image into the IPFS repository in step 403 above.
  • the generating module is configured to perform the process of generating the first mirrored IPFS metadata identifier in the foregoing step 402.
  • the node device may locally build and store the image without relying on the central warehouse server, and then generate an IPFS metadata identifier corresponding to the mirrored IPFS metadata according to the plurality of block data of the image, and adopt The method of adding the IPFS metadata identifier to the DHT is implemented to enable the mirroring to be released, so that other node devices can obtain the image that is published by the node device based on the DHT. The whole process can be carried out between the node devices without the control of other devices, and the efficiency is high.
  • the image distribution device provided by the foregoing embodiment is only illustrated by the division of each functional module. In actual applications, the function distribution may be completed by different functional modules as needed. The internal structure of the device is divided into different functional modules to perform all or part of the functions described above.
  • the image distribution device provided in the foregoing embodiment is the same as the image distribution method embodiment, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
  • non-transitory computer readable storage medium comprising instructions, such as a memory comprising instructions executable by a mirror distribution device to perform the image distribution method of the above embodiments.
  • the non-transitory computer readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (Compact Disc Read-Only Memory, CD). -ROM), tape, floppy disk and optical data storage devices.
  • FIG. 11 is a schematic structural diagram of a mirror image acquiring apparatus according to an embodiment of the present disclosure.
  • the apparatus includes a receiving module 1101, a determining module 1102, and an obtaining module 1103.
  • the receiving module 1101 is configured to receive an acquisition request for the first image, where the acquisition request carries the image identifier of the first image;
  • the determining module 1102 is configured to determine, according to the image identifier of the first image, whether the first mirrored IPFS metadata identifier exists in the DHT, where the DHT includes an IPFS metadata identifier of a mirror image issued by multiple node devices in the distributed file system;
  • the obtaining module 1103 is configured to obtain the IPFS metadata corresponding to the IPFS metadata identifier of the first image if the IPFS metadata identifier of the first image is present, and obtain the first image according to the IPFS metadata of the first image. .
  • the determining module 1102 is configured to perform the process of determining whether the first mirrored IPFS metadata identifier exists in the DHT in the foregoing step 406.
  • the obtaining module 1103 is configured to perform the process of acquiring the IPFS metadata of the first image in the foregoing step 407.
  • the obtaining module 1103 is configured to perform the process of acquiring the first image according to all the block data of the first image acquired from the other node device in the foregoing step 408; or the acquiring module 1103 is configured to execute In the above step 408, the process of acquiring the first image is performed according to the block data that the node device of the first mirrored partial block data acquired from the other node device already exists.
  • the node device may initiate an acquisition request for the image, and obtain the IPFS metadata corresponding to the IPFS metadata identifier of the first image based on the DHT, and release the first according to the IPFS metadata of the first image.
  • a mirrored node device obtains the first image to the local.
  • the acquisition of the image may be triggered by the node device actively initiating the acquisition request, and the acquisition of the image may be performed between the node devices without the control of other devices, and the efficiency is high.
  • the image acquisition device provided in the above embodiment is only illustrated by the division of each functional module. In actual applications, the function distribution may be completed by different functional modules as needed. The internal structure of the device is divided into different functional modules to perform all or part of the functions described above.
  • the image acquisition device and the image acquisition method are provided in the same embodiment. For details, refer to the method embodiment, and details are not described herein.
  • non-transitory computer readable storage medium comprising instructions, such as a memory comprising instructions executable by a mirror acquisition device to perform the image acquisition method of the above embodiments.
  • the non-transitory computer readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (Compact Disc Read-Only Memory, CD). -ROM), tape, floppy disk and optical data storage devices.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

本公开提供了一种镜像分发方法、镜像获取方法及装置,属于网络技术领域。方法包括:根据第一镜像的多个块数据,生成第一镜像的IPFS元数据和第一镜像的IPFS元数据标识;将第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置;将第一镜像的IPFS元数据标识添加至分布式文件系统的DHT。本公开节点设备可以在本地构建并存储镜像,无需依赖于中央仓库服务器,进而采用将镜像的IPFS元数据对应的IPFS元数据标识添加至DHT的方式,实现对镜像的发布,使得其他节点设备可以基于该DHT获取到该镜像。整个过程可以在节点设备之间进行,无需经由其他设备的控制,效率高。

Description

镜像分发方法、镜像获取方法及装置
本申请要求于2017年04月01日提交中国国家知识产权局、申请号为201710214053.7、发明名称为“镜像分发方法、镜像获取方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及网络技术领域,特别涉及一种镜像分发方法、镜像获取方法及装置。
背景技术
分布式文件系统是一种能够对海量数据进行管理的系统。分布式文件系统可以为系统内的多个节点设备进行应用的部署。为了实现应用在节点设备上的正常运行,分布式文件系统可以在各个节点设备上构建容器。容器作为一种轻量级的虚拟机,能够为应用提供隔离的运行环境,在构建容器的过程中,分布式文件系统需要对容器运行所需的用户态文件的集合进行分发,也即是对容器的镜像进行分发。
目前的分布式文件系统包括用于提供镜像的存储服务的中央仓库服务器、控制器、跟踪器、多个节点设备代理以及多个节点设备,其中,控制器用于与中央仓库服务器进行数据交互,并管理多个节点设备代理进行镜像分发;该跟踪器用于跟踪各个节点设备的镜像下载情况,每个节点设备代理对应于一个节点设备,并管理对应节点设备的镜像下载。基于这种协议下,该镜像分发过程具体包括:
当控制器接收到镜像分发任务后,控制器从中央仓库服务器分层下载镜像到该控制器的本地镜像仓库,并向各个节点设备代理下发镜像的下载任务。节点设备代理接收到下载任务后,针对该镜像的每一个镜像层,通过调用跟踪器检查该镜像层是否在所有节点设备均不存在,如果是,则该节点设备代理调用自己所管理的节点设备从控制器的本地镜像仓库进行该镜像层的下载,如果不是,则可以调用该节点设备从已经存储了该镜像层的节点设备进行该镜像层的下载,下载完成后,该节点设备可以作为一个分发节点设备,来为其他节点设备提供该镜像层的下载。
在实现本公开的过程中,发明人发现现有技术至少存在以下问题:
上述技术中,需要通过控制器从中央仓库服务器下载镜像后再分发到各个节点设备,并经由控制器、节点设备代理的多层控制才能实现多个节点设备的镜像分发,分发效率低。
发明内容
本公开实施例提供了一种镜像分发方法、镜像获取方法及装置,可以解决现有技术分发效率低的问题。所述技术方案如下:
第一方面,提供了一种镜像分发方法,所述方法包括:根据第一镜像的多个块数据,生成所述第一镜像的星际文件系统IPFS元数据和所述第一镜像的IPFS元数据标识,所述第一镜像的IPFS元数据包括所述第一镜像的镜像标识、所述节点设备的名称、所述第一镜 像的多个块数据的名称和地址信息,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置;将所述第一镜像的IPFS元数据标识添加至分布式文件系统的分布式哈希表DHT,所述DHT包括所述分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识。
本公开实施例提供的方法,节点设备可以在本地构建并存储镜像,无需依赖于中央仓库服务器,进而根据该镜像的多个块数据,生成与该镜像的IPFS元数据对应的IPFS元数据标识,并采用将该IPFS元数据标识添加至DHT的方式,实现对镜像的发布,使得其他节点设备可以基于该DHT获取该镜像。整个过程可以在节点设备之间进行,无需经由其他设备的控制,效率高。
在第一方面的第一种可能实现方式中,所述将所述第一镜像的IPFS元数据标识添加至DHT包括:接收对所述第一镜像的发布请求,所述发布请求携带所述第一镜像的镜像标识;根据所述第一镜像的镜像标识,获取所述第一镜像的IPFS元数据标识,并将所述第一镜像的IPFS元数据标识添加至所述DHT。
本公开实施例提供的方法,节点设备可以根据发布请求携带的第一镜像的镜像标识,获取与第一镜像的IPFS元数据对应的IPFS元数据标识,并采用将该IPFS元数据标识添加至DHT的方式,实现对第一镜像的发布。节点设备只需要将第一镜像的IPFS元数据标识添加至DHT即可,而无需发布第一镜像的块数据,从而可以减少镜像数据的传输量,并提高存储空间的利用率,从而降低整个系统的开销。
在第一方面的第二种可能实现方式中,所述第一镜像的IPFS元数据还包括所述第一镜像的版本信息,所述将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置包括:根据所述第一镜像的镜像标识,判断所述节点设备的IPFS仓库中是否已经存在第二镜像,所述第二镜像的镜像标识与所述第一镜像的镜像标识相同;如果存在所述第二镜像且所述第二镜像的版本信息与所述第一镜像的版本信息不同,则将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置。
本公开实施例提供的方法,节点设备可以将新版本的第一镜像存储至节点设备的IPFS仓库中,从而实现对原有的相同名称的镜像版本的更新。
在第一方面的第三种可能实现方式中,所述生成所述第一镜像的IPFS元数据标识包括:
对所述第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到所述第一镜像的IPFS元数据标识。
本公开实施例提供的方法,节点设备可以通过镜像服务自定义编码和哈希编码,生成第一镜像的IPFS元数据标识,提供了一种生成IPFS元数据标识的方式。
第二方面,提供了一种镜像获取方法,所述方法包括:接收对第一镜像的获取请求,所述获取请求携带所述第一镜像的镜像标识;根据所述第一镜像的镜像标识,确定DHT中是否存在所述第一镜像的IPFS元数据标识,所述DHT包括分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;如果存在所述第一镜像的IPFS元数据标识,则获取所述第一镜像的IPFS 元数据标识对应的IPFS元数据;根据所述第一镜像的IPFS元数据,获取所述第一镜像。
本公开实施例提供的方法,节点设备可以主动发起对第一镜像的获取请求,基于DHT获取该第一镜像的IPFS元数据标识对应的IPFS元数据,并根据该IPFS元数据,从发布该第一镜像的节点设备获取该第一镜像到本地。该镜像的获取可以由节点设备主动发起获取请求而触发,且该镜像的获取可以在节点设备之间进行,无需经由其他设备的控制,效率高。
在第二方面的第一种可能实现方式中,所述根据所述第一镜像的镜像标识,确定所述DHT中是否存在所述第一镜像的IPFS元数据标识包括:对所述第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到所述第一镜像的IPFS元数据标识;确定所述DHT中是否存在所述第一镜像的IPFS元数据标识。
本公开实施例提供的方法,节点设备可以通过哈希编码和镜像服务自定义编码,得到第一镜像的IPFS元数据标识,进而确定DHT中是否存在该第一镜像的IPFS元数据标识,提供了一种根据第一镜像的镜像标识,确定DHT中是否存在第一镜像的IPFS元数据标识的方式。
在第二方面的第二种可能实现方式中,所述获取所述第一镜像的IPFS元数据标识对应的IPFS元数据包括:向所述DHT发送获取请求,所述获取请求用于获取与所述第一镜像的IPFS元数据标识对应的IPFS元数据,由所述DHT从分布式文件系统中多个节点设备查询并获取所述第一镜像的IPFS元数据;接收所述DHT返回的请求结果,所述请求结果携带所述第一镜像的IPFS元数据。
本公开实施例提供的方法,节点设备可以根据第一镜像的IPFS元数据标识,向DHT发送获取请求,由DHT返回与该第一镜像的IPFS元数据标识对应的IPFS元数据,提供了一种根据IPFS元数据标识,获取IPFS元数据的方式。
在第二方面的第三种可能实现方式中,所述根据所述第一镜像的IPFS元数据,获取所述第一镜像包括:根据所述第一镜像的IPFS元数据所包含的所述第一镜像所在节点设备的名称和所述第一镜像的多个块数据的地址信息,从所述第一镜像所在节点设备获取所述第一镜像的多个块数据,根据所述第一镜像的多个块数据获取所述第一镜像;或,根据所述第一镜像的IPFS元数据所包含的所述第一镜像的多个块数据的名称,确定目标块数据,并根据所述第一镜像的IPFS元数据所包含的所述第一镜像所在节点设备的名称和所述目标块数据的地址信息,从所述第一镜像所在节点设备获取所述目标块数据,并根据所述目标块数据和所述节点设备的IPFS仓库中已经存在的所述第一镜像的块数据获取所述第一镜像,所述目标块数据为所述第一镜像的多个块数据中不存在于所述节点设备的IPFS仓库中的块数据。
本公开实施例提供的方法,节点设备可以根据第一镜像的IPFS元数据,从其他节点设备获取第一镜像的全部块数据,并根据该全部块数据获取到完整的第一镜像,也可以从其他节点设备获取第一镜像的部分块数据,并根据该部分块数据和该节点设备已存储的另一部分块数据获取到完整的第一镜像,提供了多种根据第一镜像的IPFS元数据,获取第一镜像的方式。
第三方面,提供了一种镜像分发装置,所述装置包括多个功能模块,所述多个功能模 块用于执行上述第一方面所提供的镜像分发方法以及其任一种可能实现方式。
第四方面,提供了一种镜像获取装置,所述装置包括多个功能模块,所述多个功能模块用于执行上述第二方面所提供的镜像获取方法以及其任一种可能实现方式。
第五方面,提供了一种节点设备,所述节点设备包括:处理器;用于存储处理器可执行指令的存储器;所述可执行指令用于执行:根据第一镜像的多个块数据,生成所述第一镜像的星际文件系统IPFS元数据和所述第一镜像的IPFS元数据标识,所述第一镜像的IPFS元数据包括所述第一镜像的镜像标识、所述节点设备的名称、所述第一镜像的多个块数据的名称和地址信息,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置;将所述第一镜像的IPFS元数据标识添加至分布式文件系统的分布式哈希表DHT,所述DHT包括所述分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识。
在一种可能实现方式中,所述可执行指令用于执行:接收对所述第一镜像的发布请求,所述发布请求携带所述第一镜像的镜像标识;根据所述第一镜像的镜像标识,获取所述第一镜像的IPFS元数据标识,并将所述第一镜像的IPFS元数据标识添加至所述DHT。
在一种可能实现方式中,所述可执行指令用于执行:根据所述第一镜像的镜像标识,判断所述节点设备的IPFS仓库中是否已经存在第二镜像,所述第二镜像的镜像标识与所述第一镜像的镜像标识相同;如果存在所述第二镜像且所述第二镜像的版本信息与所述第一镜像的版本信息不同,则将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置。
在一种可能实现方式中,所述可执行指令用于执行:对所述第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到所述第一镜像的IPFS元数据标识。
第六方面,提供了一种节点设备,所述节点设备包括:处理器;用于存储处理器可执行指令的存储器;所述可执行指令用于执行:接收对第一镜像的获取请求,所述获取请求携带所述第一镜像的镜像标识;根据所述第一镜像的镜像标识,确定DHT中是否存在所述第一镜像的IPFS元数据标识,所述DHT包括分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;如果存在所述第一镜像的IPFS元数据标识,则获取所述第一镜像的IPFS元数据标识对应的IPFS元数据;根据所述第一镜像的IPFS元数据,获取所述第一镜像。
在一种可能实现方式中,对所述第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到所述第一镜像的IPFS元数据标识;确定所述DHT中是否存在所述第一镜像的IPFS元数据标识。
在一种可能实现方式中,所述可执行指令用于执行:向所述DHT发送获取请求,所述获取请求用于获取与所述第一镜像的IPFS元数据标识对应的IPFS元数据,由所述DHT从分布式文件系统中多个节点设备查询并获取所述第一镜像的IPFS元数据;接收所述DHT返回的请求结果,所述请求结果携带所述第一镜像的IPFS元数据。
在一种可能实现方式中,所述可执行指令用于执行:根据所述第一镜像的IPFS元数据 所包含的所述第一镜像所在节点设备的名称和所述第一镜像的多个块数据的地址信息,从所述第一镜像所在节点设备获取所述第一镜像的多个块数据,根据所述第一镜像的多个块数据获取所述第一镜像;或,根据所述第一镜像的IPFS元数据所包含的所述第一镜像的多个块数据的名称,确定目标块数据,并根据所述第一镜像的IPFS元数据所包含的所述第一镜像所在节点设备的名称和所述目标块数据的地址信息,从所述第一镜像所在节点设备获取所述目标块数据,并根据所述目标块数据和所述节点设备的IPFS仓库中已经存在的所述第一镜像的块数据获取所述第一镜像,所述目标块数据为所述第一镜像的多个块数据中不存在于所述节点设备的IPFS仓库中的块数据。
第七方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有可执行指令,所述可执行指令由处理器加载并执行以实现上述第一方面或第一方面中任意一种可能实现方式所提供的镜像分发方法。
第八方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有可执行指令,所述可执行指令由处理器加载并执行以实现上述第二方面或第二方面中任意一种可能实现方式所提供的镜像获取方法。
附图说明
图1是本公开实施例提供的一种分布式文件系统的结构示意图;
图2是本公开实施例提供的一种节点设备101的结构示意图;
图3是本公开实施例提供的一种节点设备300的结构示意图;
图4是本公开实施例提供的一种镜像分发方法的流程示意图;
图5是本公开实施例提供的一种镜像的构建过程的示意图;
图6是本公开实施例提供的一种镜像的发布过程的示意图;
图7是本公开实施例提供的一种镜像的分发过程的示意图;
图8是本公开实施例提供的一种节点设备的结构示意图;
图9是本公开实施例提供的一种镜像分发装置的结构示意图;
图10是本公开实施例提供的一种存储模块902的结构示意图;
图11是本公开实施例提供的一种镜像获取装置的结构示意图。
具体实施方式
为使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开实施方式作进一步地详细描述。
图1是本公开实施例提供的一种分布式文件系统的结构示意图。参见图1,该分布式文件系统包括至少两个节点设备,如第一节点设备101和第二节点设备102。其中,“第一”、“第二”仅用于描述目的,不用于指示节点设备的相对重要性,实际上每个节点设备之间的地位对等,即每个节点设备可以实现相同的功能。该分布式文件系统的各个节点设备共同遵守比特流(Bit Torrent)协议,并基于该比特流协议实现节点设备之间的数据传输。
该分布式文件系统中的任一个节点设备可以由一个实体设备实现,例如电脑、移动终 端或者服务器。每一个节点设备可以包括多个功能模块,以提供多种服务。以第一节点设备101为例,参见图2,该第一节点设备101可以包括运行容器服务模块、仓库服务模块和星际文件系统(InterPlanetary File System,IPFS)仓库。
其中,容器服务模块可以构建镜像,并提供容器服务,例如发起业务请求,包括发起存储镜像数据请求、发布镜像请求以及获取镜像请求;仓库服务模块可以承接容器服务模块的业务,利用IPFS提供镜像仓库服务,例如接收并处理容器服务模块发起的业务请求;IPFS仓库可以提供IPFS服务,包括分布式存储和分发服务,例如存储镜像数据,包括存储镜像的元数据和块数据。
容器服务模块、仓库服务模块和IPFS仓库之间可以利用请求来通信,例如,该请求可以为超文本传输协议(HyperText Transfer Protocol,HTTP)请求。
在下述的本公开实施例中,由节点设备执行的步骤实际上可能是由该节点设备的某个或多个功能模块协作完成,具体情况将在后续实施例的步骤中进行说明。
图3是本公开实施例提供的一种节点设备300的结构示意图,该节点设备可以用于执行下述各个实施例中提供的镜像分发方法。参见图3,该节点设备300包括:
节点设备300可以包括射频(Radio Frequency,RF)电路110、包括有一个或一个以上计算机可读存储介质的存储器120、输入单元130、显示单元140、传感器150、音频电路160、无线保真(Wireless Fidelity,WiFi)模块170、包括有一个或者一个以上处理核心的处理器180、以及电源190等部件。本领域技术人员可以理解,图3中示出的节点设备结构并不构成对节点设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:
RF电路110可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,交由一个或者一个以上处理器180处理;另外,将涉及上行的数据发送给基站。通常,RF电路110包括但不限于天线、至少一个放大器、调谐器、一个或多个振荡器、用户身份模块(SIM)卡、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路110还可以通过无线通信与网络和其他设备通信。无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、电子邮件、短消息服务(Short Messaging Service,SMS)等。
存储器120可用于存储软件程序以及模块,处理器180通过运行存储在存储器120的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器120可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据节点设备300的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器120还可以包括存储器控制器,以提供处理器180和输入单元130对存储器120的访问。
输入单元130可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。具体地,输入单元130可包括触敏表面131以及其他输入设备132。触敏表面131,也称为触摸显示屏或者触控板,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触敏表面131上或在触敏表面131附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触敏表面131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器180,并能接收处理器180发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触敏表面131。除了触敏表面131,输入单元130还可以包括其他输入设备132。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
显示单元140可用于显示由用户输入的信息或提供给用户的信息以及节点设备300的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。显示单元140可包括显示面板141,可选的,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板141。进一步的,触敏表面131可覆盖显示面板141,当触敏表面131检测到在其上或附近的触摸操作后,传送给处理器180以确定触摸事件的类型,随后处理器180根据触摸事件的类型在显示面板141上提供相应的视觉输出。虽然在图3中,触敏表面131与显示面板141是作为两个独立的部件来实现输入和输入功能,但是在某些实施例中,可以将触敏表面131与显示面板141集成而实现输入和输出功能。
节点设备300还可包括至少一种传感器150,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板141的亮度,接近传感器可在节点设备300移动到耳边时,关闭显示面板141和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于节点设备300还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
音频电路160、扬声器161,传声器162可提供用户与节点设备300之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出;另一方面,传声器162将收集的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出处理器180处理后,经RF电路110以发送给比如另一节点设备,或者将音频数据输出至存储器120以便进一步处理。音频电路160还可能包括耳塞插孔,以提供外设耳机与节点设备300的通信。
WiFi属于短距离无线传输技术,节点设备300通过WiFi模块170可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图3示出了WiFi模块170,但是可以理解的是,其并不属于节点设备300的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。
处理器180是节点设备300的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器120内的软件程序和/或模块,以及调用存储在存储器120内的数据,执行节点设备300的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器180可包括一个或多个处理核心;可选的,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器180中。
节点设备300还包括给各个部件供电的电源190(比如电池),可选的,电源可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源190还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。
尽管未示出,节点设备300还可以包括摄像头、蓝牙模块等,在此不再赘述。具体在本实施例中,节点设备的显示单元是触摸屏显示器,节点设备还包括有存储器,以及可执行指令,其中可执行指令存储于存储器中,且经配置以由一个或者一个以上处理器执行。该可执行指令用于执行下述图4所示实施例中节点设备侧方法。
在示例性实施例中,还提供了一种计算机可读存储介质,例如存储有可执行指令的存储器,上述可执行指令可由处理器加载并执行以完成下述图4所示实施例中的镜像分发方法。例如,计算机可读存储介质可以是只读存储器(read-only memory,ROM)、随机存取存储器(random-access memory,RAM)、只读光盘(compact disc read-only memory,CD-ROM)、磁带、软盘和光数据存储设备等。
图4是本公开实施例提供的一种镜像分发方法的流程示意图。该镜像分发方法应用于分布式文件系统,该分布式文件系统包括至少两个节点设备,本公开实施例以第一节点设备和第二节点设备为例进行说明。参见图4,该镜像分发方法可以包括:
401、第一节点设备构建第一镜像。
其中,该第一节点设备可以为分布式文件系统中的任一个节点设备,第一节点设备在运行过程中可以构建新镜像。该新镜像即为该步骤401中的第一镜像。该第一镜像的镜像数据可以包括表单文件、配置文件和镜像层文件,其中,表单文件(manifest)用于记录第一镜像的配置文件和镜像层文件信息;配置文件(config)用于记录第一镜像运行时的信息以及镜像层之间的依赖关系;镜像层文件(layers)为第一镜像的应用数据,镜像层的集合构成完整的第一镜像。上述这些第一镜像的镜像数据均可以作为第一镜像的块数据进行处理。
需要说明的是,该第一镜像的构建实际上可以由第一节点设备内的容器服务模块完成。参见图5,该容器服务模块构建第一镜像后可以通过构建接口发起数据存储请求,以请求将第一镜像的多个块数据存储至IPFS仓库中。
本公开实施例中,第一节点设备构建第一镜像后,如果不发布该第一镜像,则该第一镜像只能被该第一节点设备自身使用。因此,为了使得分布式文件系统中的其他节点设备可以获取该第一节点设备构建的第一镜像,第一节点设备可以将该第一镜像发布至分布式文件系统。而考虑到该第一镜像的多个块数据的数据量较大,为了减少发布的数据量,第一节点设备可以根据该第一镜像的多个块数据,生成数据量小的相关数据,并将该相关数 据发布至分布式文件系统,使得其他节点设备可以根据该相关数据获取到该第一镜像。
402、第一节点设备根据第一镜像的多个块数据,生成该第一镜像的IPFS元数据和该第一镜像的IPFS元数据标识,该第一镜像的IPFS元数据包括该第一镜像的镜像标识、该第一节点设备的名称、该第一镜像的多个块数据的名称和地址信息,该第一镜像的IPFS元数据标识用于索引该第一镜像的IPFS元数据。
其中,该镜像标识可以为镜像名称、镜像编号等,例如,镜像名称可以为镜像文件名或镜像文件名缩写,镜像编号可以为由字母或数字等组成字符串。
本公开实施例中,IPFS仓库有指定的数据结构组织规范,例如Merkle数据库可用性组(Database Availability Group,DAG)规范。为了保证第一节点设备根据该第一镜像的多个块数据,生成的该相关数据符合该IPFS仓库的数据结构组织规范。该相关数据的生成过程可以包括:第一节点设备可以依照Merkle DAG算法组织该第一镜像的多个块数据,生成符合IPFS仓库的数据结构组织规范的第一镜像的IPFS元数据,并将该第一镜像的IPFS元数据作为该相关数据。该IPFS元数据可以用来描述IPFS对象。
另外,由于IPFS仓库通过IPFS元数据标识和IPFS元数据一一对应的方式来管理镜像的IPFS元数据,因此,第一节点设备在生成第一镜像的IPFS元数据的同时,还可以生成第一镜像的IPFS元数据标识。在一种可能实现方式中,第一节点设备可以对第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到第一镜像的IPFS元数据标识。
其中,该第一镜像的IPFS元数据所包括的该第一镜像的多个块数据的地址信息可以为间接址信息,例如该多个块数据的hash值。该多个块数据的hash值可以在第一镜像的构建过程中生成。对于第一镜像的每个块数据,根据该块数据的hash值可以确定该块数据在第一节点设备的存储位置。
本公开实施例是以该第一镜像的IPFS元数据包括该第一镜像的镜像标识、该第一节点设备的名称、该第一镜像的多个块数据的名称和地址信息为例进行说明,实际上,该第一镜像的IPFS元数据还可以包括第一镜像的版本信息。
需要说明的是,参见图5,该第一镜像的IPFS元数据和IPFS元数据标识的生成实际上可以由第一节点设备内的仓库服务模块完成,即仓库服务模块接收到容器服务模块发起的数据存储请求后,可以根据第一镜像的多个块数据,生成该第一镜像的IPFS元数据和该第一镜像的IPFS元数据标识。
403、第一节点设备将第一镜像的多个块数据存储至该第一节点设备的IPFS仓库中与该地址信息相对应的存储位置。
本公开实施例中,对于第一镜像的多个块数据,第一节点设备可以将该多个块数据存储至IPFS仓库中与该多个块数据的地址信息相对应的存储位置,在一种可能实现方式中,对于每个块数据,第一节点设备可以根据该块数据的hash值,确定该块数据在第一节点设备的存储位置。
第一节点设备在存储第一镜像的多个块数据的同时,也可以对第一镜像的IPFS元数据和IPFS元数据标识进行存储。例如,第一节点设备可以依照本地数据库的组织原则,将该IPFS元数据和IPFS元数据标识存储至IPFS服务可访问的一段本地存储空间中。在一种可能实现方式中,第一节点设备可以将该IPFS元数据和IPFS元数据标识存储至对应关系记录表,例如,第一节点设备的IPFS仓库中可以维护一个对应关系记录表,该对应关系记录 表用于记录镜像的IPFS元数据标识和IPFS元数据之间的对应关系。
针对步骤402中该第一镜像的IPFS元数据还可以包括该第一镜像的版本信息,该步骤403可以包括:第一节点设备根据第一镜像的镜像标识,判断第一节点设备的IPFS仓库中是否已经存在第二镜像,该第二镜像的镜像标识与该第一镜像的镜像标识相同;如果存在该第二镜像且该第二镜像的版本信息与该第一镜像的版本信息不同,则将第一镜像的多个块数据存储至该第一节点设备的IPFS仓库中与该地址信息相对应的存储位置。第一节点设备可以将新版本的第一镜像存储至第一节点设备的IPFS仓库中,从而实现对原有的相同名称的镜像版本的更新。
需要说明的是,该第一镜像的IPFS元数据、第一镜像的多个块数据和第一镜像的IPFS元数据标识的存储实际上可以由第一节点设备内的仓库服务模块完成。
步骤401至步骤403是第一节点设备构建第一镜像,并存储第一镜像的过程。
404、第一节点设备将第一镜像的IPFS元数据标识添加至分布式文件系统的分布式哈希表(Distributed Hash Table,DHT),该DHT包括分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识。
本公开实施例中,第一节点设备构建并存储第一镜像后,可以采用将第一镜像的IPFS元数据标识添加至DHT的方式,实现将第一镜像的IPFS元数据或第一镜像发布至分布式文件系统的目的,以便于其他节点设备需要获取该第一镜像时,可以通过DHT中的该第一镜像的IPFS元数据标识,获取与该第一镜像的IPFS元数据标识对应的该第一镜像的IPFS元数据,进而获取到完整的第一镜像。
需要说明的是,该步骤404实际上可以由第一节点设备的仓库服务模块完成。相应地,该步骤404可以包括以下步骤a至b:
a、接收对第一镜像的发布请求,该发布请求携带该第一镜像的镜像标识。
本公开实施例中,参见图6,第一节点设备内的容器服务模块可以生成对第一镜像的发布请求,并通过容器服务模块的发布接口发送至仓库服务模块,由该仓库服务模块接收该发布请求。
b、根据第一镜像的镜像标识,从第一节点设备的本地存储空间中获取与第一镜像的IPFS元数据对应的第一镜像的IPFS元数据标识,并将该第一镜像的IPFS元数据标识添加至DHT。
本公开实施例中,第一节点设备本地存储有第一镜像的IPFS元数据以及对应的IPFS元数据标识,其中,该第一镜像的IPFS元数据中包含了第一镜像的镜像标识。第一节点设备可以根据第一镜像的镜像标识,找到包含该第一镜像的镜像标识的第一镜像的IPFS元数据,进而获取到该第一镜像的IPFS元数据标识。例如,第一节点设备可以从对应关系记录表中获取到与第一镜像的IPFS元数据对应的第一镜像的IPFS元数据标识。
参见图6,仓库服务模块接收到对第一镜像的发布请求后,可以根据该发布请求中携带的第一镜像的镜像标识,在节点设备本地检索,从第一节点设备本地获取到该第一镜像的IPFS元数据标识,并采用将该第一镜像的IPFS元数据标识添加至DHT的方式,实现对第一镜像的发布。此外,DHT存储第一镜像的IPFS元数据标识后,可以向第一节点设备发送发布成功消息,以告知第一节点设备该第一镜像发布成功。
本公开实施例中,第一节点设备采用向DHT添加该第一镜像的IPFS元数据标识的方 式,实现对第一镜像的IPFS元数据或第一镜像的发布,从而使其他节点可以通过该IPFS元数据标识检索和获取该第一镜像的IPFS元数据,进而获取到完整的第一镜像。由于无需发布第一镜像的块数据,从而可以减少镜像数据的传输量,并提高存储空间的利用率,从而降低整个系统的开销。
上述步骤401至步骤404是第一节点设备构建、存储并发布镜像的过程,如果第一节点设备构建该镜像后不发布,则该镜像只能被该第一节点设备自身使用,而将该镜像的IPFS元数据标识发布至DHT后,其他节点可以基于该DHT中该镜像的IPFS元数据标识,获取该镜像的IPFS元数据,进而基于该IPFS元数据获取到完整的镜像。
405、第二节点设备接收对第一镜像的获取请求,该获取请求携带该第一镜像的镜像标识。
本公开实施例中,参见图7,第二节点设备内的容器服务模块可以生成对该第一镜像的获取请求,并通过该容器服务模块的分发接口发送至第二节点设备内的仓库服务模块,由该仓库服务模块接收该获取请求。
406、第二节点设备根据该第一镜像的镜像标识,确定该DHT中是否存在第一镜像的IPFS元数据标识,该第一镜像的IPFS元数据标识用于索引第一镜像的IPFS元数据。
本公开实施例中,针对步骤402中第一节点设备可以对第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到第一镜像的IPFS元数据标识,相应地,该步骤406可以包括:第二节点设备对第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到第一镜像的IPFS元数据标识;第二节点设备确定该DHT中是否存在该第一镜像的IPFS元数据标识。
其中,第二节点设备确定该DHT中是否存在该第一镜像的IPFS元数据标识可以包括:第二节点设备的仓库服务模块向DHT发送查询请求,用于查询DHT中是否存在第一镜像的IPFS元数据标识,该查询请求携带该第一镜像的IPFS元数据标识,由DHT返回查询结果,例如存在该第一镜像的IPFS元数据标识或不存在该第一镜像的IPFS元数据标识。
第二节点设备可以根据第一节点设备生成IPFS元数据标识时的规则,通过镜像服务自定义编码和哈希编码,得到第一镜像的IPFS元数据标识,进而根据DHT对该第一镜像的IPFS元数据标识的查询结果,确定DHT中是否存在该第一镜像的IPFS元数据标识,提供了一种根据第一镜像的镜像标识,确定DHT中是否存在第一镜像的IPFS元数据标识的方式。
407、如果存在该第一镜像的IPFS元数据标识,第二节点设备获取与该第一镜像的IPFS元数据标识对应的IPFS元数据。
本公开实施例中,参见图7,该步骤407可以包括:如果查询结果为DHT中存在该第一镜像的IPFS元数据标识,则第二节点设备的仓库服务模块可以向DHT发送获取请求,用于获取与该IPFS元数据标识对应的IPFS元数据,该获取请求携带该第一镜像的IPFS元数据标识。由DHT根据该获取请求携带的第一镜像的IPFS元数据标识,按照指定查询机制,从分布式文件系统中多个节点设备查询并获取与该第一镜像的IPFS元数据标识对应的IPFS元数据,并向第二节点设备返回请求结果,该请求结果携带该第一镜像的IPFS元数据。第二节点设备接收到该第一镜像的IPFS元数据后,可以将该第一镜像的IPFS元数据存储至该第二节点设备本地。例如,DHT可以采用优化查询算法,如主线DHT(Mainline DHT) 算法,依据最近节点原则进行查询。
本公开实施例以查询结果为DHT中存在该第一镜像的IPFS元数据标识为例进行说明,而如果查询结果为DHT中不存在该第一镜像的IPFS元数据标识,说明分布式文件系统中不存在该第一镜像的IPFS元数据,也即说明该分布式文件系统中不存在该第一镜像。对此,第二节点设备可以自己构建该第一镜像,该构建与步骤401中第一节点设备对第一镜像的构建同理。
408、第二节点设备根据该第一镜像的IPFS元数据,获取该第一镜像。
本公开实施例中,该步骤408可以通过以下两种方式实现:
第一种方式,第二节点设备可以根据该第一镜像的IPFS元数据所包含的第一镜像所在节点设备的名称和第一镜像的多个块数据的地址信息,从该第一镜像所在节点设备获取该第一镜像的多个块数据,根据该第一镜像的多个块数据获取该完整的第一镜像到本地。
本公开实施例中,第一镜像所在节点设备可以为第一节点设备。这种方式针对的是第二节点设备获取第一镜像的全部块数据的情况。第二节点设备获取该第一镜像的IPFS元数据后,可以根据该第一镜像的IPFS元数据,从第一节点设备获取到第一镜像的所有块数据。以某个块数据为例,第二节点设备可以根据该块数据的地址信息,如hash值,通过对该hash值进行hash运算,即可得到该块数据在第一节点设备的存储位置,进而可以从该存储位置获取该块数据。例如,第二节点设备可以依据比特流协议从第一节点设备的该存储位置获取该块数据。
第二种方式,第二节点设备可以根据该第一镜像的IPFS元数据所包含的第一镜像的多个块数据的名称,确定目标块数据,并根据该第一镜像的IPFS元数据所包含的该第一镜像所在节点设备的名称和该目标块数据的地址信息,从该第一镜像所在节点设备获取该目标块数据,并根据该目标块数据和该第二节点设备的IPFS仓库中已经存在的该第一镜像的块数据获取该第一镜像,该目标块数据为该第一镜像的多个块数据中不存在于该第二节点设备的IPFS仓库中的块数据。
这种方式针对的是第二节点设备获取第一镜像的部分块数据的情况。参见图7,第二节点设备获取该第一镜像的IPFS元数据后,可以通过对比该第一镜像的IPFS元数据所包含的多个块数据的名称和该第二节点设备的IPFS仓库中的多个块数据的名称,确定目标块数据。例如,该第一镜像的IPFS元数据所包含的多个块数据为:块数据A、块数据B和块数据C,该第二节点设备的IPFS仓库中的多个块数据为:块数据A、块数据D和块数据E,则目标块数据可以确定为:块数据B和块数据C。
第二节点设备确定目标块数据后,可以从对应节点设备获取该目标块数据,然后根据该目标块数据和第二节点设备的IPFS仓库中已有的第一镜像的另一部分块数据,获取第一镜像。例如,第二节点设备可以根据获取到的块数据B、块数据C以及已有的块数据A获取完整的第一镜像。
第二节点设备可以根据第一镜像的IPFS元数据,从其他节点设备获取第一镜像的全部块数据,并根据该全部块数据获取第一镜像,也可以从其他节点设备获取第一镜像的部分块数据,并根据该部分块数据和该第二节点设备已存储的另一部分块数据获取第一镜像,提供了多种根据第一镜像的IPFS元数据获取第一镜像的方式。
上述步骤405至步骤408是第二节点设备获取第一镜像的过程。
本公开实施例提供的镜像分发和获取方法,具体可包括:镜像的构建(参见图5)、镜像的发布(参见图6)和镜像的获取(参见图7)。其中,在本公开实施例提供的系统中,各个镜像的块数据分布式存储在各个节点,且各个节点只需要发布与其拥有的镜像的元数据对应的元数据标识即可,从而可减少镜像数据的传输量,并提高存储空间的利用率,从而降低整个系统的开销。
需要说明的是,本公开实施例中,仓库服务模块以单独服务的方式实现。实际上,参见图8,如果容器服务模块的业务接口,如镜像构建、发布和分发接口支持添加中间件,那么该仓库服务模块还可以为容器服务模块的中间件,即在容器服务模块内直接以函数调用的方式实现仓库服务模块所提供的服务。以步骤402为例,第一镜像的IPFS元数据和IPFS元数据标识的生成实际上可以由容器服务模块调用指定函数来完成。
本公开实施例提供的方法,第一节点设备可以在本地构建并存储镜像,无需依赖于中央仓库服务器,进而根据该镜像的多个块数据,生成与该镜像的IPFS元数据对应的IPFS元数据标识,并采用将该IPFS元数据标识添加至DHT的方式,实现对镜像的发布。第二节点设备可以主动发起对第一镜像的获取请求,基于该DHT获取该第一镜像的IPFS元数据标识对应的IPFS元数据,并根据该第一镜像的IPFS元数据,从第一节点设备获取该镜像到本地。整个过程可以在节点设备之间进行,无需经由其他设备的控制,效率高。
图9是本公开实施例提供的一种镜像分发装置的结构示意图。参照图9,该装置包括生成模块901、存储模块902和发布模块903。
生成模块901,用于根据第一镜像的多个块数据,生成该第一镜像的星际文件系统IPFS元数据和该第一镜像的IPFS元数据标识,该第一镜像的IPFS元数据包括该第一镜像的镜像标识、该节点设备的名称、该第一镜像的多个块数据的名称和地址信息,该第一镜像的IPFS元数据标识用于索引该第一镜像的IPFS元数据;
存储模块902,用于将该第一镜像的多个块数据存储至该节点设备的IPFS仓库中与该地址信息相对应的存储位置;
发布模块903,用于将该第一镜像的IPFS元数据标识添加至分布式文件系统的分布式哈希表DHT,该DHT包括该分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识。
在一种可能实现方式中,该发布模块903用于执行上述步骤404中将第一镜像的IPFS元数据标识添加至DHT的过程。
在一种可能实现方式中,参见图10,该存储模块902包括:
判断子模块,用于执行上述步骤403中判断节点设备的IPFS仓库中是否已经存在与该第一镜像的镜像标识相同的第二镜像的过程。
存储子模块,用于执行上述步骤403中将第一镜像的多个块数据存储至IPFS仓库中的过程。
在一种可能实现方式中,该生成模块用于执行上述步骤402中生成第一镜像的IPFS元数据标识的过程。
本公开实施例中,节点设备可以在本地构建并存储镜像,无需依赖于中央仓库服务器,进而根据该镜像的多个块数据,生成与该镜像的IPFS元数据对应的IPFS元数据标识,并 采用将该IPFS元数据标识添加至DHT的方式,实现对镜像的发布,使得其他节点设备可以基于该DHT获取该节点设备发布的镜像。整个过程可以在节点设备之间进行,无需经由其他设备的控制,效率高。
需要说明的是,上述实施例提供的镜像分发装置在镜像分发时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的镜像分发装置与镜像分发方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器,上述指令可由镜像分发装置执行以完成上述实施例中的镜像分发方法。例如,所述非临时性计算机可读存储介质可以是只读内存(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)、磁带、软盘和光数据存储设备等。
图11是本公开实施例提供的一种镜像获取装置的结构示意图。参照图11,该装置包括接收模块1101、确定模块1102、获取模块1103。
接收模块1101,用于接收对第一镜像的获取请求,该获取请求携带该第一镜像的镜像标识;
确定模块1102,用于根据该第一镜像的镜像标识,确定DHT中是否存在第一镜像的IPFS元数据标识,该DHT包括分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识;
获取模块1103,用于如果存在该第一镜像的IPFS元数据标识,则获取该第一镜像的IPFS元数据标识对应的IPFS元数据;根据该第一镜像的IPFS元数据,获取该第一镜像。
在一种可能实现方式中,该确定模块1102用于执行上述步骤406中确定DHT中是否存在第一镜像的IPFS元数据标识的过程。
在一种可能实现方式中,该获取模块1103用于执行上述步骤407中获取第一镜像的IPFS元数据的过程。
在一种可能实现方式中,该获取模块1103用于执行上述步骤408中根据从其他节点设备获取的第一镜像的全部块数据,获取第一镜像的过程;或,该获取模块1103用于执行上述步骤408中根据从其他节点设备获取的第一镜像的部分块数据的节点设备已经存在的块数据,获取第一镜像的过程。
本公开实施例中,节点设备可以主动发起对镜像的获取请求,基于DHT获取该第一镜像的IPFS元数据标识对应的IPFS元数据,并根据该第一镜像的IPFS元数据,从发布该第一镜像的节点设备获取该第一镜像到本地。该镜像的获取可以由节点设备主动发起获取请求而触发,且该镜像的获取可以在节点设备之间进行,无需经由其他设备的控制,效率高。
需要说明的是,上述实施例提供的镜像获取装置在镜像获取时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的镜像获取装置与镜像获取方法实施例属于同一构思,其具体实现 过程详见方法实施例,这里不再赘述。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器,上述指令可由镜像获取装置执行以完成上述实施例中的镜像获取方法。例如,所述非临时性计算机可读存储介质可以是只读内存(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)、磁带、软盘和光数据存储设备等。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本公开的可选实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。

Claims (18)

  1. 一种镜像分发方法,其特征在于,应用于分布式文件系统中的一个节点设备,所述方法包括:
    根据第一镜像的多个块数据,生成所述第一镜像的星际文件系统IPFS元数据和所述第一镜像的IPFS元数据标识,所述第一镜像的IPFS元数据包括所述第一镜像的镜像标识、所述节点设备的名称、所述第一镜像的多个块数据的名称和地址信息,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;
    将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置;
    将所述第一镜像的IPFS元数据标识添加至分布式文件系统的分布式哈希表DHT,所述DHT包括所述分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识。
  2. 根据权利要求1所述的方法,其特征在于,所述将所述第一镜像的IPFS元数据标识添加至DHT包括:
    接收对所述第一镜像的发布请求,所述发布请求携带所述第一镜像的镜像标识;
    根据所述第一镜像的镜像标识,获取所述第一镜像的IPFS元数据标识,并将所述第一镜像的IPFS元数据标识添加至所述DHT。
  3. 根据权利要求1所述的方法,其特征在于,所述第一镜像的IPFS元数据还包括所述第一镜像的版本信息,所述将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置包括:
    根据所述第一镜像的镜像标识,判断所述节点设备的IPFS仓库中是否已经存在第二镜像,所述第二镜像的镜像标识与所述第一镜像的镜像标识相同;
    如果存在所述第二镜像且所述第二镜像的版本信息与所述第一镜像的版本信息不同,则将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置。
  4. 根据权利要求1所述的方法,其特征在于,所述生成所述第一镜像的IPFS元数据标识包括:
    对所述第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到所述第一镜像的IPFS元数据标识。
  5. 一种镜像获取方法,其特征在于,应用于分布式文件系统中的一个节点设备,所述方法包括:
    接收对第一镜像的获取请求,所述获取请求携带所述第一镜像的镜像标识;
    根据所述第一镜像的镜像标识,确定DHT中是否存在所述第一镜像的IPFS元数据标识,所述DHT包括分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;
    如果存在所述第一镜像的IPFS元数据标识,则获取所述第一镜像的IPFS元数据标识对应的IPFS元数据;
    根据所述第一镜像的IPFS元数据,获取所述第一镜像。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述第一镜像的镜像标识,确定所述DHT中是否存在所述第一镜像的IPFS元数据标识包括:
    对所述第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到所述第一镜像的IPFS元数据标识;
    确定所述DHT中是否存在所述第一镜像的IPFS元数据标识。
  7. 根据权利要求5所述的方法,其特征在于,所述获取所述第一镜像的IPFS元数据标识对应的IPFS元数据包括:
    向所述DHT发送获取请求,所述获取请求用于获取与所述第一镜像的IPFS元数据标识对应的IPFS元数据,由所述DHT从分布式文件系统中多个节点设备查询并获取所述第一镜像的IPFS元数据;
    接收所述DHT返回的请求结果,所述请求结果携带所述第一镜像的IPFS元数据。
  8. 根据权利要求5所述的方法,其特征在于,所述根据所述第一镜像的IPFS元数据,获取所述第一镜像包括:
    根据所述第一镜像的IPFS元数据所包含的所述第一镜像所在节点设备的名称和所述第一镜像的多个块数据的地址信息,从所述第一镜像所在节点设备获取所述第一镜像的多个块数据,根据所述第一镜像的多个块数据获取所述第一镜像;或,
    根据所述第一镜像的IPFS元数据所包含的所述第一镜像的多个块数据的名称,确定目标块数据,并根据所述第一镜像的IPFS元数据所包含的所述第一镜像所在节点设备的名称和所述目标块数据的地址信息,从所述第一镜像所在节点设备获取所述目标块数据,并根据所述目标块数据和所述节点设备的IPFS仓库中已经存在的所述第一镜像的块数据获取所述第一镜像,所述目标块数据为所述第一镜像的多个块数据中不存在于所述节点设备的IPFS仓库中的块数据。
  9. 一种镜像分发装置,其特征在于,所述装置包括:
    生成模块,用于根据第一镜像的多个块数据,生成所述第一镜像的星际文件系统IPFS元数据和所述第一镜像的IPFS元数据标识,所述第一镜像的IPFS元数据包括所述第一镜像的镜像标识、所述节点设备的名称、所述第一镜像的多个块数据的名称和地址信息,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;
    存储模块,用于将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置;
    发布模块,用于将所述第一镜像的IPFS元数据标识添加至分布式文件系统的分布式哈希表DHT,所述DHT包括所述分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识。
  10. 根据权利要求9所述的装置,其特征在于,所述发布模块,用于接收对所述第一镜像的发布请求,所述发布请求携带所述第一镜像的镜像标识;根据所述第一镜像的镜像标识,获取所述第一镜像的IPFS元数据标识,并将所述第一镜像的IPFS元数据标识添加至所述DHT。
  11. 根据权利要求9所述的装置,其特征在于,所述第一镜像的IPFS元数据还包括所述第一镜像的版本信息,所述存储模块包括:
    判断子模块,用于根据所述第一镜像的镜像标识,判断所述节点设备的IPFS仓库中是否已经存在第二镜像,所述第二镜像的镜像标识与所述第一镜像的镜像标识相同;
    存储子模块,用于如果存在所述第二镜像且所述第二镜像的版本信息与所述第一镜像的版本信息不同,则将所述第一镜像的多个块数据存储至所述节点设备的IPFS仓库中与所述地址信息相对应的存储位置。
  12. 根据权利要求9所述的装置,其特征在于,所述生成模块,用于对所述第一镜像的镜像标识进行镜像服务自定义编码和哈希编码,得到所述第一镜像的IPFS元数据标识。
  13. 一种镜像获取装置,其特征在于,所述装置包括:
    接收模块,用于接收对第一镜像的获取请求,所述获取请求携带所述第一镜像的镜像标识;
    确定模块,用于根据所述第一镜像的镜像标识,确定DHT中是否存在所述第一镜像的IPFS元数据标识,所述DHT包括分布式文件系统中多个节点设备所发布镜像的IPFS元数据标识,所述第一镜像的IPFS元数据标识用于索引所述第一镜像的IPFS元数据;
    获取模块,用于如果存在所述第一镜像的IPFS元数据标识,则获取所述第一镜像的IPFS元数据标识对应的IPFS元数据;根据所述第一镜像的IPFS元数据,获取所述第一镜像。
  14. 根据权利要求13所述的装置,其特征在于,所述确定模块,用于对所述第一镜像的镜像标识做哈希运算,得到所述第一镜像的IPFS元数据标识;确定所述DHT中是否存在所述第一镜像的IPFS元数据标识。
  15. 根据权利要求13所述的装置,其特征在于,所述获取模块,用于向所述DHT发送获取请求,所述获取请求用于获取与所述第一镜像的IPFS元数据标识对应的IPFS元数据,由所述DHT从分布式文件系统中多个节点设备查询并获取所述第一镜像的IPFS元数据;接收所述DHT返回的请求结果,所述请求结果携带所述第一镜像的IPFS元数据。
  16. 根据权利要求13所述的装置,其特征在于,所述获取模块,用于根据所述第一镜像的IPFS元数据所包含的所述第一镜像所在节点设备的名称和所述第一镜像的多个块数据的地址信息,从所述第一镜像所在节点设备获取所述第一镜像的多个块数据,根据所述第一镜像的多个块数据获取所述第一镜像;或,
    所述获取模块,用于根据所述第一镜像的IPFS元数据所包含的所述第一镜像的多个块数 据的名称,确定目标块数据,并根据所述第一镜像的IPFS元数据所包含的所述第一镜像所在节点设备的名称和所述目标块数据的地址信息,从所述第一镜像所在节点设备获取所述目标块数据,并根据所述目标块数据和所述节点设备的IPFS仓库中已经存在的所述第一镜像的块数据获取所述第一镜像,所述目标块数据为所述第一镜像的多个块数据中不存在于所述节点设备的IPFS仓库中的块数据。
  17. 一种节点设备,其特征在于,所述节点设备包括处理器和存储器,所述存储器中存储有可执行指令,所述可执行指令由所述处理器加载并执行以实现如权利要求1至4任一项所述的镜像分发方法。
  18. 一种节点设备,其特征在于,所述节点设备包括处理器和存储器,所述存储器中存储有可执行指令,所述可执行指令由所述处理器加载并执行以实现如权利要求5至8任一项所述的镜像获取方法。
PCT/CN2018/080944 2017-04-01 2018-03-28 镜像分发方法、镜像获取方法及装置 WO2018177333A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP18777174.6A EP3591940B1 (en) 2017-04-01 2018-03-28 Mirror image distribution method, and mirror image acquisition method and apparatus
US16/589,729 US11388220B2 (en) 2017-04-01 2019-10-01 Image distribution method and apparatus, and image obtaining method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710214053.7 2017-04-01
CN201710214053.7A CN108667884B (zh) 2017-04-01 2017-04-01 镜像分发方法、镜像获取方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/589,729 Continuation US11388220B2 (en) 2017-04-01 2019-10-01 Image distribution method and apparatus, and image obtaining method and apparatus

Publications (1)

Publication Number Publication Date
WO2018177333A1 true WO2018177333A1 (zh) 2018-10-04

Family

ID=63675245

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/080944 WO2018177333A1 (zh) 2017-04-01 2018-03-28 镜像分发方法、镜像获取方法及装置

Country Status (4)

Country Link
US (1) US11388220B2 (zh)
EP (1) EP3591940B1 (zh)
CN (1) CN108667884B (zh)
WO (1) WO2018177333A1 (zh)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6421866B1 (ja) * 2017-08-09 2018-11-14 オムロン株式会社 センサ管理ユニット、センサ装置、センサ管理方法及びセンサ管理プログラム
US11641359B2 (en) * 2018-04-20 2023-05-02 Opera Norway As System for connecting computing devices
CN111382136B (zh) * 2018-12-29 2024-03-15 华为技术有限公司 文件系统镜像及文件请求方法
CN110324406B (zh) * 2019-06-03 2022-07-26 网宿科技股份有限公司 一种获取业务数据的方法和云服务系统
CN110647580B (zh) * 2019-09-05 2022-06-10 南京邮电大学 分布式容器集群镜像管理主节点、从节点、系统及方法
US11115312B1 (en) * 2019-12-04 2021-09-07 Sprint Communications Company L.P. File control for data packet routers using consensus and inter-planetary file system (IPFS)
CN111131487B (zh) * 2019-12-30 2022-08-12 广东浪潮大数据研究有限公司 一种深度学习平台容器镜像获取、共享方法及系统
CN111182067B (zh) * 2019-12-31 2021-08-27 上海焜耀网络科技有限公司 一种基于星际文件系统ipfs的数据写入方法及设备
CN111414426A (zh) * 2020-03-26 2020-07-14 北京云图科瑞科技有限公司 一种基于区块链的数据处理方法及系统
CN112437157B (zh) * 2020-11-24 2022-10-18 中国工商银行股份有限公司 镜像仓库对账方法及系统
CN113282418A (zh) * 2021-06-03 2021-08-20 光大科技有限公司 一种模型聚合处理方法及装置
CN113342763B (zh) * 2021-06-03 2022-07-15 上海和数软件有限公司 基于ipfs的分布式数据同步方法、设备及介质
KR20230067126A (ko) * 2021-11-09 2023-05-16 삼성전자주식회사 Ipfs를 활용한 중앙화 대체불가능 토큰의 발행 장치 및 방법
US11743321B2 (en) * 2021-11-12 2023-08-29 Microsoft Technology Licensing, Llc Linked file engagement

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080155191A1 (en) * 2006-12-21 2008-06-26 Anderson Robert J Systems and methods for providing heterogeneous storage systems
CN103186554A (zh) * 2011-12-28 2013-07-03 阿里巴巴集团控股有限公司 分布式数据镜像方法及存储数据节点
CN106506587A (zh) * 2016-09-23 2017-03-15 中国人民解放军国防科学技术大学 一种基于分布式存储的Docker镜像下载方法

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009032712A2 (en) * 2007-08-29 2009-03-12 Nirvanix, Inc. Method and system for moving requested files from one storage location to another
US8606846B2 (en) * 2007-10-15 2013-12-10 Nbcuniversal Media, Llc Accelerating peer-to-peer content distribution
IT1397439B1 (it) * 2009-12-30 2013-01-10 St Microelectronics Srl Procedimento e dispositivi per la distribuzione di contenuti mediali e relativo prodotto informatico
US9231768B2 (en) * 2010-06-22 2016-01-05 International Business Machines Corporation Utilizing a deterministic all or nothing transformation in a dispersed storage network
US8910157B2 (en) * 2010-11-23 2014-12-09 International Business Machines Corporation Optimization of virtual appliance deployment
CN102307210B (zh) * 2011-01-13 2014-12-10 国云科技股份有限公司 一种数据下载系统及其数据管理和下载方法
US9542466B2 (en) * 2012-05-10 2017-01-10 Aetherstore Inc. Systems and methods for distributed storage
US9390055B2 (en) * 2012-07-17 2016-07-12 Coho Data, Inc. Systems, methods and devices for integrating end-host and network resources in distributed memory
US10305721B1 (en) * 2014-12-09 2019-05-28 Amazon Technologies, Inc. Content delivery using gossip protocols
US9819972B1 (en) * 2014-12-10 2017-11-14 Digital Keystone, Inc. Methods and apparatuses for a distributed live-on-demand (LOD) origin
US9292699B1 (en) * 2014-12-30 2016-03-22 Airwatch Llc Encrypted file storage
US10257268B2 (en) * 2015-03-09 2019-04-09 Vapor IO Inc. Distributed peer-to-peer data center management
US9942578B1 (en) * 2015-12-07 2018-04-10 Digital Keystone, Inc. Methods and apparatuses for a distributed live-on-demand (LOD) origin
US9961139B2 (en) * 2016-05-24 2018-05-01 International Business Machines Corporation Cooperative download among low-end devices under resource constrained environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080155191A1 (en) * 2006-12-21 2008-06-26 Anderson Robert J Systems and methods for providing heterogeneous storage systems
CN103186554A (zh) * 2011-12-28 2013-07-03 阿里巴巴集团控股有限公司 分布式数据镜像方法及存储数据节点
CN106506587A (zh) * 2016-09-23 2017-03-15 中国人民解放军国防科学技术大学 一种基于分布式存储的Docker镜像下载方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3591940A4

Also Published As

Publication number Publication date
US11388220B2 (en) 2022-07-12
EP3591940A1 (en) 2020-01-08
EP3591940A4 (en) 2020-01-08
US20200036772A1 (en) 2020-01-30
CN108667884B (zh) 2021-01-05
CN108667884A (zh) 2018-10-16
EP3591940B1 (en) 2021-02-17

Similar Documents

Publication Publication Date Title
WO2018177333A1 (zh) 镜像分发方法、镜像获取方法及装置
CN110582017B (zh) 一种视频播放方法、装置、终端及存储介质
CN104518953B (zh) 删除消息的方法、即时通信终端及系统
EP3531290B1 (en) Data backup method, apparatus, electronic device, storage medium, and system
RU2628488C2 (ru) Способ, терминальное устройство и сервер для передачи данных nfc
CN102393844B (zh) 应用注册和统一媒体搜索
CN107204989B (zh) 广告拦截方法、终端、服务器和存储介质
CN111585760A (zh) 密钥找回方法、装置、终端及可读介质
CN109309696B (zh) 文件夹发送方法、发送方、接收方以及存储介质
WO2014032559A1 (zh) 下载文件的方法和装置
US11314703B2 (en) Method and apparatus for processing timedly-published data
EP3429176B1 (en) Scenario-based sound effect control method and electronic device
CN106953898B (zh) 一种获取软件包的方法和装置
CN107992498B (zh) 一种将数据导入数据仓库的方法及系统
WO2015003636A1 (zh) 一种页面元素的拦截方法和装置
WO2020088681A1 (zh) 模型文件的管理方法和终端设备
WO2015062234A1 (zh) 移动终端资源处理方法、装置和设备
CN103227832A (zh) 共享资源处理方法及装置
CN106682189B (zh) 文件名显示方法及装置
CN115065609A (zh) B端SaaS系统混合部署方法及系统
WO2015067206A1 (zh) 一种文件查找的方法及终端
US11327845B2 (en) Image synchronization method and device, and server
CN106657281A (zh) 文件共享方法及装置
US10853412B2 (en) Scenario-based sound effect control method and electronic device
CN115883352B (zh) 服务节点创建方法、相关设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18777174

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2018777174

Country of ref document: EP

Effective date: 20191001