public DefaultCluster(IEndpointStrategy endpointStrategy, ILogger logger, IConnectionFactory connectionFactory, IRecoveryService recoveryService) { _ip2Connection = new Dictionary<IPAddress, IConnection>(); _endpointStrategy = endpointStrategy; _logger = logger; _connectionFactory = connectionFactory; _recoveryService = recoveryService; }
public SingleConnectionPerEndpointCluster(IEndpointStrategy endpointStrategy, ILogger logger, IConnectionFactory connectionFactory, IRecoveryService recoveryService, IPartitioner partitioner) { _ip2Connection = new Dictionary <IPAddress, IConnection>(); _endpointStrategy = endpointStrategy; _logger = logger; _connectionFactory = connectionFactory; _recoveryService = recoveryService; Partitioner = partitioner; }
public SingleConnectionPerEndpointCluster(IEndpointStrategy endpointStrategy, ILogger logger, IConnectionFactory connectionFactory, IRecoveryService recoveryService, IPartitioner partitioner) { _ip2Connection = new Dictionary<IPAddress, IConnection>(); _endpointStrategy = endpointStrategy; _logger = logger; _connectionFactory = connectionFactory; _recoveryService = recoveryService; Partitioner = partitioner; }
public ApiController(DataContext db, IUserService userService, IWorkoutService workoutService, ISessionService sessionService, IRecordService recordService, IExerciseTypeService exerciseTypeService, IRecoveryService recoveryService, IRecoveryDefinitionService recoveryDefinitionService, IOptions <AppSettings> appSettings) { _userService = userService; _workoutService = workoutService; _sessionService = sessionService; _recordService = recordService; _exerciseTypeService = exerciseTypeService; _recoveryService = recoveryService; _recoveryDefinitionService = recoveryDefinitionService; _appSettings = appSettings.Value; }
public ConnectionPoolEndpointCluster(IEndpointStrategy endpointStrategy, ILogger logger, IConnectionFactory connectionFactory, IRecoveryService recoveryService, IPartitioner partitioner) { _ip2Connection = new ConcurrentDictionary <IPAddress, IConnection[]>(); _endpointStrategy = endpointStrategy; _logger = logger; _connectionFactory = connectionFactory; _recoveryService = recoveryService; Partitioner = partitioner; logger?.Info("ConnectionPoolEndpointCluster created."); }
public ProfileController( ApplicationDbContext context, UserManager <User> userManager, IProfileManager profileManager, IRecoveryService recovery ) { _context = context; _userManager = userManager; _profileManger = profileManager; _recovery = recovery; }
public static void Configure(CassandraSharpConfig config) { config.CheckArgumentNotNull("config"); if (null != _config) { throw new InvalidOperationException("ClusterManager is already initialized"); } _logger = Logger.Factory.Create(config.Logger); _recoveryService = Recovery.Factory.Create(config.Recovery, _logger); _config = config; }
public void Shutdown() { lock (_lock) { _recoveryService?.SafeDispose(); _recoveryService = null; _instrumentation?.SafeDispose(); _instrumentation = null; _logger?.SafeDispose(); _logger = null; _config = null; } }
public ICluster GetCluster(ClusterConfig clusterConfig) { clusterConfig.CheckArgumentNotNull("clusterConfig"); clusterConfig.Endpoints.CheckArgumentNotNull("clusterConfig.Endpoints"); TransportConfig transportConfig = clusterConfig.Transport ?? new TransportConfig(); IRecoveryService recoveryService = GetRecoveryService(transportConfig.Recoverable); KeyspaceConfig keyspaceConfig = clusterConfig.DefaultKeyspace ?? new KeyspaceConfig(); // create endpoints IEndpointSnitch snitch = ServiceActivator <Factory> .Create <IEndpointSnitch>(clusterConfig.Endpoints.Snitch, _logger); IEnumerable <IPAddress> endpoints = clusterConfig.Endpoints.Servers.Select(Network.Find).Where(x => null != x).ToArray(); if (!endpoints.Any()) { throw new ArgumentException("Expecting at least one valid endpoint"); } // create required services IEndpointStrategy endpointsManager = ServiceActivator <EndpointStrategy.Factory> .Create <IEndpointStrategy>(clusterConfig.Endpoints.Strategy, endpoints, snitch, _logger, clusterConfig.Endpoints); IConnectionFactory connectionFactory = ServiceActivator <Transport.Factory> .Create <IConnectionFactory>(transportConfig.Type, transportConfig, keyspaceConfig, _logger, _instrumentation); IPartitioner partitioner = ServiceActivator <Partitioner.Factory> .Create <IPartitioner>(clusterConfig.Partitioner); // create the cluster now ICluster cluster = ServiceActivator <Cluster.Factory> .Create <ICluster>(clusterConfig.Type, endpointsManager, _logger, connectionFactory, recoveryService, partitioner, clusterConfig); IDiscoveryService discoveryService = ServiceActivator <Discovery.Factory> .Create <IDiscoveryService>(clusterConfig.Endpoints.Discovery.Type, clusterConfig.Endpoints.Discovery, _logger, cluster); discoveryService.OnTopologyUpdate += endpointsManager.Update; cluster.OnClosed += discoveryService.SafeDispose; return(cluster); }
public void Configure(CassandraSharpConfig config) { config.CheckArgumentNotNull("config"); lock (_lock) { if (null != _config) { throw new InvalidOperationException("ClusterManager is already initialized"); } _logger = ServiceActivator <Logger.Factory> .Create <ILogger>(config.Logger.Type, config.Logger); _recoveryService = ServiceActivator <Recovery.Factory> .Create <IRecoveryService>(config.Recovery.Type, config.Recovery, _logger); _instrumentation = ServiceActivator <Instrumentation.Factory> .Create <IInstrumentation>(config.Instrumentation.Type, config.Instrumentation); _config = config; } }
/// <summary> /// return true for Configure success /// </summary> /// <param name="config"></param> /// <returns></returns> public bool Configure(CassandraSharpConfig config) { if (config == null) { return(false); } if (null != _config) { return(true); } _logger = ServiceActivator <Logger.Factory> .Create <ILogger>(config.Logger.Type, config.Logger); _recoveryService = ServiceActivator <Recovery.Factory> .Create <IRecoveryService>(config.Recovery.Type, config.Recovery, _logger); _instrumentation = ServiceActivator <Instrumentation.Factory> .Create <IInstrumentation>(config.Instrumentation.Type, config.Instrumentation); _config = config; return(true); }
public void Shutdown() { lock (_lock) { _recoveryService.SafeDispose(); _recoveryService = null; _instrumentation.SafeDispose(); _instrumentation = null; _logger.SafeDispose(); _logger = null; _config = null; } }
public void Configure(CassandraSharpConfig config) { config.CheckArgumentNotNull("config"); lock (_lock) { if (null != _config) { throw new InvalidOperationException("ClusterManager is already initialized"); } _logger = ServiceActivator<Logger.Factory>.Create<ILogger>(config.Logger.Type, config.Logger); _recoveryService = ServiceActivator<Recovery.Factory>.Create<IRecoveryService>(config.Recovery.Type, config.Recovery, _logger); _instrumentation = ServiceActivator<Instrumentation.Factory>.Create<IInstrumentation>(config.Instrumentation.Type, config.Instrumentation); _config = config; } }
public static void Shutdown() { if (null != _recoveryService) { _recoveryService.SafeDispose(); _recoveryService = null; } _config = null; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='model'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ResQYttriumWebApiModelsCreateRecoveryServiceResultModel> CreateAsync(this IRecoveryService operations, ResQYttriumWebApiModelsCreateRecoveryServiceModel model, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(model, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public AuthenticationController(IAuthenticationService authentication, IRecoveryService recovery) { _authentication = authentication; _recovery = recovery; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='model'> /// </param> public static ResQYttriumWebApiModelsCreateRecoveryServiceResultModel Create(this IRecoveryService operations, ResQYttriumWebApiModelsCreateRecoveryServiceModel model) { return(Task.Factory.StartNew(s => ((IRecoveryService)s).CreateAsync(model), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }