Exemplo n.º 1
0
 public MergeIndexTimer(ILogger <IMergeIndexTimer> logger,
                        IOptions <JobTrackerConfig> config, IndexStorageAccountWrapper wrapper)
 {
     _logger      = logger;
     _account     = wrapper.TableAccount;
     _indexConfig = config.Value.JobIndexConfig;
     _tableName   = _indexConfig.TableName;
 }
Exemplo n.º 2
0
 public MergeJobIndexWorker(IClusterClient client, ILogger <MergeJobIndexWorker> logger,
                            IOptions <JobTrackerConfig> config, IndexStorageAccountWrapper wrapper)
 {
     _client      = client;
     _account     = wrapper.Account;
     _logger      = logger;
     _indexConfig = config.Value.JobIndexConfig;
     _tableName   = _indexConfig.TableName;
 }
Exemplo n.º 3
0
        public InProcessSilo(IOptions <JobTrackerConfig> jobTrackerConfigOptions, ServiceBusWrapper wrapper,
                             IndexStorageAccountWrapper accountWrapper)
        {
            var siloConfig = jobTrackerConfigOptions.Value.SiloConfig;
            var jobEntityStorageOptions = new Action <AzureTableStorageOptions>(options =>
            {
                options.ConnectionString = siloConfig.JobEntityPersistConfig.ConnStr;
                options.UseJson          = siloConfig.JobEntityPersistConfig.UseJson;
                if (!string.IsNullOrEmpty(siloConfig.JobEntityPersistConfig.TableName))
                {
                    options.TableName = siloConfig.JobEntityPersistConfig.TableName;
                }
            });

            var readOnlyJobIndexStorageOptions = new Action <AzureBlobStorageOptions>(options =>
            {
                options.ConnectionString = siloConfig.ReadOnlyJobIndexPersistConfig.ConnStr;
                options.UseJson          = siloConfig.ReadOnlyJobIndexPersistConfig.UseJson;
                if (!string.IsNullOrEmpty(siloConfig.ReadOnlyJobIndexPersistConfig.ContainerName))
                {
                    options.ContainerName = siloConfig.ReadOnlyJobIndexPersistConfig.ContainerName;
                }
            });

            var builder = new SiloHostBuilder()
                          .UseLocalhostClustering(11111, 30000, null, siloConfig.ServiceId, siloConfig.ClusterId)
                          .ConfigureApplicationParts(parts =>
                                                     parts.AddApplicationPart(typeof(JobGrain).Assembly).WithReferences().WithCodeGeneration())
                          .AddAzureTableGrainStorage(Constants.JobEntityStoreName, jobEntityStorageOptions)
                          .AddAzureTableGrainStorage(Constants.JobRefStoreName, jobEntityStorageOptions)
                          .AddAzureTableGrainStorage(Constants.JobIdStoreName, jobEntityStorageOptions)
                          .AddAzureTableGrainStorage(Constants.JobIdOffsetStoreName, jobEntityStorageOptions)
                          .AddAzureBlobGrainStorage(Constants.ReadOnlyJobIndexStoreName, readOnlyJobIndexStorageOptions)
                          .ConfigureServices(services =>
            {
                services.AddSingleton(_ => jobTrackerConfigOptions);
                services.AddSingleton(_ => wrapper);
                services.AddSingleton(_ => accountWrapper);
            })
                          .Configure <GrainCollectionOptions>(options =>
            {
                options.CollectionAge = siloConfig.GrainCollectionAge ?? TimeSpan.FromMinutes(10);
                options.ClassSpecificCollectionAge[typeof(AggregateJobIndexGrain).FullName ?? throw new
                                                   InvalidOperationException()] = TimeSpan.FromMinutes(5);
                options.ClassSpecificCollectionAge[typeof(RollingJobIndexGrain).FullName ?? throw new
 public ShardJobIndexGrainWithTable(IndexStorageAccountWrapper wrapper, IOptions <JobTrackerConfig> options)
 {
     _account     = wrapper.Account;
     _indexConfig = options.Value.JobIndexConfig;
 }