/// <summary> /// Get block statistics about the node, <c>ipfs block stat <i>key</i></c> /// </summary> /// <remarks> /// The object stats include the block stats. /// </remarks> void GetBlockStats() { if (hasBlockStats) return; var stats = new IpfsClient().DoCommand<dynamic>("block/stat", Hash); if (stats.Key != Hash) throw new IpfsException("Did not receive block/stat for the request merkle node."); blockSize = stats.Size; hasBlockStats = true; }
public void Trusted_Peers_Add_Remove() { var ipfs = new IpfsClient(); Assert.IsFalse(ipfs.TrustedPeers.Contains(newTrustedPeer)); ipfs.TrustedPeers.Add(newTrustedPeer); Assert.IsTrue(ipfs.TrustedPeers.Contains(newTrustedPeer)); ipfs.TrustedPeers.Remove(newTrustedPeer); Assert.IsFalse(ipfs.TrustedPeers.Contains(newTrustedPeer)); }
public void Trusted_Peers_Clear() { var ipfs = new IpfsClient(); var original = ipfs.TrustedPeers.ToArray(); ipfs.TrustedPeers.Clear(); Assert.AreEqual(0, ipfs.TrustedPeers.Count); foreach (var a in original) ipfs.TrustedPeers.Add(a); }
internal SwarmApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal BlockApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal PinnedCollection(IpfsClient ipfs) { this.ipfs = ipfs; }
internal PubSubApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal TrustedPeerCollection(IpfsClient ipfs) { this.ipfs = ipfs; }
public void Trusted_Peers_Add_Missing_Peer_ID() { var missingPeerId = new MultiAddress("/ip4/25.196.147.100/tcp/4001"); var ipfs = new IpfsClient(); ExceptionAssert.Throws<IpfsException>(() => ipfs.TrustedPeers.Add(missingPeerId), "invalid ipfs address"); }
public void Can_Create() { IpfsClient target = new IpfsClient(); Assert.IsNotNull(target); }
internal PinApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal BootstrapApi(IpfsClient ipfs) { this.ipfs = ipfs; }
public void Version_Is_Present() { var ipfs = new IpfsClient(); var version = ipfs.Version().Result; Assert.IsNotNull(version); }
public void Can_Create() { IpfsClient target = TestFixture.Ipfs; Assert.IsNotNull(target); }
public void AddText() { var ipfs = new IpfsClient(); var result = ipfs.AddTextAsync("hello world").Result; ; Assert.AreEqual("Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD", result.Hash); }
internal FileSystemApi(IpfsClient ipfs) { this.ipfs = ipfs; this.emptyFolder = new Lazy <DagNode>(() => ipfs.Object.NewDirectoryAsync().Result); }
internal BitswapApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal ConfigApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal ObjectApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal KeyApi(IpfsClient ipfs) { this.ipfs = ipfs; }
public void Do_Command_Throws_IpfsException_On_Invalid_Command() { IpfsClient target = new IpfsClient(); object unknown; ExceptionAssert.Throws<IpfsException>(() => unknown = target.DoCommandAsync("foobar").Result, "Invalid command"); }
/// <summary> /// Get object statistics about the node, <c>ipfs object stat <i>hash</i></c> /// </summary> /// <remarks> /// The object stats include the block stats. /// </remarks> void GetObjectStats() { if (hasObjectStats) return; var stats = new IpfsClient().DoCommand<dynamic>("object/stat", Hash); if (stats.Hash != Hash) throw new IpfsException("Did not receive object/stat for the request merkle node."); blockSize = stats.BlockSize; cumulativeSize = stats.CumulativeSize; dataSize = stats.DataSize; linksSize = stats.LinksSize; linksCount = stats.NumLinks; hasObjectStats = true; hasBlockStats = true; }
internal DagApi(IpfsClient ipfs) { this.ipfs = ipfs; }
internal NameApi(IpfsClient ipfs) { this.ipfs = ipfs; }
public void Trusted_Peers_List() { var ipfs = new IpfsClient(); Assert.IsNotNull(ipfs.TrustedPeers); Assert.IsTrue(ipfs.TrustedPeers.Count > 0); }
public void Api_Exists() { IpfsClient ipfs = TestFixture.Ipfs; Assert.IsNotNull(ipfs.PubSub); }