Skip to content

Commit 94d9e32

Browse files
committed
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.
1 parent bdc52b4 commit 94d9e32

File tree

6 files changed

+12
-56
lines changed

6 files changed

+12
-56
lines changed

src/CoreApi/IBitswapApi.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,6 @@ namespace Ipfs.CoreApi
2626
/// <seealso href="https://github.com/ipfs/specs/tree/master/bitswap">Bitswap spec</seealso>
2727
public interface IBitswapApi
2828
{
29-
/// <summary>
30-
/// Gets a block from the IPFS network.
31-
/// </summary>
32-
/// <param name="id">
33-
/// The <see cref="Cid"/> of the <see cref="IDataBlock">block</see>.
34-
/// </param>
35-
/// <param name="cancel">
36-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
37-
/// </param>
38-
/// <returns>
39-
/// A task that represents the asynchronous get operation. The task's value
40-
/// contains the block's id and data.
41-
/// </returns>
42-
/// <remarks>
43-
/// Waits for another peer to supply the block with the <paramref name="id"/>.
44-
/// </remarks>
45-
Task<IDataBlock> GetAsync(Cid id, CancellationToken cancel = default);
46-
4729
/// <summary>
4830
/// The blocks that are needed by a peer.
4931
/// </summary>
@@ -60,24 +42,6 @@ public interface IBitswapApi
6042
/// </returns>
6143
Task<IEnumerable<Cid>> WantsAsync(MultiHash? peer = null, CancellationToken cancel = default);
6244

63-
/// <summary>
64-
/// Remove the CID from the want list.
65-
/// </summary>
66-
/// <param name="id">
67-
/// The content that is no longer needed.
68-
/// </param>
69-
/// <param name="cancel">
70-
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
71-
/// </param>
72-
/// <returns>
73-
/// A task that represents the asynchronous operation.
74-
/// </returns>
75-
/// <remarks>
76-
/// Any outstanding <see cref="GetAsync(Cid, CancellationToken)"/> for the
77-
/// <paramref name="id"/> are cancelled.
78-
/// </remarks>
79-
Task UnwantAsync(Cid id, CancellationToken cancel = default);
80-
8145
/// <summary>
8246
/// Gets information on the blocks exchanged with a specific <see cref="Peer"/>.
8347
/// </summary>

src/CoreApi/IBlockApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public interface IBlockApi
3030
/// A task that represents the asynchronous get operation. The task's value
3131
/// contains the block's id and data.
3232
/// </returns>
33-
Task<IDataBlock> GetAsync(Cid id, CancellationToken cancel = default);
33+
Task<byte[]> GetAsync(Cid id, CancellationToken cancel = default);
3434

3535
/// <summary>
3636
/// Stores a byte array as an IPFS block.

src/CoreApi/IDagApi.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace Ipfs.CoreApi
1414
/// This API supports other IPLD formats, such as cbor, ethereum-block, git, ...
1515
/// </remarks>
1616
/// <seealso cref="IObjectApi"/>
17-
/// <seealso cref="ILinkedNode"/>
1817
/// <seealso href="https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/DAG.md">Dag API spec</seealso>
1918
public interface IDagApi
2019
{

src/IDataBlock.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
using System.IO;
2-
3-
namespace Ipfs
1+
namespace Ipfs
42
{
53
/// <summary>
64
/// Some data that is stored in IPFS.
75
/// </summary>
86
/// <remarks>
9-
/// A <b>DataBlock</b> has an <see cref="Id">unique ID</see>
7+
/// A <b>DataBlock</b> has a unique <see cref="Id">.</see>
108
/// and some data.
119
/// <para>
1210
/// It is useful to talk about them as "blocks" in Bitswap

src/ILinkedNode.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/IpfsCore.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<LangVersion>12.0</LangVersion>
99

1010
<!-- https://semver.org/spec/v2.0.0.html -->
11-
<Version>0.2.0</Version>
11+
<Version>0.3.0</Version>
1212
<AssemblyVersion>$(Version)</AssemblyVersion>
1313

1414
<!-- Nuget specs -->
@@ -30,6 +30,14 @@
3030
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
3131
<GenerateDocumentationFile>true</GenerateDocumentationFile>
3232
<PackageReleaseNotes>
33+
--- 0.3.0 ---
34+
A full analysis of the Bitswap API was made to bring it in line with Kubo's RPC API.
35+
36+
[Breaking]
37+
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.
38+
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.
39+
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.
40+
3341
--- 0.2.0 ---
3442
[Breaking]
3543
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.

0 commit comments

Comments
 (0)