Beispiel #1
0
        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();
        }
Beispiel #2
0
 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();
 }
Beispiel #3
0
 public NotificationProcessor(ISplitsWorker splitsWorker,
                              ISegmentsWorker segmentsWorker,
                              ISplitLogger log = null)
 {
     _log            = log ?? WrapperAdapter.GetLogger(typeof(EventSourceClient));
     _splitsWorker   = splitsWorker;
     _segmentsWorker = segmentsWorker;
 }
Beispiel #4
0
 public SplitsWorker(ISplitCache splitCache,
                     ISynchronizer synchronizer,
                     ISplitLogger log = null)
 {
     _splitCache   = splitCache;
     _synchronizer = synchronizer;
     _log          = log ?? WrapperAdapter.GetLogger(typeof(SplitsWorker));
 }
Beispiel #5
0
        public NotificationManagerKeeper(ITelemetryRuntimeProducer telemetryRuntimeProducer,
                                         ISplitLogger log = null)
        {
            _telemetryRuntimeProducer = telemetryRuntimeProducer;
            _log = log ?? WrapperAdapter.GetLogger(typeof(NotificationManagerKeeper));

            _publisherAvailable = true;
        }
 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>());
 }
Beispiel #7
0
 public SplitManager(ISplitCache splitCache,
                     IBlockUntilReadyService blockUntilReadyService,
                     ISplitLogger log = null)
 {
     _splitCache             = splitCache;
     _log                    = log ?? WrapperAdapter.GetLogger(typeof(SplitManager));
     _splitNameValidator     = new SplitNameValidator(_log);
     _blockUntilReadyService = blockUntilReadyService;
 }
Beispiel #8
0
 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 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);
        }
Beispiel #10
0
 public TelemetryAPI(ISplitioHttpClient splitioHttpClient,
                     string telemetryURL,
                     ITelemetryRuntimeProducer telemetryRuntimeProducer,
                     ISplitLogger log = null)
 {
     _splitioHttpClient        = splitioHttpClient;
     _telemetryURL             = telemetryURL;
     _telemetryRuntimeProducer = telemetryRuntimeProducer;
     _log = log ?? WrapperAdapter.GetLogger(typeof(TelemetryAPI));
 }
Beispiel #11
0
 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));
 }
Beispiel #12
0
 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));
 }
Beispiel #13
0
 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));
 }
Beispiel #14
0
 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);
 }
Beispiel #15
0
 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;
 }
Beispiel #16
0
 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));
 }
Beispiel #17
0
        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);
        }
Beispiel #18
0
 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));
 }
Beispiel #19
0
        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;
        }
Beispiel #20
0
        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;
        }
Beispiel #21
0
        public SSEHandler(string streaminServiceUrl,
                          ISplitsWorker splitsWorker,
                          ISegmentsWorker segmentsWorker,
                          INotificationProcessor notificationPorcessor,
                          INotificationManagerKeeper notificationManagerKeeper,
                          ISplitLogger log = null,
                          IEventSourceClient eventSourceClient = null)
        {
            _streaminServiceUrl        = streaminServiceUrl;
            _splitsWorker              = splitsWorker;
            _segmentsWorker            = segmentsWorker;
            _notificationPorcessor     = notificationPorcessor;
            _notificationManagerKeeper = notificationManagerKeeper;
            _log = log ?? WrapperAdapter.GetLogger(typeof(SSEHandler));
            _eventSourceClient = eventSourceClient;

            _eventSourceClient.EventReceived += EventReceived;
            _eventSourceClient.ActionEvent   += OnAction;
        }
Beispiel #22
0
        public TelemetrySyncTask(ITelemetryStorageConsumer telemetryStorage,
                                 ITelemetryAPI telemetryAPI,
                                 ISplitCache splitCache,
                                 ISegmentCache segmentCache,
                                 SelfRefreshingConfig configurationOptions,
                                 IFactoryInstantiationsService factoryInstantiationsService,
                                 IWrapperAdapter wrapperAdapter,
                                 ITasksManager tasksManager,
                                 ISplitLogger log = null)
        {
            _telemetryStorageConsumer = telemetryStorage;
            _telemetryAPI             = telemetryAPI;
            _splitCache                   = splitCache;
            _segmentCache                 = segmentCache;
            _configurationOptions         = configurationOptions;
            _factoryInstantiationsService = factoryInstantiationsService;
            _log            = log ?? WrapperAdapter.GetLogger(typeof(TelemetrySyncTask));
            _wrapperAdapter = wrapperAdapter;
            _tasksManager   = tasksManager;

            _cancellationTokenSource = new CancellationTokenSource();
        }
Beispiel #23
0
        public SplitioHttpClient(string apiKey,
                                 long connectionTimeOut,
                                 Dictionary <string, string> headers = null)
        {
#if NET40 || NET45 || NET461
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)Constants.Http.ProtocolTypeTls12;
#endif
            _log        = WrapperAdapter.GetLogger(typeof(SplitioHttpClient));
            _httpClient = new HttpClient()
            {
                Timeout = TimeSpan.FromMilliseconds(connectionTimeOut)
            };

            _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(Constants.Http.Bearer, apiKey);

            if (headers != null)
            {
                foreach (var header in headers)
                {
                    _httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
                }
            }
        }
Beispiel #24
0
 public EventTypeValidator(ISplitLogger log = null)
 {
     _log = log ?? WrapperAdapter.GetLogger(typeof(EventTypeValidator));
 }
Beispiel #25
0
 public ApiKeyValidator(ISplitLogger log = null)
 {
     _log = log ?? WrapperAdapter.GetLogger(typeof(ApiKeyValidator));
 }
Beispiel #26
0
 private static ISplitLogger GetLogger(ISplitLogger splitLogger = null)
 {
     return(splitLogger ?? WrapperAdapter.GetLogger(typeof(SelfRefreshingClient)));
 }
Beispiel #27
0
 public SplitNameValidator(ISplitLogger log = null)
 {
     _log = log ?? WrapperAdapter.GetLogger(typeof(SplitNameValidator));
 }
Beispiel #28
0
 private static ISplitLogger GetLogger(ISplitLogger splitLogger = null)
 {
     return(splitLogger ?? WrapperAdapter.GetLogger(typeof(LocalhostClient)));
 }
Beispiel #29
0
        public NotificationManagerKeeper(ISplitLogger log = null)
        {
            _log = log ?? WrapperAdapter.GetLogger(typeof(NotificationManagerKeeper));

            UpdatePublisherAvailable(publisherAvailable: true);
        }
Beispiel #30
0
 public TrafficTypeValidator(ISplitCache splitCache, ISplitLogger log = null)
 {
     _log        = log ?? WrapperAdapter.GetLogger(typeof(TrafficTypeValidator));
     _splitCache = splitCache;
 }