Exemplo n.º 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);
        }
Exemplo n.º 4
0
 internal SwarmApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Exemplo n.º 5
0
 internal BlockApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Exemplo n.º 6
0
 internal PinnedCollection(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Exemplo n.º 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");
 }
Exemplo n.º 10
0
 public void Can_Create()
 {
     IpfsClient target = new IpfsClient();
     Assert.IsNotNull(target);
 }
Exemplo n.º 11
0
 internal PinApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Exemplo n.º 12
0
 internal BootstrapApi(IpfsClient ipfs)
 {
     this.ipfs = ipfs;
 }
Exemplo n.º 13
0
 public void Version_Is_Present()
 {
     var ipfs = new IpfsClient();
     var version = ipfs.Version().Result;
     Assert.IsNotNull(version);
 }
Exemplo n.º 14
0
        public void Can_Create()
        {
            IpfsClient target = TestFixture.Ipfs;

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

            Assert.IsNotNull(ipfs.PubSub);
        }