From 94d9e322b84e51f24f4a1d0483db2f36eb56ffa6 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Wed, 3 Apr 2024 12:12:01 -0500 Subject: [PATCH] Release 0.3.0 A full analysis of the Bitswap API was made to bring it in line with Kubo's RPC API. [Breaking] GetAsync and UnwantAsync were removed from IBitswapApi. These were not part of Kubo's API, but were intended for custom implementations. To migrate, derive IBitswapApi and add your custom functionality in your library. The return type for IBlockApi.GetAsync was changed from IDataBlock to byte[], since IDataBlock was removed in 0.2.0. Kubo's RPC API (including the JS implementation) simply returns the buffer, and so are we now. ILinkedNode was removed as it was not used anywhere in the broader net-ipfs codebase and seems to have been placed there years ago for future plans that were never carried out. --- src/CoreApi/IBitswapApi.cs | 36 ------------------------------------ src/CoreApi/IBlockApi.cs | 2 +- src/CoreApi/IDagApi.cs | 1 - src/IDataBlock.cs | 6 ++---- src/ILinkedNode.cs | 13 ------------- src/IpfsCore.csproj | 10 +++++++++- 6 files changed, 12 insertions(+), 56 deletions(-) delete mode 100644 src/ILinkedNode.cs diff --git a/src/CoreApi/IBitswapApi.cs b/src/CoreApi/IBitswapApi.cs index 1a92b2fb..c7e7bf17 100644 --- a/src/CoreApi/IBitswapApi.cs +++ b/src/CoreApi/IBitswapApi.cs @@ -26,24 +26,6 @@ namespace Ipfs.CoreApi /// Bitswap spec public interface IBitswapApi { - /// - /// Gets a block from the IPFS network. - /// - /// - /// The of the block. - /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// A task that represents the asynchronous get operation. The task's value - /// contains the block's id and data. - /// - /// - /// Waits for another peer to supply the block with the . - /// - Task GetAsync(Cid id, CancellationToken cancel = default); - /// /// The blocks that are needed by a peer. /// @@ -60,24 +42,6 @@ public interface IBitswapApi /// Task> WantsAsync(MultiHash? peer = null, CancellationToken cancel = default); - /// - /// Remove the CID from the want list. - /// - /// - /// The content that is no longer needed. - /// - /// - /// Is used to stop the task. When cancelled, the is raised. - /// - /// - /// A task that represents the asynchronous operation. - /// - /// - /// Any outstanding for the - /// are cancelled. - /// - Task UnwantAsync(Cid id, CancellationToken cancel = default); - /// /// Gets information on the blocks exchanged with a specific . /// diff --git a/src/CoreApi/IBlockApi.cs b/src/CoreApi/IBlockApi.cs index cadf288a..f0bdeed8 100644 --- a/src/CoreApi/IBlockApi.cs +++ b/src/CoreApi/IBlockApi.cs @@ -30,7 +30,7 @@ public interface IBlockApi /// A task that represents the asynchronous get operation. The task's value /// contains the block's id and data. /// - Task GetAsync(Cid id, CancellationToken cancel = default); + Task GetAsync(Cid id, CancellationToken cancel = default); /// /// Stores a byte array as an IPFS block. diff --git a/src/CoreApi/IDagApi.cs b/src/CoreApi/IDagApi.cs index 30acd24c..133a77d1 100644 --- a/src/CoreApi/IDagApi.cs +++ b/src/CoreApi/IDagApi.cs @@ -14,7 +14,6 @@ namespace Ipfs.CoreApi /// This API supports other IPLD formats, such as cbor, ethereum-block, git, ... /// /// - /// /// Dag API spec public interface IDagApi { diff --git a/src/IDataBlock.cs b/src/IDataBlock.cs index 6d30e9cb..f49dc04d 100644 --- a/src/IDataBlock.cs +++ b/src/IDataBlock.cs @@ -1,12 +1,10 @@ -using System.IO; - -namespace Ipfs +namespace Ipfs { /// /// Some data that is stored in IPFS. /// /// - /// A DataBlock has an unique ID + /// A DataBlock has a unique . /// and some data. /// /// It is useful to talk about them as "blocks" in Bitswap diff --git a/src/ILinkedNode.cs b/src/ILinkedNode.cs deleted file mode 100644 index 0e9129fd..00000000 --- a/src/ILinkedNode.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Ipfs -{ - /// - /// InterPlanetary Linked Data. - /// - /// - /// Not yet ready for prime time. - /// - /// - public interface ILinkedNode : IMerkleNode - { - } -} diff --git a/src/IpfsCore.csproj b/src/IpfsCore.csproj index 0cd3836f..64cb909f 100644 --- a/src/IpfsCore.csproj +++ b/src/IpfsCore.csproj @@ -8,7 +8,7 @@ 12.0 - 0.2.0 + 0.3.0 $(Version) @@ -30,6 +30,14 @@ true true +--- 0.3.0 --- +A full analysis of the Bitswap API was made to bring it in line with Kubo's RPC API. + +[Breaking] +GetAsync and UnwantAsync were removed from IBitswapApi. These were not part of Kubo's API, but were intended for custom implementations. To migrate, derive IBitswapApi and add your custom functionality in your library. See also https://discord.com/channels/806902334369824788/942673321852563456/1225047628602151084. +The return type for IBlockApi.GetAsync was changed from IDataBlock to byte[], since IDataBlock was removed in 0.2.0. Kubo's RPC API (including the JS implementation) simply returns the buffer, and so are we now. +ILinkedNode was removed as it was not used anywhere in the broader net-ipfs codebase and seems to have been placed there years ago for future plans that were never carried out. + --- 0.2.0 --- [Breaking] IDataBlock.DataStream was removed. This pattern encouraged async calls behind synchronous property getters, which is a bad practice and can cause deadlocks. Call the async methods directly on the API instead.