private MemcachedClientApiConfiguration(
            IEnumerable <IPEndPoint> servers,
            ISocketPoolConfiguration socketPoolConfiguration,
            IMemcachedKeyTransformer keyTransformer,
            IMemcachedNodeLocator nodeLocator,
            Func <IMemcachedNodeLocator> nodeLocatorFactory,
            ITranscoder transcoder,
            IAuthenticationConfiguration authentication,
            MemcachedProtocol protocol,
            IPerformanceMonitor performanceMonitor)
        {
            Condition.Requires(socketPoolConfiguration, "socket pool configuration").IsNotNull();
            Condition.Requires(keyTransformer, "key transformer").IsNotNull();
            Condition.Requires(transcoder, "transcoder").IsNotNull();
            Condition.Requires(authentication, "authentication").IsNotNull();
            Condition.Requires(nodeLocator, "node locator")
            .Evaluate(!(nodeLocator == null && nodeLocatorFactory == null),
                      "Both node locator and node locator factory are not set. Requires only one to be set.");
            Condition.Requires(nodeLocator, "node locator")
            .Evaluate(!(nodeLocator == null && nodeLocatorFactory == null),
                      "Both node locator and node locator are set. Requires only one to be set.");
            Condition.Requires(servers, "servers").IsNotNull();

            _socketPoolConfiguration = socketPoolConfiguration;
            _keyTransformer          = keyTransformer;
            _nodeLocator             = nodeLocator;
            _nodeLocatorFactory      = nodeLocatorFactory;
            _transcoder        = transcoder;
            _authentication    = authentication;
            PerformanceMonitor = performanceMonitor;
            Protocol           = protocol;
            _servers           = servers.ToList();
        }
        /// <summary>
        /// Creates new .
        /// </summary>
        /// <param name="performanceMonitor">The performance monitor.</param>
        /// <param name="measurementClassification">The measurement classification.</param>
        /// <returns>PerformanceTimer.</returns>
        public static PerformanceTimer StartNew(IPerformanceMonitor performanceMonitor, IClassification measurementClassification = null)
        {
            var timer = new PerformanceTimer(performanceMonitor, measurementClassification);

            timer._timer.Start();
            return(timer);
        }
        private MemcachedClientApiConfiguration(
			IEnumerable<IPEndPoint> servers,
			ISocketPoolConfiguration socketPoolConfiguration,
			IMemcachedKeyTransformer keyTransformer, 
			IMemcachedNodeLocator nodeLocator, 
			Func<IMemcachedNodeLocator> nodeLocatorFactory, 
			ITranscoder transcoder, 
			IAuthenticationConfiguration authentication, 
			MemcachedProtocol protocol, 
			IPerformanceMonitor performanceMonitor)
        {
            Condition.Requires(socketPoolConfiguration, "socket pool configuration").IsNotNull();
            Condition.Requires(keyTransformer, "key transformer").IsNotNull();
            Condition.Requires(transcoder, "transcoder").IsNotNull();
            Condition.Requires(authentication, "authentication").IsNotNull();
            Condition.Requires(nodeLocator, "node locator")
                .Evaluate(!(nodeLocator == null && nodeLocatorFactory == null),
                "Both node locator and node locator factory are not set. Requires only one to be set.");
            Condition.Requires(nodeLocator, "node locator")
                .Evaluate(!(nodeLocator == null && nodeLocatorFactory == null),
                "Both node locator and node locator are set. Requires only one to be set.");
            Condition.Requires(servers, "servers").IsNotNull();

            _socketPoolConfiguration = socketPoolConfiguration;
            _keyTransformer = keyTransformer;
            _nodeLocator = nodeLocator;
            _nodeLocatorFactory = nodeLocatorFactory;
            _transcoder = transcoder;
            _authentication = authentication;
            PerformanceMonitor = performanceMonitor;
            Protocol = protocol;
            _servers = servers.ToList();
        }
        private async Task Broadcast(Guid transactionId, Transaction tx, IPerformanceMonitor monitor, string hash, bool savePaidFees = true)
        {
            monitor?.Step("Broadcast transaction");
            try
            {
                await _rpcBitcoinClient.BroadcastTransaction(tx, transactionId);
            }
            catch (RPCException ex)
            {
                var builder = new StringBuilder();
                builder.AppendLine($"[{transactionId}], ");
                builder.AppendLine(ex.Message + ":");
                foreach (var input in tx.Inputs)
                {
                    builder.AppendLine(input.PrevOut.ToString());
                }
                await _logger.WriteWarningAsync(nameof(BitcoinBroadcastService), nameof(BroadcastTransaction), builder.ToString(), ex);

                throw;
            }
            monitor?.Step("Set transaction hash and add to monitoring");
            await Task.WhenAll(
                savePaidFees?_paidFeesTaskWriter.AddTask(hash, DateTime.UtcNow, null, null) : Task.CompletedTask,
                _broadcastedOutputRepository.SetTransactionHash(transactionId, hash),
                _monitoringWriter.AddToMonitoring(transactionId, hash)
                );
        }
 public GlimpseAuthorizer(
     IAuthorizationService authorizationService,
     INotifier notifier,
     IWorkContextAccessor workContextAccessor,
     IPerformanceMonitor performanceMonitor)
     : base(authorizationService, notifier, workContextAccessor) {
     _performanceMonitor = performanceMonitor;
 }
 public GlimpseAuthorizer(
     IAuthorizationService authorizationService,
     INotifier notifier,
     IWorkContextAccessor workContextAccessor,
     IPerformanceMonitor performanceMonitor)
     : base(authorizationService, notifier, workContextAccessor)
 {
     _performanceMonitor = performanceMonitor;
 }
        public GlimpseLayerEvaluationService(IRuleManager ruleManager, IPerformanceMonitor performanceMonitor, IOrchardServices orchardServices)
        {
            _ruleManager        = ruleManager;
            _performanceMonitor = performanceMonitor;
            _orchardServices    = orchardServices;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;
        }
 public OutputCachedPartsDisplayManager(IWorkContextAccessor workContextAccessor,
                                        IEnumerable <IShapeDisplayEvents> shapeDisplayEvents,
                                        Lazy <IShapeTableLocator> shapeTableLocator,
                                        IPerformanceMonitor performanceMonitor,
                                        IOutputCachedPartsService outputCachedPartsService)
     : base(workContextAccessor, shapeDisplayEvents, shapeTableLocator, performanceMonitor)
 {
     _outputCachedPartsService = outputCachedPartsService;
 }
 public OutputCachedPartsDisplayManager(IWorkContextAccessor workContextAccessor, 
             IEnumerable<IShapeDisplayEvents> shapeDisplayEvents, 
             Lazy<IShapeTableLocator> shapeTableLocator, 
             IPerformanceMonitor performanceMonitor, 
             IOutputCachedPartsService outputCachedPartsService) 
     : base(workContextAccessor, shapeDisplayEvents, shapeTableLocator, performanceMonitor) 
 {
     _outputCachedPartsService = outputCachedPartsService;
 }
        public GlimpseLayerEvaluationService(IRuleManager ruleManager, IPerformanceMonitor performanceMonitor, IOrchardServices orchardServices)
        {
            _ruleManager = ruleManager;
            _performanceMonitor = performanceMonitor;
            _orchardServices = orchardServices;

            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
        }
Example #11
0
        /// <summary>
        /// Creates new .
        /// </summary>
        /// <param name="performanceMonitor">The performance monitor.</param>
        /// <param name="measurementClassification">The measurement classification.</param>
        /// <returns>PerformanceTimerAttribute.</returns>
        public static PerformanceTimerAttribute StartNew(
            IPerformanceMonitor performanceMonitor,
            IClassification?measurementClassification
            )
        {
            var timer = new PerformanceTimerAttribute(performanceMonitor, measurementClassification);

            timer._timer?.Start();
            return(timer);
        }
Example #12
0
        public CachedLayerEvaluationService(IPerformanceMonitor performanceMonitor, IRuleManager ruleManager, ILayerRetrievalService layerRetrievalService)
        {
            _performanceMonitor    = performanceMonitor;
            _ruleManager           = ruleManager;
            _layerRetrievalService = layerRetrievalService;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;

            _activeLayerIds = new LazyField <int[]>();
            _activeLayerIds.Loader(PopulateActiveLayers);
        }
        public async Task BroadcastTransaction(Guid transactionId, Transaction tx, IPerformanceMonitor monitor = null, bool useHandlers = true, Guid?notifyTxId = null, bool savePaidFees = true)
        {
            var hash = tx.GetHash().ToString();

            if (_settings.UseLykkeApi && useHandlers)
            {
                monitor?.Step("Send prebroadcast notification");
                await _apiProvider.SendPreBroadcastNotification(new LykkeTransactionNotification(notifyTxId ?? transactionId, hash));
            }

            await Broadcast(transactionId, tx, monitor, hash, savePaidFees);
        }
        public CachedLayerEvaluationService(IPerformanceMonitor performanceMonitor, IRuleManager ruleManager, ILayerRetrievalService layerRetrievalService) 
        {
            _performanceMonitor = performanceMonitor;
            _ruleManager = ruleManager;
            _layerRetrievalService = layerRetrievalService;

            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;

            _activeLayerIds = new LazyField<int[]>();
            _activeLayerIds.Loader(PopulateActiveLayers);
        }
Example #15
0
		public MemcachedClient(IServerPool pool, IMemcachedKeyTransformer keyTransformer, ITranscoder transcoder, IPerformanceMonitor performanceMonitor)
		{
			if (pool == null) throw new ArgumentNullException("pool");
			if (keyTransformer == null) throw new ArgumentNullException("keyTransformer");
			if (transcoder == null) throw new ArgumentNullException("transcoder");

			this.performanceMonitor = performanceMonitor;
			this.keyTransformer = keyTransformer;
			this.transcoder = transcoder;

			this.pool = pool;
			this.StartPool();
		}
 public GlimpseDisplayManager(
     IWorkContextAccessor workContextAccessor,
     IEnumerable<IShapeDisplayEvents> shapeDisplayEvents,
     Lazy<IShapeTableLocator> shapeTableLocator,
     IPerformanceMonitor performanceMonitor)
 {
     _shapeTableLocator = shapeTableLocator;
     _performanceMonitor = performanceMonitor;
     _workContextAccessor = workContextAccessor;
     _shapeDisplayEvents = shapeDisplayEvents;
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
 public GlimpseDisplayManager(
     IWorkContextAccessor workContextAccessor,
     IEnumerable <IShapeDisplayEvents> shapeDisplayEvents,
     Lazy <IShapeTableLocator> shapeTableLocator,
     IPerformanceMonitor performanceMonitor)
 {
     _shapeTableLocator   = shapeTableLocator;
     _performanceMonitor  = performanceMonitor;
     _workContextAccessor = workContextAccessor;
     _shapeDisplayEvents  = shapeDisplayEvents;
     T      = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
Example #18
0
 public CachedWidgetFilter(IWorkContextAccessor workContextAccessor,
                           IWidgetsService widgetsService,
                           IOrchardServices orchardServices,
                           IPerformanceMonitor performanceMonitor,
                           ILayerEvaluationService layerEvaluationService)
 {
     _workContextAccessor    = workContextAccessor;
     _widgetsService         = widgetsService;
     _orchardServices        = orchardServices;
     _performanceMonitor     = performanceMonitor;
     _layerEvaluationService = layerEvaluationService;
     Logger = NullLogger.Instance;
     T      = NullLocalizer.Instance;
 }
Example #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:MemcachedClient"/> using the specified configuration instance.
        /// </summary>
        /// <param name="configuration">The memcachedClient configuration.</param>
        public MemcachedClient(IMemcachedClientConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.keyTransformer     = configuration.CreateKeyTransformer() ?? new DefaultKeyTransformer();
            this.transcoder         = configuration.CreateTranscoder() ?? new DefaultTranscoder();
            this.performanceMonitor = configuration.CreatePerformanceMonitor();

            this.pool = configuration.CreatePool();
            this.pool.Start();
        }
 public CachedWidgetFilter(IWorkContextAccessor workContextAccessor, 
     IWidgetsService widgetsService, 
     IOrchardServices orchardServices,
     IPerformanceMonitor performanceMonitor,
     ILayerEvaluationService layerEvaluationService) 
 {
     _workContextAccessor = workContextAccessor;
     _widgetsService = widgetsService;
     _orchardServices = orchardServices;
     _performanceMonitor = performanceMonitor;
     _layerEvaluationService = layerEvaluationService;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
Example #21
0
 public GlimpseWidgetFilter(
     IWorkContextAccessor workContextAccessor,
     IRuleManager ruleManager,
     IWidgetsService widgetsService,
     IOrchardServices orchardServices,
     IPerformanceMonitor performanceMonitor)
 {
     _workContextAccessor = workContextAccessor;
     _ruleManager         = ruleManager;
     _widgetsService      = widgetsService;
     _orchardServices     = orchardServices;
     _performanceMonitor  = performanceMonitor;
     Logger = NullLogger.Instance;
     T      = NullLocalizer.Instance;
 }
 public GlimpseWidgetFilter(
     IWorkContextAccessor workContextAccessor,
     IRuleManager ruleManager,
     IWidgetsService widgetsService,
     IOrchardServices orchardServices,
     IPerformanceMonitor performanceMonitor)
 {
     _workContextAccessor = workContextAccessor;
     _ruleManager = ruleManager;
     _widgetsService = widgetsService;
     _orchardServices = orchardServices;
     _performanceMonitor = performanceMonitor;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
        /// <summary>
        /// Releases all resources allocated by this instance
        /// </summary>
        /// <remarks>You should only call this when you are not using static instances of the client, so it can close all conections and release the sockets.</remarks>
        public void Dispose()
        {
            GC.SuppressFinalize(this);

            if (this.pool != null)
            {
                try { this.pool.Dispose(); }
                finally { this.pool = null; }
            }

            if (this.performanceMonitor != null)
            {
                try { this.performanceMonitor.Dispose(); }
                finally { this.performanceMonitor = null; }
            }
        }
Example #24
0
		/// <summary>
		/// Initializes a new instance of the <see cref="T:MemcachedClient"/> using the specified configuration instance.
		/// </summary>
		/// <param name="configuration">The client configuration.</param>
		public MemcachedClient(IMemcachedClientConfiguration configuration)
		{
			if (configuration == null)
				throw new ArgumentNullException("configuration");

			this.keyTransformer = configuration.CreateKeyTransformer() ?? new DefaultKeyTransformer();
			this.transcoder = configuration.CreateTranscoder() ?? new DefaultTranscoder();
			this.performanceMonitor = configuration.CreatePerformanceMonitor();

			this.pool = configuration.CreatePool();
			this.pool.NodeFailed += (n) => { var f = this.NodeFailed; if (f != null) f(n); };
			this.StartPool();

			StoreOperationResultFactory = new DefaultStoreOperationResultFactory();
			GetOperationResultFactory = new DefaultGetOperationResultFactory();
			MutateOperationResultFactory = new DefaultMutateOperationResultFactory();
			ConcatOperationResultFactory = new DefaultConcatOperationResultFactory();
			RemoveOperationResultFactory = new DefaultRemoveOperationResultFactory();
		}
 public GlimpseContentManager(
     IComponentContext context,
     IRepository<ContentTypeRecord> contentTypeRepository,
     IRepository<ContentItemRecord> contentItemRepository,
     IRepository<ContentItemVersionRecord> contentItemVersionRepository,
     IContentDefinitionManager contentDefinitionManager,
     ICacheManager cacheManager,
     Func<IContentManagerSession> contentManagerSession,
     Lazy<IContentDisplay> contentDisplay,
     Lazy<ISessionLocator> sessionLocator,
     Lazy<IEnumerable<IContentHandler>> handlers,
     Lazy<IEnumerable<IIdentityResolverSelector>> identityResolverSelectors,
     Lazy<IEnumerable<ISqlStatementProvider>> sqlStatementProviders,
     ShellSettings shellSettings,
     ISignals signals,
     IPerformanceMonitor performanceMonitor)
     : base(context, contentTypeRepository, contentItemRepository, contentItemVersionRepository, contentDefinitionManager, cacheManager, contentManagerSession, contentDisplay, sessionLocator, handlers, identityResolverSelectors, sqlStatementProviders, shellSettings, signals)
 {
     _performanceMonitor = performanceMonitor;
 }
 public GlimpseContentManager(
     IComponentContext context,
     IRepository <ContentTypeRecord> contentTypeRepository,
     IRepository <ContentItemRecord> contentItemRepository,
     IRepository <ContentItemVersionRecord> contentItemVersionRepository,
     IContentDefinitionManager contentDefinitionManager,
     ICacheManager cacheManager,
     Func <IContentManagerSession> contentManagerSession,
     Lazy <IContentDisplay> contentDisplay,
     Lazy <ISessionLocator> sessionLocator,
     Lazy <IEnumerable <IContentHandler> > handlers,
     Lazy <IEnumerable <IIdentityResolverSelector> > identityResolverSelectors,
     Lazy <IEnumerable <ISqlStatementProvider> > sqlStatementProviders,
     ShellSettings shellSettings,
     ISignals signals,
     IPerformanceMonitor performanceMonitor)
     : base(context, contentTypeRepository, contentItemRepository, contentItemVersionRepository, contentDefinitionManager, cacheManager, contentManagerSession, contentDisplay, sessionLocator, handlers, identityResolverSelectors, sqlStatementProviders, shellSettings, signals)
 {
     _performanceMonitor = performanceMonitor;
 }
Example #27
0
        /// <summary>
        ///     Constructs a new magic command given a resolver used to find
        ///     operations and functions, and a configuration source used to set
        ///     configuration options.
        /// </summary>
        public SimulateMagic(ISymbolResolver resolver, IConfigurationSource configurationSource, IPerformanceMonitor monitor, ILogger <SimulateMagic> logger) : base(
                "simulate",
                new Microsoft.Jupyter.Core.Documentation
        {
            Summary     = "Runs a given function or operation on the QuantumSimulator target machine.",
            Description = @"
                    This magic command allows executing a given function or operation on the QuantumSimulator, 
                    which performs a full-state simulation of the given function or operation
                    and prints the resulting return value.

                    See the [QuantumSimulator user guide](https://docs.microsoft.com/azure/quantum/user-guide/machines/full-state-simulator) to learn more.

                    #### Required parameters

                    - Q# operation or function name. This must be the first parameter, and must be a valid Q# operation
                    or function name that has been defined either in the notebook or in a Q# file in the same folder.
                    - Arguments for the Q# operation or function must also be specified as `key=value` pairs.
                ".Dedent(),
            Examples    = new []
            {
                @"
                        Simulate a Q# operation defined as `operation MyOperation() : Result`:
                        ```
                        In []: %simulate MyOperation
                        Out[]: <return value of the operation>
                        ```
                    ".Dedent(),
                @"
                        Simulate a Q# operation defined as `operation MyOperation(a : Int, b : Int) : Result`:
                        ```
                        In []: %simulate MyOperation a=5 b=10
                        Out[]: <return value of the operation>
                        ```
                    ".Dedent(),
            }
        }, logger)
        {
            this.SymbolResolver      = resolver;
            this.ConfigurationSource = configurationSource;
            this.Monitor             = monitor;
        }
Example #28
0
        static PassiveDevices()
        {
#if DEBUG
            // Load emulated input devices
            var deviceContainer = Type.GetType("RmEmulator.EmulatedDevices, RmEmulator");
            if (deviceContainer != null)
            {
                deviceContainer.ReadStaticField("Performance", out Performance);
                deviceContainer.ReadStaticField("Battery", out Battery);
                deviceContainer.ReadStaticField("UsbPower", out UsbPower);
                deviceContainer.ReadStaticField("Wireless", out Wireless);

                return;
            }
#endif

            Performance = new HardwarePeformanceMonitor();
            Battery     = new HardwareBatteryMonitor("/sys/class/power_supply/bq27441-0");
            UsbPower    = new HardwareBatteryMonitor("/sys/class/power_supply/imx_usb_charger");
            Wireless    = new HardwareWirelessMonitor();
        }
Example #29
0
        /// <summary>
        /// The main constructor. It expects an `ISnippets` instance that takes care
        /// of compiling and keeping track of the code Snippets provided by users.
        /// </summary>
        public IQSharpEngine(
            IShellServer shell,
            IOptions <KernelContext> context,
            ILogger <IQSharpEngine> logger,
            IServiceProvider services,
            IConfigurationSource configurationSource,
            IPerformanceMonitor performanceMonitor,
            IShellRouter shellRouter,
            IMetadataController metadataController,
            ICommsRouter commsRouter,
            IEventService eventService
            ) : base(shell, shellRouter, context, logger, services)
        {
            this.performanceMonitor = performanceMonitor;
            performanceMonitor.EnableBackgroundReporting     = true;
            performanceMonitor.OnKernelPerformanceAvailable += (source, args) =>
            {
                logger.LogInformation(
                    "Estimated RAM usage:" +
                    "\n\tManaged: {Managed} bytes" +
                    "\n\tTotal:   {Total} bytes",
                    args.ManagedRamUsed,
                    args.TotalRamUsed
                    );
            };
            performanceMonitor.Start();
            this.configurationSource = configurationSource;
            this.services            = services;
            this.logger             = logger;
            this.metadataController = metadataController;
            this.commsRouter        = commsRouter;
            this.eventService       = eventService;

            // Start comms routers as soon as possible, so that they can
            // be responsive during kernel startup.
            this.AttachCommsListeners();
        }
 public SiteSettingsFilter(IOrchardServices orchardServices, IPerformanceMonitor performanceMonitor)
 {
     _orchardServices    = orchardServices;
     _performanceMonitor = performanceMonitor;
 }
        public async Task BroadcastTransaction(Guid transactionId, List <Guid> notificationIds, Transaction tx, IPerformanceMonitor monitor = null, bool useHandlers = true)
        {
            var hash = tx.GetHash().ToString();

            if (_settings.UseLykkeApi && useHandlers)
            {
                monitor?.Step("Send prebroadcast multi notification");
                await _apiProvider.SendPreBroadcastMultiNotification(new LykkeTransactionMultiNotification(notificationIds, hash));
            }

            await Broadcast(transactionId, tx, monitor, hash);

            if (_settings.UseLykkeApi && useHandlers)
            {
                monitor?.Step("Send postbroadcast multi notification");
                await _apiProvider.SendPostBroadcastMultiNotification(new LykkeTransactionMultiNotification(notificationIds, hash));
            }
        }
 public EnabledFeaturesFilter(IFeatureManager featureManager, IPerformanceMonitor performanceMonitor) {
     _featureManager = featureManager;
     _performanceMonitor = performanceMonitor;
 }
 public async Task <IEnumerable <ColoredCoin> > GetColoredUnspentOutputs(string walletAddress, int confirmationsCount = 0, bool useInternalSpentOutputs = true, IPerformanceMonitor monitor = null)
 {
     return((await GetUnspentOutputs(walletAddress, confirmationsCount, useInternalSpentOutputs, monitor)).OfType <ColoredCoin>().ToList());
 }
Example #34
0
 /// <summary>
 /// Creates new .
 /// </summary>
 /// <param name="performanceMonitor">The performance monitor.</param>
 /// <returns>PerformanceTimerAttribute.</returns>
 public static PerformanceTimerAttribute StartNew(
     IPerformanceMonitor performanceMonitor
     )
 {
     return(StartNew(performanceMonitor, null));
 }
        private async Task AddBroadcastedOutputs(List <ICoin> coins, string walletAddress, int confirmationsCount, IPerformanceMonitor monitor)
        {
            //get unique saved coins
            if (confirmationsCount == 0)
            {
                var set = new HashSet <OutPoint>(coins.Select(x => x.Outpoint));

                monitor?.Step("Get broadcasted outputs");
                var internalSavedOutputs = (await _broadcastedOutputRepository.GetOutputs(walletAddress))
                                           .Where(o => !set.Contains(new OutPoint(uint256.Parse(o.TransactionHash), o.N)));

                coins.AddRange(internalSavedOutputs.Select(o =>
                {
                    var coin = new Coin(new OutPoint(uint256.Parse(o.TransactionHash), o.N),
                                        new TxOut(new Money(o.Amount, MoneyUnit.Satoshi), o.ScriptPubKey.ToScript()));
                    if (o.AssetId != null)
                    {
                        return
                        ((ICoin)
                         coin.ToColoredCoin(new BitcoinAssetId(o.AssetId, _connectionParams.Network).AssetId,
                                            (ulong)o.Quantity));
                    }
                    return(coin);
                }));
            }
        }
Example #36
0
 public EnabledFeaturesFilter(IFeatureManager featureManager, IPerformanceMonitor performanceMonitor)
 {
     _featureManager     = featureManager;
     _performanceMonitor = performanceMonitor;
 }
Example #37
0
 public static void SetCurrentMonitor <TMonitor>()
     where TMonitor : IPerformanceMonitor <TTask>
 {
     _current = Activator.CreateInstance <TMonitor>();
 }
 public GlimpseContentPartDriverCoordinator(IEnumerable<IContentPartDriver> drivers, IContentDefinitionManager contentDefinitionManager,  IPerformanceMonitor performanceMonitor)
     : base(drivers, contentDefinitionManager)
 {
     _drivers = drivers;
     _performanceMonitor = performanceMonitor;
 }
Example #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PerformanceTimerAttribute"/> class.
 /// </summary>
 /// <param name="performanceMonitor">The performance monitor.</param>
 /// <param name="measurementClassification">The measurement classification.</param>
 private PerformanceTimerAttribute(IPerformanceMonitor performanceMonitor, IClassification?measurementClassification = null)
 {
     this._performanceMonitor        = performanceMonitor;
     this._measurementClassification = measurementClassification;
     this._timer = new Stopwatch();
 }
Example #40
0
 public GlimpseContentPartDriverCoordinator(IEnumerable <IContentPartDriver> drivers, IContentDefinitionManager contentDefinitionManager, IPerformanceMonitor performanceMonitor)
     : base(drivers, contentDefinitionManager)
 {
     _drivers            = drivers;
     _performanceMonitor = performanceMonitor;
 }
 public SiteSettingsFilter(IOrchardServices orchardServices, IPerformanceMonitor performanceMonitor) {
     _orchardServices = orchardServices;
     _performanceMonitor = performanceMonitor;
 }
        public async Task <IEnumerable <ICoin> > GetUnspentOutputs(string walletAddress, int confirmationsCount = 0, bool useInternalSpentOutputs = true, IPerformanceMonitor monitor = null)
        {
            monitor?.Step("Get address balance");
            var outputResponse = await _qBitNinjaApiCaller.GetAddressBalance(walletAddress);

            var coins = outputResponse.Operations
                        .Where(x => x.Confirmations >= Math.Max(1, confirmationsCount))
                        .SelectMany(o => o.ReceivedCoins).ToList();

            await AddBroadcastedOutputs(coins, walletAddress, confirmationsCount, monitor);

            coins = await FilterCoins(coins, useInternalSpentOutputs, monitor);

            return(await ToScriptCoins(walletAddress, coins));
        }