public Synchronizer(ISplitFetcher splitFetcher, ISelfRefreshingSegmentFetcher segmentFetcher, IImpressionsLog impressionsLog, IEventsLog eventsLog, IImpressionsCountSender impressionsCountSender, IWrapperAdapter wrapperAdapter, IStatusManager statusManager, ITelemetrySyncTask telemetrySyncTask, ITasksManager tasksManager, ISplitCache splitCache, IBackOff backOff, int onDemandFetchMaxRetries, int onDemandFetchRetryDelayMs, ISegmentCache segmentCache, ISplitLogger log = null) { _splitFetcher = splitFetcher; _segmentFetcher = segmentFetcher; _impressionsLog = impressionsLog; _eventsLog = eventsLog; _impressionsCountSender = impressionsCountSender; _wrapperAdapter = wrapperAdapter; _statusManager = statusManager; _telemetrySyncTask = telemetrySyncTask; _tasksManager = tasksManager; _splitCache = splitCache; _backOffSplits = backOff; _backOffSegments = backOff; _onDemandFetchMaxRetries = onDemandFetchMaxRetries; _onDemandFetchRetryDelayMs = onDemandFetchRetryDelayMs; _segmentCache = segmentCache; _log = log ?? WrapperAdapter.GetLogger(typeof(Synchronizer)); _defaultFetchOptions = new FetchOptions(); }
public LocalhostClientForTesting(string filePath, ISplitLogger log = null, ISplitter splitter = null, bool isDestroyed = false) : base(filePath, log) { Destroyed = isDestroyed; }
public SyncManager(bool streamingEnabled, ISynchronizer synchronizer, IPushManager pushManager, ISSEHandler sseHandler, INotificationManagerKeeper notificationManagerKeeper, ITelemetryRuntimeProducer telemetryRuntimeProducer, IStatusManager statusManager, ITasksManager tasksManager, IWrapperAdapter wrapperAdapter, ITelemetrySyncTask telemetrySyncTask, ISplitLogger log = null) { _streamingEnabled = streamingEnabled; _synchronizer = synchronizer; _pushManager = pushManager; _sseHandler = sseHandler; _log = log ?? WrapperAdapter.GetLogger(typeof(Synchronizer)); _telemetryRuntimeProducer = telemetryRuntimeProducer; _statusManager = statusManager; _tasksManager = tasksManager; _wrapperAdapter = wrapperAdapter; _telemetrySyncTask = telemetrySyncTask; _sseHandler.ActionEvent += OnProcessFeedbackSSE; notificationManagerKeeper.ActionEvent += OnProcessFeedbackSSE; _shutdownCancellationTokenSource = new CancellationTokenSource(); }
public SelfRefreshingClient(string apiKey, ConfigurationOptions config, ISplitLogger log = null) : base(GetLogger(log)) { _config = (SelfRefreshingConfig)_configService.ReadConfig(config, ConfingTypes.InMemory); LabelsEnabled = _config.LabelsEnabled; ApiKey = apiKey; BuildSplitCache(); BuildSegmentCache(); BuildTelemetryStorage(); BuildTelemetrySyncTask(); BuildSdkApiClients(); BuildSplitFetcher(); BuildTreatmentLog(config); BuildImpressionManager(); BuildEventLog(config); BuildEvaluator(); BuildBlockUntilReadyService(); BuildManager(); BuildSyncManager(); _startSessionMs = CurrentTimeHelper.CurrentTimeMillis(); Start(); }
public SplitsWorker(ISplitCache splitCache, ISynchronizer synchronizer, ISplitLogger log = null) { _splitCache = splitCache; _synchronizer = synchronizer; _log = log ?? WrapperAdapter.GetLogger(typeof(SplitsWorker)); }
public NotificationProcessor(ISplitsWorker splitsWorker, ISegmentsWorker segmentsWorker, ISplitLogger log = null) { _log = log ?? WrapperAdapter.GetLogger(typeof(EventSourceClient)); _splitsWorker = splitsWorker; _segmentsWorker = segmentsWorker; }
public NotificationManagerKeeper(ITelemetryRuntimeProducer telemetryRuntimeProducer, ISplitLogger log = null) { _telemetryRuntimeProducer = telemetryRuntimeProducer; _log = log ?? WrapperAdapter.GetLogger(typeof(NotificationManagerKeeper)); _publisherAvailable = true; }
public SelfRefreshingBlockUntilReadyService(IStatusManager statusManager, ITelemetryInitProducer telemetryInitProducer, ISplitLogger log = null) { _statusManager = statusManager; _telemetryInitProducer = telemetryInitProducer; _log = log ?? WrapperAdapter.GetLogger(typeof(SelfRefreshingBlockUntilReadyService)); }
public SplitManager(ISplitCache splitCache, IBlockUntilReadyService blockUntilReadyService, ISplitLogger log = null) { _splitCache = splitCache; _log = log ?? WrapperAdapter.GetLogger(typeof(SplitManager)); _splitNameValidator = new SplitNameValidator(_log); _blockUntilReadyService = blockUntilReadyService; }
public SegmentsWorker(ISynchronizer synchronizer, ITasksManager tasksManager, ISplitLogger log = null) { _synchronizer = synchronizer; _tasksManager = tasksManager; _log = log ?? WrapperAdapter.GetLogger(typeof(SegmentsWorker)); _queue = new BlockingCollection <SegmentQueueDto>(new ConcurrentQueue <SegmentQueueDto>()); }
public SplitsWorker(ISplitCache splitCache, ISynchronizer synchronizer, ISplitLogger log = null) { _splitCache = splitCache; _synchronizer = synchronizer; _log = log ?? WrapperAdapter.GetLogger(typeof(SplitsWorker)); _queue = new BlockingCollection <long>(new ConcurrentQueue <long>()); }
public AuthApiClient(string url, string apiKey, long connectionTimeOut, ISplitioHttpClient splitioHttpClient = null, ISplitLogger log = null) { _url = url; _splitioHttpClient = splitioHttpClient ?? new SplitioHttpClient(apiKey, connectionTimeOut); _log = log ?? WrapperAdapter.GetLogger(typeof(AuthApiClient)); }
public Evaluator(ISplitCache splitCache, ISplitParser splitParser, ISplitter splitter = null, ISplitLogger log = null) { _splitCache = splitCache; _splitParser = splitParser; _splitter = splitter ?? new Splitter(); _log = log ?? WrapperAdapter.GetLogger(typeof(Evaluator)); }
public SplitClient(ISplitLogger log) { _log = log; _keyValidator = new KeyValidator(); _splitNameValidator = new SplitNameValidator(); _eventTypeValidator = new EventTypeValidator(); _eventPropertiesValidator = new EventPropertiesValidator(); _factoryInstantiationsService = FactoryInstantiationsService.Instance(); _wrapperAdapter = new WrapperAdapter(); }
public TelemetryAPI(ISplitioHttpClient splitioHttpClient, string telemetryURL, ITelemetryRuntimeProducer telemetryRuntimeProducer, ISplitLogger log = null) { _splitioHttpClient = splitioHttpClient; _telemetryURL = telemetryURL; _telemetryRuntimeProducer = telemetryRuntimeProducer; _log = log ?? WrapperAdapter.GetLogger(typeof(TelemetryAPI)); }
public EventSourceClient(ISplitLogger log = null, INotificationParser notificationParser = null, IWrapperAdapter wrapperAdapter = null) { _log = log ?? WrapperAdapter.GetLogger(typeof(EventSourceClient)); _notificationParser = notificationParser ?? new NotificationParser(); _wrapperAdapter = wrapperAdapter ?? new WrapperAdapter(); UpdateFinishedConnection(finished: true); }
public AuthApiClient(string url, string apiKey, ISplitioHttpClient splitioHttpClient, ITelemetryRuntimeProducer telemetryRuntimeProducer, ISplitLogger log = null) { _url = url; _splitioHttpClient = splitioHttpClient; _telemetryRuntimeProducer = telemetryRuntimeProducer; _log = log ?? WrapperAdapter.GetLogger(typeof(AuthApiClient)); }
public SplitClient(ISplitLogger log) { _log = log; _keyValidator = new KeyValidator(); _splitNameValidator = new SplitNameValidator(); _eventTypeValidator = new EventTypeValidator(); _eventPropertiesValidator = new EventPropertiesValidator(); _factoryInstantiationsService = FactoryInstantiationsService.Instance(); _wrapperAdapter = new WrapperAdapter(); _configService = new ConfigService(_wrapperAdapter, _log); _tasksManager = new TasksManager(_wrapperAdapter); _statusManager = new InMemoryReadinessGatesCache(); }
public PushManager(int authRetryBackOffBase, ISSEHandler sseHandler, IAuthApiClient authApiClient, IWrapperAdapter wrapperAdapter = null, ISplitLogger log = null, IBackOff backOff = null) { _sseHandler = sseHandler; _authApiClient = authApiClient; _log = log ?? WrapperAdapter.GetLogger(typeof(PushManager)); _wrapperAdapter = wrapperAdapter ?? new WrapperAdapter(); _backOff = backOff ?? new BackOff(authRetryBackOffBase, attempt: 1); }
public PushManager(ISSEHandler sseHandler, IAuthApiClient authApiClient, IWrapperAdapter wrapperAdapter, ITelemetryRuntimeProducer telemetryRuntimeProducer, IBackOff backOff, ISplitLogger log = null) { _sseHandler = sseHandler; _authApiClient = authApiClient; _log = log ?? WrapperAdapter.GetLogger(typeof(PushManager)); _wrapperAdapter = wrapperAdapter; _backOff = backOff; _telemetryRuntimeProducer = telemetryRuntimeProducer; }
public SplitioHttpClient( string apiKey, long connectionTimeOut) { #if NET40 || NET45 ServicePointManager.SecurityProtocol = (SecurityProtocolType)Constans.ProtocolTypeTls12; #endif _log = WrapperAdapter.GetLogger(typeof(SplitioHttpClient)); _httpClient = new HttpClient() { Timeout = TimeSpan.FromMilliseconds(connectionTimeOut) }; _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(Constans.Bearer, apiKey); }
public RedisTelemetryStorage(IRedisAdapter redisAdapter, string userPrefix, string sdkVersion, string machineIp, string machineName, ISplitLogger log = null) { _redisAdapter = redisAdapter; _userPrefix = userPrefix; _sdkVersion = sdkVersion; _machineIp = machineIp; _machineName = machineName; _log = log ?? WrapperAdapter.GetLogger(typeof(RedisTelemetryStorage)); }
public ReadConfigData ReadConfig(ConfigurationOptions config, ISplitLogger log) { var data = new ReadConfigData(); var ipAddressesEnabled = config.IPAddressesEnabled ?? true; #if NETSTANDARD data.SdkVersion = ".NET_CORE-" + SplitSdkVersion(); #else data.SdkVersion = ".NET-" + SplitSdkVersion(); #endif data.SdkMachineName = GetSdkMachineName(config, ipAddressesEnabled, log); data.SdkMachineIP = GetSdkMachineIP(config, ipAddressesEnabled, log); return(data); }
public static IFactoryInstantiationsService Instance(ISplitLogger log = null) { if (_instance == null) { lock (_instanceLock) { if (_instance == null) { _instance = new FactoryInstantiationsService(log); } } } return(_instance); }
public EventSourceClient(INotificationParser notificationParser, IWrapperAdapter wrapperAdapter, ISplitioHttpClient splitHttpClient, ITelemetryRuntimeProducer telemetryRuntimeProducer, ITasksManager tasksManager, ISplitLogger log = null) { _notificationParser = notificationParser; _wrapperAdapter = wrapperAdapter; _splitHttpClient = splitHttpClient; _log = log ?? WrapperAdapter.GetLogger(typeof(EventSourceClient)); _telemetryRuntimeProducer = telemetryRuntimeProducer; _tasksManager = tasksManager; _firstEvent = true; }
public Synchronizer(ISplitFetcher splitFetcher, ISelfRefreshingSegmentFetcher segmentFetcher, IImpressionsLog impressionsLog, IEventsLog eventsLog, IMetricsLog metricsLog, IWrapperAdapter wrapperAdapter = null, ISplitLogger log = null) { _splitFetcher = splitFetcher; _segmentFetcher = segmentFetcher; _impressionsLog = impressionsLog; _eventsLog = eventsLog; _metricsLog = metricsLog; _wrapperAdapter = wrapperAdapter ?? new WrapperAdapter(); _log = log ?? WrapperAdapter.GetLogger(typeof(Synchronizer)); }
public RedisClient(ConfigurationOptions config, string apiKey, ISplitLogger log = null) : base(GetLogger(log)) { _config = new RedisConfig(); ApiKey = apiKey; ReadConfig(config); BuildRedisCache(); BuildTreatmentLog(config); BuildEventLog(config); BuildMetricsLog(); BuildBlockUntilReadyService(); BuildManager(); BuildEvaluator(); }
public JSONFileClient(string splitsFilePath, string segmentsFilePath, ISplitLogger log = null, ISegmentCache segmentCacheInstance = null, ISplitCache splitCacheInstance = null, IImpressionsLog impressionsLog = null, bool isLabelsEnabled = true, IEventsLog eventsLog = null, ITrafficTypeValidator trafficTypeValidator = null, IImpressionsManager impressionsManager = null) : base(GetLogger(log)) { _segmentCache = segmentCacheInstance ?? new InMemorySegmentCache(new ConcurrentDictionary <string, Segment>()); var segmentFetcher = new JSONFileSegmentFetcher(segmentsFilePath, _segmentCache); var splitChangeFetcher = new JSONFileSplitChangeFetcher(splitsFilePath); var task = splitChangeFetcher.Fetch(-1); task.Wait(); var splitChangesResult = task.Result; var parsedSplits = new ConcurrentDictionary <string, ParsedSplit>(); _splitParser = new InMemorySplitParser(segmentFetcher, _segmentCache); foreach (var split in splitChangesResult.splits) { parsedSplits.TryAdd(split.name, _splitParser.Parse(split)); } _splitCache = splitCacheInstance ?? new InMemorySplitCache(new ConcurrentDictionary <string, ParsedSplit>(parsedSplits)); _impressionsLog = impressionsLog; LabelsEnabled = isLabelsEnabled; _eventsLog = eventsLog; _trafficTypeValidator = trafficTypeValidator; _blockUntilReadyService = new NoopBlockUntilReadyService(); _manager = new SplitManager(_splitCache, _blockUntilReadyService, log); ApiKey = "localhost"; BuildEvaluator(log); _impressionsManager = impressionsManager ?? new ImpressionsManager(impressionsLog, null, null, false, ImpressionsMode.Debug); }
public SplitClientForTesting(ISplitLogger log, ISplitCache splitCache, IEventsLog eventsLog, IImpressionsLog impressionsLog, IBlockUntilReadyService blockUntilReadyService, IEvaluator evaluator) : base(log) { _splitCache = splitCache; _eventsLog = eventsLog; _impressionsLog = impressionsLog; _blockUntilReadyService = blockUntilReadyService; _trafficTypeValidator = new TrafficTypeValidator(_splitCache, log); _evaluator = evaluator; ApiKey = "SplitClientForTesting"; }
public SyncManager(bool streamingEnabled, ISynchronizer synchronizer, IPushManager pushManager, ISSEHandler sseHandler, INotificationManagerKeeper notificationManagerKeeper, ISplitLogger log = null) { _streamingEnabled = streamingEnabled; _synchronizer = synchronizer; _pushManager = pushManager; _sseHandler = sseHandler; _log = log ?? WrapperAdapter.GetLogger(typeof(Synchronizer)); _sseHandler.ConnectedEvent += OnProcessFeedbackSSE; _sseHandler.DisconnectEvent += OnProcessFeedbackSSE; notificationManagerKeeper.OccupancyEvent += OnOccupancyEvent; notificationManagerKeeper.PushShutdownEvent += OnPushShutdownEvent; }