Exemple #1
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();
 }
Exemple #2
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();
        }
        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 SplitClient(ISplitLogger log)
 {
     _log                          = log;
     _keyValidator                 = new KeyValidator();
     _splitNameValidator           = new SplitNameValidator();
     _eventTypeValidator           = new EventTypeValidator();
     _eventPropertiesValidator     = new EventPropertiesValidator();
     _factoryInstantiationsService = FactoryInstantiationsService.Instance();
     _wrapperAdapter               = new WrapperAdapter();
 }
Exemple #5
0
 public ImpressionsSdkApiClient(string apiKey,
                                Dictionary <string, string> headers,
                                string baseUrl,
                                long connectionTimeOut,
                                long readTimeout,
                                ITelemetryRuntimeProducer telemetryRuntimeProducer,
                                IWrapperAdapter wrapperAdapter,
                                int maxBulkSize) : base(apiKey, headers, baseUrl, connectionTimeOut, readTimeout, telemetryRuntimeProducer)
 {
     _wrapperAdapter = wrapperAdapter;
     _maxBulkSize    = maxBulkSize;
 }
Exemple #6
0
 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);
 }
Exemple #8
0
        public SyncManagerTests()
        {
            _wrapperAdapter = new WrapperAdapter();
            _taskManager    = new TasksManager(_wrapperAdapter);

            _synchronizer = new Mock <ISynchronizer>();
            _pushManager  = new Mock <IPushManager>();
            _sseHandler   = new Mock <ISSEHandler>();
            _log          = new Mock <ISplitLogger>();
            _notificationManagerKeeper = new Mock <INotificationManagerKeeper>();
            _telemetryRuntimeProducer  = new Mock <ITelemetryRuntimeProducer>();
            _telemetrySyncTask         = new Mock <ITelemetrySyncTask>();
            _statusManager             = new Mock <IStatusManager>();
        }
Exemple #9
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;
 }
Exemple #10
0
        public EventsLog(IEventSdkApiClient apiClient,
                         int firstPushWindow,
                         int interval,
                         ISimpleCache <WrappedEvent> eventsCache,
                         int maximumNumberOfKeysToCache = -1)
        {
            _cancellationTokenSource = new CancellationTokenSource();

            _wrappedEventsCache = (eventsCache as ISimpleProducerCache <WrappedEvent>) ?? new InMemorySimpleCache <WrappedEvent>(new BlockingQueue <WrappedEvent>(maximumNumberOfKeysToCache));
            _apiClient          = apiClient;
            _interval           = interval;
            _firstPushWindow    = firstPushWindow;

            _wrapperAdapter = new WrapperAdapter();
        }
Exemple #11
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;
        }
Exemple #12
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));
 }
Exemple #13
0
        public SelfRefreshingSegmentFetcher(ISegmentChangeFetcher segmentChangeFetcher,
                                            IReadinessGatesCache gates,
                                            int interval,
                                            ISegmentCache segmentsCache,
                                            int numberOfParallelSegments) : base(segmentsCache)
        {
            _cancelTokenSource = new CancellationTokenSource();

            _segmentChangeFetcher = segmentChangeFetcher;
            _segments             = new ConcurrentDictionary <string, SelfRefreshingSegment>();
            _worker         = new SegmentTaskWorker(numberOfParallelSegments);
            _interval       = interval;
            _gates          = gates;
            _wrappedAdapter = new WrapperAdapter();

            StartWorker();
        }
Exemple #14
0
 public SelfRefreshingSegmentFetcher(ISegmentChangeFetcher segmentChangeFetcher,
                                     IStatusManager statusManager,
                                     int interval,
                                     ISegmentCache segmentsCache,
                                     int numberOfParallelSegments,
                                     ISegmentTaskQueue segmentTaskQueue,
                                     ITasksManager tasksManager,
                                     IWrapperAdapter wrapperAdapter) : base(segmentsCache)
 {
     _segmentChangeFetcher = segmentChangeFetcher;
     _segments             = new ConcurrentDictionary <string, SelfRefreshingSegment>();
     _worker           = new SegmentTaskWorker(numberOfParallelSegments, segmentTaskQueue);
     _interval         = interval;
     _statusManager    = statusManager;
     _wrappedAdapter   = wrapperAdapter;
     _segmentTaskQueue = segmentTaskQueue;
     _tasksManager     = tasksManager;
 }
Exemple #15
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();
        }
Exemple #16
0
 public EventsLogTests()
 {
     _telemetryRuntimeProducer = new Mock <ITelemetryRuntimeProducer>();
     _wrapperAdapter           = new WrapperAdapter();
     _tasksManger = new TasksManager(_wrapperAdapter);
 }
Exemple #17
0
 public ConfigService(IWrapperAdapter wrapperAdapter,
                      ISplitLogger log)
 {
     _wrapperAdapter = wrapperAdapter;
     _log            = log;
 }
Exemple #18
0
 public ImpressionsSdkApiClientTests()
 {
     _telemetryRuntimeProducer = new Mock <ITelemetryRuntimeProducer>();
     _wrapperAdapter           = new WrapperAdapter();
 }
Exemple #19
0
        public JSONFileSplitChangeFetcher(string filePath)
        {
            this.filePath = filePath;

            _wrapperAdapter = new WrapperAdapter();
        }
Exemple #20
0
 public TasksManager(IWrapperAdapter wrapperAdapter)
 {
     _wrapperAdapter = wrapperAdapter;
 }