public DeltaHubWithFastRetryPolicy(IBroadcastManager broadcastManager,
                                    IPeerSettings peerSettings,
                                    IDfs dfs,
                                    IHashProvider hashProvider,
                                    ILogger logger) : base(broadcastManager, peerSettings, dfs, hashProvider, logger)
 {
 }
Ejemplo n.º 2
0
        public CatalystNodePoa(IKeySigner keySigner,
                               IPeerService peer,
                               IConsensus consensus,
                               IDfs dfs,
                               ILedger ledger,
                               ILogger logger,
                               IPeerClient peerClient,
                               IPeerSettings peerSettings,
                               IMempool <PublicEntryDao> memPool,
                               IContract contract = null)
        {
            _peer         = peer;
            _peerClient   = peerClient;
            _peerSettings = peerSettings;
            Consensus     = consensus;
            _dfs          = dfs;
            _ledger       = ledger;
            _keySigner    = keySigner;
            _logger       = logger;
            _memPool      = memPool;
            _contract     = contract;

            var privateKey = keySigner.KeyStore.KeyStoreDecrypt(KeyRegistryTypes.DefaultKey);

            _publicKey = keySigner.CryptoContext.GetPublicKeyFromPrivateKey(privateKey);
        }
Ejemplo n.º 3
0
        public DevDfsTests(ITestOutputHelper output) : base(output)
        {
            var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));

            _cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(200)).Token;
            _dfs = new DevDfs(FileSystem, hashProvider);
        }
Ejemplo n.º 4
0
 /// <summary>Initializes a new instance of the <see cref="AddFileToDfsRequestObserver"/> class.</summary>
 /// <param name="dfs">The DFS.</param>
 /// <param name="peerSettings"></param>
 /// <param name="fileTransferFactory">The download file transfer factory.</param>
 /// <param name="logger">The logger.</param>
 public AddFileToDfsRequestObserver(IDfs dfs,
                                    IPeerSettings peerSettings,
                                    IDownloadFileTransferFactory fileTransferFactory,
                                    ILogger logger) : base(logger, peerSettings)
 {
     _fileTransferFactory = fileTransferFactory;
     _dfs = dfs;
 }
 /// <summary>Initializes a new instance of the <see cref="AddFileToDfsRequestObserver" /> class.</summary>
 /// <param name="dfs">The DFS.</param>
 /// <param name="peerSettings"></param>
 /// <param name="fileTransferFactory">The upload file transfer factory.</param>
 /// <param name="logger">The logger.</param>
 public GetFileFromDfsRequestObserver(IDfs dfs,
                                      IPeerSettings peerSettings,
                                      IUploadFileTransferFactory fileTransferFactory,
                                      ILogger logger) : base(logger, peerSettings)
 {
     _fileTransferFactory = fileTransferFactory;
     _dfs = dfs;
 }
Ejemplo n.º 6
0
 public GetFileFromDfsObserverHandlerTests(ITestOutputHelper testOutput) : base(testOutput)
 {
     _hashProvider        = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));
     _logger              = Substitute.For <ILogger>();
     _fakeContext         = Substitute.For <IChannelHandlerContext>();
     _fileDownloadFactory = new DownloadFileTransferFactory(_logger);
     _logger              = Substitute.For <ILogger>();
     _dfs = Substitute.For <IDfs>();
 }
        public GetFileFromDfsRequestObserverTests()
        {
            _hashProvider        = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));
            _fileTransferFactory = Substitute.For <IUploadFileTransferFactory>();
            _dfs = Substitute.For <IDfs>();
            var peerSettings = PeerIdHelper.GetPeerId("test").ToSubstitutedPeerSettings();

            _observer = new GetFileFromDfsRequestObserver(_dfs, _hashProvider, peerSettings, _fileTransferFactory,
                                                          Substitute.For <ILogger>());
        }
Ejemplo n.º 8
0
        public DeltaDfsReaderTests()
        {
            var hashingAlgorithm = HashingAlgorithm.GetAlgorithmMetadata("blake2b-256");

            _hashProvider = new HashProvider(hashingAlgorithm);
            _dfs          = Substitute.For <IDfs>();
            _logger       = Substitute.For <ILogger>();

            _dfsReader = new DeltaDfsReader(_dfs, _logger);
        }
Ejemplo n.º 9
0
 public LedgerController(IDeltaHashProvider deltaHashProvider,
                         IDfs dfs,
                         IMapperProvider mapperProvider,
                         ILogger logger)
 {
     _deltaHashProvider = deltaHashProvider;
     _dfs            = dfs;
     _mapperProvider = mapperProvider;
     _logger         = logger;
 }
Ejemplo n.º 10
0
        public DeltaHubTests()
        {
            _hashProvider     = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));
            _broadcastManager = Substitute.For <IBroadcastManager>();
            var logger = Substitute.For <ILogger>();

            _peerId = PeerIdHelper.GetPeerId("me");
            _dfs    = Substitute.For <IDfs>();
            _hub    = new DeltaHubWithFastRetryPolicy(_broadcastManager, _peerId.ToSubstitutedPeerSettings(), _dfs,
                                                      logger);
        }
Ejemplo n.º 11
0
        public DeltaHub(IBroadcastManager broadcastManager,
                        IPeerSettings peerSettings,
                        IDfs dfs,
                        ILogger logger)
        {
            _broadcastManager = broadcastManager;
            _peerId           = peerSettings.PeerId;
            _dfs    = dfs;
            _logger = logger;

            DfsRetryPolicy = Polly.Policy <Cid> .Handle <Exception>()
                             .WaitAndRetryAsync(4, retryAttempt =>
                                                TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
        }
Ejemplo n.º 12
0
        public AddFileToDfsRequestObserverTests()
        {
            _hashProvider     = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));
            _manualResetEvent = new ManualResetEvent(false);
            _senderIdentifier = PeerIdHelper.GetPeerId("sender");
            var peerSettings = _senderIdentifier.ToSubstitutedPeerSettings();

            _fakeDfs = Substitute.For <IDfs>();
            var logger = Substitute.For <ILogger>();

            _fakeContext                 = Substitute.For <IChannelHandlerContext>();
            _nodeFileTransferFactory     = Substitute.For <IDownloadFileTransferFactory>();
            _addFileToDfsRequestObserver = new AddFileToDfsRequestObserver(_fakeDfs,
                                                                           peerSettings,
                                                                           _nodeFileTransferFactory,
                                                                           logger);
        }
        public NodeFileTransferTests(ITestOutputHelper testOutput) : base(testOutput)
        {
            var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));

            _logger                  = Substitute.For <ILogger>();
            _fakeContext             = Substitute.For <IChannelHandlerContext>();
            _nodeFileTransferFactory = new DownloadFileTransferFactory(_logger);

            var passwordManager = Substitute.For <IPasswordManager>();

            passwordManager
            .RetrieveOrPromptAndAddPasswordToRegistry(PasswordRegistryTypes.IpfsPassword, Arg.Any <string>())
            .Returns(TestPasswordReader.BuildSecureStringPassword("abcd"));

            var ipfsEngine = new IpfsAdapter(passwordManager, FileSystem, _logger);

            _logger = Substitute.For <ILogger>();
            _dfs    = new Dfs(ipfsEngine, hashProvider, _logger);
        }
Ejemplo n.º 14
0
 public DeltaDfsReader(IDfs dfs, ILogger logger)
 {
     _dfs    = dfs;
     _logger = logger;
 }