-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(IStatsApi): define the statistics/diagnostics interface
- Loading branch information
1 parent
d077c9b
commit 5cc6292
Showing
5 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Ipfs.CoreApi | ||
{ | ||
/// <summary> | ||
/// The statistics for <see cref="IStatsApi.BandwidthAsync"/>. | ||
/// </summary> | ||
public class BandwidthData | ||
{ | ||
/// <summary> | ||
/// The number of bytes received. | ||
/// </summary> | ||
public ulong TotalIn; | ||
|
||
/// <summary> | ||
/// The number of bytes sent. | ||
/// </summary> | ||
public ulong TotalOut; | ||
|
||
/// <summary> | ||
/// TODO | ||
/// </summary> | ||
public double RateIn; | ||
|
||
/// <summary> | ||
/// TODO | ||
/// </summary> | ||
public double RateOut; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Ipfs.CoreApi | ||
{ | ||
/// <summary> | ||
/// The statistics for <see cref="IStatsApi.BitswapAsync"/>. | ||
/// </summary> | ||
public class BitswapData | ||
{ | ||
/// <summary> | ||
/// TODO: Unknown. | ||
/// </summary> | ||
public int ProviderBufLen; | ||
|
||
/// <summary> | ||
/// The content that is wanted. | ||
/// </summary> | ||
public IEnumerable<Cid> WantList; | ||
|
||
/// <summary> | ||
/// The known peers. | ||
/// </summary> | ||
public IEnumerable<MultiHash> Peers; | ||
|
||
/// <summary> | ||
/// The number of blocks sent by other peers. | ||
/// </summary> | ||
public ulong BlocksReceived; | ||
|
||
/// <summary> | ||
/// The number of bytes sent by other peers. | ||
/// </summary> | ||
public ulong DataReceived; | ||
|
||
/// <summary> | ||
/// The number of blocks sent to other peers. | ||
/// </summary> | ||
public ulong BlocksSent; | ||
|
||
/// <summary> | ||
/// The number of bytes sent to other peers. | ||
/// </summary> | ||
public ulong DataSent; | ||
|
||
/// <summary> | ||
/// The number of duplicate blocks sent by other peers. | ||
/// </summary> | ||
/// <remarks> | ||
/// A duplicate block is a block that is already stored in the | ||
/// local repository. | ||
/// </remarks> | ||
public ulong DupBlksReceived; | ||
|
||
/// <summary> | ||
/// The number of duplicate bytes sent by other peers. | ||
/// </summary> | ||
/// <remarks> | ||
/// A duplicate block is a block that is already stored in the | ||
/// local repository. | ||
/// </remarks> | ||
public ulong DupDataReceived; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Ipfs.CoreApi | ||
{ | ||
/// <summary> | ||
/// Get statistics/diagnostics for the various core components. | ||
/// </summary> | ||
public interface IStatsApi | ||
{ | ||
/// <summary> | ||
/// Get statistics on network bandwidth. | ||
/// </summary> | ||
/// <param name="cancel"> | ||
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised. | ||
/// </param> | ||
/// <returns> | ||
/// A task that represents the asynchronous operation. The task's result is | ||
/// the current <see cref="BandwidthData"/>. | ||
/// </returns> | ||
/// <seealso cref="ISwarmApi"/> | ||
Task<BandwidthData> BandwidthAsync(CancellationToken cancel = default(CancellationToken)); | ||
|
||
/// <summary> | ||
/// Get statistics on the blocks exchanged with other peers. | ||
/// </summary> | ||
/// <param name="cancel"> | ||
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised. | ||
/// </param> | ||
/// <returns> | ||
/// A task that represents the asynchronous operation. The task's result is | ||
/// the current <see cref="BitswapData"/>. | ||
/// </returns> | ||
/// <seealso cref="IBitswapApi"/> | ||
Task<BitswapData> BitswapAsync(CancellationToken cancel = default(CancellationToken)); | ||
|
||
/// <summary> | ||
/// Get statistics on repository. | ||
/// </summary> | ||
/// <param name="cancel"> | ||
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised. | ||
/// </param> | ||
/// <returns> | ||
/// A task that represents the asynchronous operation. The task's result is | ||
/// the current <see cref="BandwidthData"/>. | ||
/// </returns> | ||
Task<RepositoryData> RepositoryAsync(CancellationToken cancel = default(CancellationToken)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Ipfs.CoreApi | ||
{ | ||
/// <summary> | ||
/// The statistics for <see cref="IStatsApi.RepositoryAsync"/>. | ||
/// </summary> | ||
public class RepositoryData | ||
{ | ||
/// <summary> | ||
/// The number of blocks in the repository. | ||
/// </summary> | ||
public ulong NumObjects; | ||
|
||
/// <summary> | ||
/// The total number bytes in the repository. | ||
/// </summary> | ||
public ulong RepoSize; | ||
|
||
/// <summary> | ||
/// The fully qualified path to the repository. | ||
/// </summary> | ||
public string RepoPath; | ||
|
||
/// <summary> | ||
/// The version number of the repository. | ||
/// </summary> | ||
public string Version; | ||
|
||
/// <summary> | ||
/// The maximum number of bytes of the repository. | ||
/// </summary> | ||
public ulong StorageMax; | ||
|
||
} | ||
} |