예제 #1
0
        public ReposIndexer(
            IGitRepoSearcher searcher,
            ILogger <ReposIndexer> logger,
            IRepositoriesCache repoCache,
            IConfigFileParser configFileParser,
            IRepoFetcher repoFetcher,
            ICloudBlobClient cloudClient,
            IOptionsSnapshot <GitHubIndexerConfiguration> configuration,
            ITelemetryService telemetry)
        {
            _searcher         = searcher ?? throw new ArgumentNullException(nameof(searcher));
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
            _repoCache        = repoCache ?? throw new ArgumentNullException(nameof(repoCache));
            _configFileParser = configFileParser ?? throw new ArgumentNullException(nameof(configFileParser));
            _repoFetcher      = repoFetcher ?? throw new ArgumentNullException(nameof(repoFetcher));

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _maxDegreeOfParallelism = configuration.Value.MaxDegreeOfParallelism;
            _repoIndexingTimeout    = configuration.Value.RepoIndexingTimeout;
            _sleepAfterSuccess      = configuration.Value.SleepAfterSuccess;
            _cloudClient            = cloudClient ?? throw new ArgumentNullException(nameof(cloudClient));
            _telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
        }
예제 #2
0
        public CloudBlobFileStorageService(ICloudBlobClient client)
        {
            this.client = client;

            PrepareContainer(Constants.PackagesFolderName, isPublic: true);
            PrepareContainer(Constants.UploadsFolderName, isPublic: false);
        }
        public CloudBlobFileStorageService(ICloudBlobClient client)
        {
            this.client = client;

            PrepareContainer(Constants.PackagesFolderName, isPublic: true);
            PrepareContainer(Constants.UploadsFolderName, isPublic: false);
        }
        /// <summary>
        /// Initializes a new instance of the CloudBlobClient class using Shared Access Signatures to perform operations.
        /// </summary>
        /// <param name="sasServiceClient">The Shared Access Signature service client.</param>
        public CloudBlobClient(ISharedAccessSignatureServiceClient sasServiceClient)
        {
            if (sasServiceClient == null)
                throw new ArgumentNullException("sasServiceClient", "The Shared Access Signature service client cannot be null.");

            this.strategy = new InnerSharedAccessSignatureServiceCloudBlobClientStrategy(sasServiceClient);
            this.Dispatcher = sasServiceClient.Dispatcher;
        }
        public CloudBlobFileStorageService(ICloudBlobClient client, IConfiguration configuration)
        {
            this.client = client;
            this.configuration = configuration;

            PrepareContainer(Constants.PackagesFolderName, isPublic: true);
            PrepareContainer(Constants.DownloadsFolderName, isPublic: true);
            PrepareContainer(Constants.UploadsFolderName, isPublic: false);
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the CloudBlobClient class to perform operations with Blobs and Containers using Shared Access Signatures.
        /// </summary>
        /// <param name="sasService">A valid Shared Access Signature service client instance.</param>
        /// <param name="credentials"></param>
        public CloudBlobClient(ISharedAccessSignatureServiceClient sasService)
        {
            if (sasService == null)
            {
                throw new ArgumentNullException("sasService", "The Shared Access Signature service client cannot be null.");
            }

            this.strategy = new SharedAccessSignatureServiceCloudBlobClientStrategy(sasService);
        }
예제 #7
0
        public CloudBlobFileStorageService(ICloudBlobClient client, IConfiguration configuration)
        {
            this.client        = client;
            this.configuration = configuration;

            PrepareContainer(Constants.PackagesFolderName, isPublic: true);
            PrepareContainer(Constants.DownloadsFolderName, isPublic: true);
            PrepareContainer(Constants.UploadsFolderName, isPublic: false);
        }
 public CloudBlobCoreFileStorageService(
     ICloudBlobClient client,
     IDiagnosticsService diagnosticsService,
     ICloudBlobContainerInformationProvider cloudBlobFolderInformationProvider)
 {
     _client = client ?? throw new ArgumentNullException(nameof(client));
     _trace  = diagnosticsService?.SafeGetSource(nameof(CloudBlobCoreFileStorageService)) ?? throw new ArgumentNullException(nameof(diagnosticsService));
     _cloudBlobFolderInformationProvider = cloudBlobFolderInformationProvider ?? throw new ArgumentNullException(nameof(cloudBlobFolderInformationProvider));
 }
예제 #9
0
 public CloudBlobFileStorageService(
     ICloudBlobClient client,
     IAppConfiguration configuration,
     ISourceDestinationRedirectPolicy redirectPolicy,
     IDiagnosticsService diagnosticsService) : base(client, diagnosticsService)
 {
     _configuration  = configuration;
     _redirectPolicy = redirectPolicy;
 }
예제 #10
0
 public BlobContainerBuilder(
     ICloudBlobClient cloudBlobClient,
     IOptionsSnapshot <AzureSearchConfiguration> options,
     ILogger <BlobContainerBuilder> logger) : this(
         cloudBlobClient,
         options,
         logger,
         retryDelay : TimeSpan.FromSeconds(10))
 {
 }
 public CloudBlobFileStorageService(
     ICloudBlobClient client,
     IAppConfiguration configuration,
     ISourceDestinationRedirectPolicy redirectPolicy,
     IDiagnosticsService diagnosticsService,
     ICloudBlobContainerInformationProvider cloudBlobFolderInformationProvider)
     : base(client, diagnosticsService, cloudBlobFolderInformationProvider)
 {
     _configuration  = configuration;
     _redirectPolicy = redirectPolicy;
 }
        /// <summary>
        /// Initializes a new instance of the CloudBlobClient class using the Windows Azure Storage Account credentials to perform operations.
        /// </summary>
        /// <param name="blobsBaseUri">The blobs endpoint.</param>
        /// <param name="credentials">The storage credentials.</param>
        /// <param name="dispatcher">The dispatcher used to invoke the callbacks.</param>
        public CloudBlobClient(Uri blobsBaseUri, IStorageCredentials credentials, Dispatcher dispatcher)
        {
            if (blobsBaseUri == null)
                throw new ArgumentNullException("blobsBaseUri", "The Blobs base uri cannot be null.");

            if (credentials == null)
                throw new ArgumentNullException("credentials", "The storage credentials cannot be null.");

            this.Credentials = credentials;
            this.Dispatcher = dispatcher;
            this.strategy = new InnerStorageAccountCloudBlobClientStrategy(blobsBaseUri, this.Credentials, dispatcher);
        }
예제 #13
0
        private static async Task CreateBlobIfNotExists(ICloudBlobClient cloudBlobClient, string containerName, string blobName)
        {
            var container = cloudBlobClient.GetContainerReference(containerName);
            await container.CreateIfNotExistsAsync();

            var blob = container.GetBlockBlobReference(blobName);

            if (await blob.ExistsAsync())
            {
                await blob.UploadTextAsync(string.Empty);
            }
        }
예제 #14
0
        public VersionListDataClient(
            ICloudBlobClient cloudBlobClient,
            IOptionsSnapshot <AzureSearchConfiguration> options,
            ILogger <VersionListDataClient> logger)
        {
            _cloudBlobClient = cloudBlobClient ?? throw new ArgumentNullException(nameof(cloudBlobClient));
            _options         = options ?? throw new ArgumentNullException(nameof(options));
            _logger          = logger ?? throw new ArgumentNullException(nameof(logger));

            _lazyContainer = new Lazy <ICloudBlobContainer>(
                () => _cloudBlobClient.GetContainerReference(_options.Value.StorageContainer));
        }
예제 #15
0
        public PopularityTransferDataClient(
            ICloudBlobClient cloudBlobClient,
            IOptionsSnapshot <AzureSearchConfiguration> options,
            IAzureSearchTelemetryService telemetryService,
            ILogger <PopularityTransferDataClient> logger)
        {
            _cloudBlobClient  = cloudBlobClient ?? throw new ArgumentNullException(nameof(cloudBlobClient));
            _options          = options ?? throw new ArgumentNullException(nameof(options));
            _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));

            _lazyContainer = new Lazy <ICloudBlobContainer>(
                () => _cloudBlobClient.GetContainerReference(_options.Value.StorageContainer));
        }
 public Catalog2RegistrationCommand(
     ICollector collector,
     ICloudBlobClient cloudBlobClient,
     IStorageFactory storageFactory,
     Func <HttpMessageHandler> handlerFunc,
     IOptionsSnapshot <Catalog2RegistrationConfiguration> options,
     ILogger <Catalog2RegistrationCommand> logger)
 {
     _collector       = collector ?? throw new ArgumentNullException(nameof(collector));
     _cloudBlobClient = cloudBlobClient ?? throw new ArgumentNullException(nameof(cloudBlobClient));
     _storageFactory  = storageFactory ?? throw new ArgumentNullException(nameof(storageFactory));
     _handlerFunc     = handlerFunc ?? throw new ArgumentNullException(nameof(handlerFunc));
     _options         = options ?? throw new ArgumentNullException(nameof(options));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        public NeoServer(
            NeoServerConfiguration configuration,
            IRoleEnvironment roleEnvironment,
            ICloudBlobClient cloudBlobClient,
            IFileSystem fileSystem,
            IZipHandler zipHandler)
        {
            this.configuration = configuration;
            this.roleEnvironment = roleEnvironment;
            this.cloudBlobClient = cloudBlobClient;
            this.fileSystem = fileSystem;
            this.zipHandler = zipHandler;

            Loggers = new List<ILogger>(new[] { new TraceLogger() });
        }
예제 #18
0
 public HiveStorage(
     ICloudBlobClient cloudBlobClient,
     RegistrationUrlBuilder urlBuilder,
     IEntityBuilder entityBuilder,
     IThrottle throttle,
     IOptionsSnapshot <Catalog2RegistrationConfiguration> options,
     ILogger <HiveStorage> logger)
 {
     _cloudBlobClient = cloudBlobClient ?? throw new ArgumentNullException(nameof(cloudBlobClient));
     _urlBuilder      = urlBuilder ?? throw new ArgumentNullException(nameof(urlBuilder));
     _entityBuilder   = entityBuilder ?? throw new ArgumentNullException(nameof(entityBuilder));
     _throttle        = throttle ?? throw new ArgumentNullException(nameof(throttle));
     _options         = options ?? throw new ArgumentNullException(nameof(options));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #19
0
 /// <summary>
 /// This constructor is used for testing.
 /// </summary>
 internal BlobContainerBuilder(
     ICloudBlobClient cloudBlobClient,
     IOptionsSnapshot <AzureSearchConfiguration> options,
     ILogger <BlobContainerBuilder> logger,
     TimeSpan retryDelay)
 {
     _cloudBlobClient = cloudBlobClient ?? throw new ArgumentNullException(nameof(cloudBlobClient));
     _options         = options ?? throw new ArgumentNullException(nameof(options));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _lazyContainer   = new Lazy <ICloudBlobContainer>(() =>
     {
         return(_cloudBlobClient.GetContainerReference(_options.Value.StorageContainer));
     });
     _retryDelay = retryDelay;
 }
        public UploadPhotoPageViewModel(ICloudBlobClient blobClient, Dispatcher dispatcher)
        {
            this.blobClient = blobClient;
            this.dispatcher = dispatcher;

            this.blobClient.ListContainers(
                r =>
                {
                    if (this.dispatcher != null)
                    {
                        this.dispatcher.BeginInvoke(() => this.UpdateListBlobs(r));
                    }
                    else
                    {
                        this.UpdateListBlobs(r);
                    }
                });
        }
        private MemoryStream stream = new MemoryStream(); // Stores the audio data for later playback

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor 
        /// </summary>
        public MainPage()
        {
            InitializeComponent();

            // Timer to simulate the XNA Framework game loop (Microphone is
            // from the XNA Framework). We also use this timer to monitor the
            // state of audio playback so we can update the UI appropriately.
            DispatcherTimer dt = new DispatcherTimer();
            dt.Interval = TimeSpan.FromMilliseconds(33);
            dt.Tick += new EventHandler(dt_Tick);
            dt.Start();

            // Event handler for getting audio data when the buffer is full
            microphone.BufferReady += new EventHandler<EventArgs>(microphone_BufferReady);

            blankImage = new BitmapImage(new Uri("Images/blank.png", UriKind.RelativeOrAbsolute));
            microphoneImage = new BitmapImage(new Uri("Images/microphone.png", UriKind.RelativeOrAbsolute));
            speakerImage = new BitmapImage(new Uri("Images/speaker.png", UriKind.RelativeOrAbsolute));

            // Initialize storage
            this.blobClient = CloudStorageContext.Current.Resolver.CreateCloudBlobClient();
        }
예제 #22
0
 public CloudBlobCoreFileStorageService(ICloudBlobClient client, IDiagnosticsService diagnosticsService)
 {
     _client = client ?? throw new ArgumentNullException(nameof(client));
     _trace  = diagnosticsService?.SafeGetSource(nameof(CloudBlobCoreFileStorageService)) ?? throw new ArgumentNullException(nameof(diagnosticsService));
 }
 public ListBlobsPageViewModel(ICloudBlobClient blobClient, Dispatcher dispatcher)
 {
     this.blobClient = blobClient;
     this.dispatcher = dispatcher;
     this.CloudBlobs = new ObservableCollection<ICloudBlob>();
 }
예제 #24
0
 private static async Task CreateBlobContainerIfNotExists(ICloudBlobClient cloudBlobClient, string containerName)
 {
     var container = cloudBlobClient.GetContainerReference(containerName);
     await container.CreateIfNotExistsAsync();
 }
예제 #25
0
 /// <summary>
 /// Initializes a new instance of the CloudBlobClient class to perform operations with Blobs and Containers using the Azure Storage credentials.
 /// </summary>
 /// <param name="containerBaseAddress">The Blob service endpoint to use to create the client.</param>
 /// <param name="credentials">The account credentials.</param>
 public CloudBlobClient(string storageAccountEndpoint, IStorageCredentials credentials = null)
 {
     this.Credentials = credentials ?? new StorageCredentialsAnonymous();
     this.strategy = new StorageAccountCloudBlobClientStrategy(storageAccountEndpoint, this.Credentials);
 }
 public CloudBlobFileStorageService(ICloudBlobClient client, IAppConfiguration configuration, ISourceDestinationRedirectPolicy redirectPolicy)
 {
     _client         = client;
     _configuration  = configuration;
     _redirectPolicy = redirectPolicy;
 }
예제 #27
0
 private AzureBlockBlobFileSystem(ICloudBlobClient client)
 {
     _client = client;
 }
 public CloudBlobFileStorageService(ICloudBlobClient client, IAppConfiguration configuration)
 {
     _client = client;
     _configuration = configuration;
 }
예제 #29
0
 public CloudBlobFileStorageService(ICloudBlobClient client, IConfiguration configuration)
 {
     _client        = client;
     _configuration = configuration;
 }
예제 #30
0
 private AzureBlockBlobFileSystem(ICloudBlobClient client)
 {
     _client = client;
 }
 public CloudBlobCoreFileStorageService(ICloudBlobClient client)
 {
     _client = client;
 }
        public CloudBlobFileStorageService(ICloudBlobClient client)
        {
            this.client = client;

            PrepareContainer(Const.PackagesFolderName, true);
        }