Hot Swaps
Use the Hot Swaps plugin to make one CID map to another
The Hot Swaps plugin can be used to “redirect” a CID to another CID. This can be useful when you need to replace content without updaing the CID hash. What makes this unique from just replacing content is that every swap is recorded and is available as a history. Combine that with the content addressable nature of CIDs and you get a version history of content.
To demonstrate how this plugin works, consider the following example:
Installation
To install a plugin navigate to the Plugins Marketplace tab on the right side.
Once there you can find the plugin you want to install and click “Install.” This will bring up a drop down of your Gateways to choose which the plugin is installed to.
Once installed you can confirm its there by going to the “My Plugins” tab.
Usage
After installing the plugin you can then make CID swaps and have them reflect when making Gateway requests. The first parameter cid
will be the original CID, and swapCid
will be the content you want it to point to instead.
You can fetch the history of CID swaps using the getSwapHistory
method, passing in the cid
of the original CID and the domain
of the gateway that has the Hot Swaps plugin installed.
The response will show a history of the CID and domain in question
To delete a CID swap you can simply use the deleteSwap
method and pass in the CID.