Пример #1
1
        /// <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);
        }
Пример #4
0
 internal SwarmApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #5
0
 internal BlockApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #6
0
 internal PinnedCollection(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #7
0
 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);
 }
Пример #11
0
 internal PinApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #12
0
 internal BootstrapApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #13
0
 public void Version_Is_Present()
 {
     var ipfs = new IpfsClient();
     var version = ipfs.Version().Result;
     Assert.IsNotNull(version);
 }
Пример #14
0
        public void Can_Create()
        {
            IpfsClient target = TestFixture.Ipfs;

            Assert.IsNotNull(target);
        }
Пример #15
0
 public void AddText()
 {
     var ipfs = new IpfsClient();
     var result = ipfs.AddTextAsync("hello world").Result; ;
     Assert.AreEqual("Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD", result.Hash);
 }
Пример #16
0
 internal FileSystemApi(IpfsClient ipfs)
 {
     this.ipfs        = ipfs;
     this.emptyFolder = new Lazy <DagNode>(() => ipfs.Object.NewDirectoryAsync().Result);
 }
Пример #17
0
 internal BitswapApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #18
0
 internal ConfigApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #19
0
 internal ObjectApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #20
0
 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");
 }
Пример #22
0
        /// <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;
        }
Пример #23
0
 internal DagApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #24
0
 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);
 }
Пример #26
0
        public void Api_Exists()
        {
            IpfsClient ipfs = TestFixture.Ipfs;

            Assert.IsNotNull(ipfs.PubSub);
        }