splitclient-rb 7.0.4.pre.rc3 → 7.1.0.pre.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -3
- data/lib/splitclient-rb/cache/fetchers/segment_fetcher.rb +4 -0
- data/lib/splitclient-rb/cache/fetchers/split_fetcher.rb +4 -1
- data/lib/splitclient-rb/cache/repositories/splits_repository.rb +1 -1
- data/lib/splitclient-rb/clients/split_client.rb +4 -7
- data/lib/splitclient-rb/constants.rb +9 -0
- data/lib/splitclient-rb/engine/api/splits.rb +0 -1
- data/lib/splitclient-rb/engine/auth_api_client.rb +78 -0
- data/lib/splitclient-rb/engine/push_manager.rb +46 -0
- data/lib/splitclient-rb/engine/sync_manager.rb +112 -0
- data/lib/splitclient-rb/engine/synchronizer.rb +80 -0
- data/lib/splitclient-rb/exceptions.rb +8 -0
- data/lib/splitclient-rb/helpers/thread_helper.rb +19 -0
- data/lib/splitclient-rb/split_config.rb +42 -4
- data/lib/splitclient-rb/split_factory.rb +25 -15
- data/lib/splitclient-rb/sse/event_source/back_off.rb +25 -0
- data/lib/splitclient-rb/sse/event_source/client.rb +73 -50
- data/lib/splitclient-rb/sse/event_source/stream_data.rb +22 -0
- data/lib/splitclient-rb/sse/notification_manager_keeper.rb +45 -0
- data/lib/splitclient-rb/sse/notification_processor.rb +50 -0
- data/lib/splitclient-rb/sse/sse_handler.rb +46 -50
- data/lib/splitclient-rb/sse/workers/control_worker.rb +10 -5
- data/lib/splitclient-rb/sse/workers/segments_worker.rb +14 -4
- data/lib/splitclient-rb/sse/workers/splits_worker.rb +16 -4
- data/lib/splitclient-rb/version.rb +1 -1
- data/lib/splitclient-rb.rb +10 -2
- data/splitclient-rb.gemspec +1 -0
- metadata +26 -4
- data/lib/splitclient-rb/engine/parser/split_adapter.rb +0 -105
- data/lib/splitclient-rb/sse/event_source/status.rb +0 -13
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.1.0.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: allocation_stats
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1.8'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: jwt
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 2.2.1
|
230
|
+
type: :runtime
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 2.2.1
|
223
237
|
- !ruby/object:Gem::Dependency
|
224
238
|
name: lru_redux
|
225
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -350,6 +364,7 @@ files:
|
|
350
364
|
- lib/splitclient-rb/cache/stores/sdk_blocker.rb
|
351
365
|
- lib/splitclient-rb/cache/stores/store_utils.rb
|
352
366
|
- lib/splitclient-rb/clients/split_client.rb
|
367
|
+
- lib/splitclient-rb/constants.rb
|
353
368
|
- lib/splitclient-rb/engine/api/client.rb
|
354
369
|
- lib/splitclient-rb/engine/api/events.rb
|
355
370
|
- lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb
|
@@ -358,6 +373,7 @@ files:
|
|
358
373
|
- lib/splitclient-rb/engine/api/metrics.rb
|
359
374
|
- lib/splitclient-rb/engine/api/segments.rb
|
360
375
|
- lib/splitclient-rb/engine/api/splits.rb
|
376
|
+
- lib/splitclient-rb/engine/auth_api_client.rb
|
361
377
|
- lib/splitclient-rb/engine/evaluator/splitter.rb
|
362
378
|
- lib/splitclient-rb/engine/matchers/all_keys_matcher.rb
|
363
379
|
- lib/splitclient-rb/engine/matchers/between_matcher.rb
|
@@ -389,8 +405,11 @@ files:
|
|
389
405
|
- lib/splitclient-rb/engine/parser/condition.rb
|
390
406
|
- lib/splitclient-rb/engine/parser/evaluator.rb
|
391
407
|
- lib/splitclient-rb/engine/parser/partition.rb
|
392
|
-
- lib/splitclient-rb/engine/
|
408
|
+
- lib/splitclient-rb/engine/push_manager.rb
|
409
|
+
- lib/splitclient-rb/engine/sync_manager.rb
|
410
|
+
- lib/splitclient-rb/engine/synchronizer.rb
|
393
411
|
- lib/splitclient-rb/exceptions.rb
|
412
|
+
- lib/splitclient-rb/helpers/thread_helper.rb
|
394
413
|
- lib/splitclient-rb/managers/split_manager.rb
|
395
414
|
- lib/splitclient-rb/redis_metrics_fixer.rb
|
396
415
|
- lib/splitclient-rb/split_config.rb
|
@@ -398,9 +417,12 @@ files:
|
|
398
417
|
- lib/splitclient-rb/split_factory_builder.rb
|
399
418
|
- lib/splitclient-rb/split_factory_registry.rb
|
400
419
|
- lib/splitclient-rb/split_logger.rb
|
420
|
+
- lib/splitclient-rb/sse/event_source/back_off.rb
|
401
421
|
- lib/splitclient-rb/sse/event_source/client.rb
|
402
422
|
- lib/splitclient-rb/sse/event_source/event_types.rb
|
403
|
-
- lib/splitclient-rb/sse/event_source/
|
423
|
+
- lib/splitclient-rb/sse/event_source/stream_data.rb
|
424
|
+
- lib/splitclient-rb/sse/notification_manager_keeper.rb
|
425
|
+
- lib/splitclient-rb/sse/notification_processor.rb
|
404
426
|
- lib/splitclient-rb/sse/sse_handler.rb
|
405
427
|
- lib/splitclient-rb/sse/workers/control_worker.rb
|
406
428
|
- lib/splitclient-rb/sse/workers/segments_worker.rb
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'thread'
|
3
|
-
|
4
|
-
include SplitIoClient::Cache::Fetchers
|
5
|
-
include SplitIoClient::Cache::Stores
|
6
|
-
include SplitIoClient::Cache::Senders
|
7
|
-
|
8
|
-
module SplitIoClient
|
9
|
-
#
|
10
|
-
# acts as an api adapater to connect to split endpoints
|
11
|
-
# uses a configuration object that can be modified when creating the client instance
|
12
|
-
# also, uses safe threads to execute fetches and post give the time execution values from the config
|
13
|
-
#
|
14
|
-
class SplitAdapter < NoMethodError
|
15
|
-
attr_reader :splits_repository, :segments_repository, :impressions_repository, :metrics, :split_fetcher, :segment_fetcher
|
16
|
-
|
17
|
-
#
|
18
|
-
# Creates a new split api adapter instance that consumes split api endpoints
|
19
|
-
#
|
20
|
-
# @param api_key [String] the API key for your split account
|
21
|
-
# @param splits_repository [SplitsRepository] SplitsRepository instance to store splits in
|
22
|
-
# @param segments_repository [SegmentsRepository] SegmentsRepository instance to store segments in
|
23
|
-
# @param impressions_repository [ImpressionsRepository] ImpressionsRepository instance to store impressions in
|
24
|
-
# @param metrics_repository [MetricsRepository] MetricsRepository instance to store metrics in
|
25
|
-
# @param sdk_blocker [SDKBlocker] SDKBlocker instance which blocks splits_repository/segments_repository
|
26
|
-
#
|
27
|
-
# @return [SplitIoClient] split.io client instance
|
28
|
-
def initialize(
|
29
|
-
api_key,
|
30
|
-
splits_repository,
|
31
|
-
segments_repository,
|
32
|
-
impressions_repository,
|
33
|
-
metrics_repository,
|
34
|
-
events_repository,
|
35
|
-
sdk_blocker,
|
36
|
-
config
|
37
|
-
)
|
38
|
-
@api_key = api_key
|
39
|
-
@splits_repository = splits_repository
|
40
|
-
@segments_repository = segments_repository
|
41
|
-
@impressions_repository = impressions_repository
|
42
|
-
@metrics_repository = metrics_repository
|
43
|
-
@events_repository = events_repository
|
44
|
-
@metrics = Metrics.new(100, @metrics_repository)
|
45
|
-
@sdk_blocker = sdk_blocker
|
46
|
-
@config = config
|
47
|
-
|
48
|
-
start_localhost_components if @config.localhost_mode
|
49
|
-
|
50
|
-
start_standalone_components if @config.standalone? && !@config.localhost_mode
|
51
|
-
end
|
52
|
-
|
53
|
-
def start_standalone_components
|
54
|
-
split_fetch
|
55
|
-
segment_fetch
|
56
|
-
metrics_sender
|
57
|
-
impressions_sender
|
58
|
-
events_sender
|
59
|
-
end
|
60
|
-
|
61
|
-
def start_localhost_components
|
62
|
-
localhost_split_store
|
63
|
-
localhost_repo_cleaner
|
64
|
-
end
|
65
|
-
|
66
|
-
# Starts thread which loops constantly and retrieves splits from a file source
|
67
|
-
def localhost_split_store
|
68
|
-
LocalhostSplitStore.new(@splits_repository, @config, @sdk_blocker).call
|
69
|
-
end
|
70
|
-
|
71
|
-
# Starts thread which loops constantly and cleans up repositories to avoid memory issues in localhost mode
|
72
|
-
def localhost_repo_cleaner
|
73
|
-
LocalhostRepoCleaner.new(@impressions_repository, @metrics_repository, @events_repository, @config).call
|
74
|
-
end
|
75
|
-
|
76
|
-
# Starts thread which loops constantly and stores splits in the splits_repository of choice
|
77
|
-
def split_fetch
|
78
|
-
@split_fetcher = SplitFetcher.new(@splits_repository, @api_key, @metrics, @config, @sdk_blocker)
|
79
|
-
@split_fetcher.fetch_splits if @config.push_notification_enabled
|
80
|
-
@split_fetcher.call unless @config.push_notification_enabled
|
81
|
-
end
|
82
|
-
|
83
|
-
# Starts thread which loops constantly and stores segments in the segments_repository of choice
|
84
|
-
def segment_fetch
|
85
|
-
@segment_fetcher = SegmentFetcher.new(@segments_repository, @api_key, @metrics, @config, @sdk_blocker)
|
86
|
-
@segment_fetcher.fetch_segments if @config.push_notification_enabled
|
87
|
-
@segment_fetcher.call unless @config.push_notification_enabled
|
88
|
-
end
|
89
|
-
|
90
|
-
# Starts thread which loops constantly and sends impressions to the Split API
|
91
|
-
def impressions_sender
|
92
|
-
ImpressionsSender.new(@impressions_repository, @api_key, @config).call
|
93
|
-
end
|
94
|
-
|
95
|
-
# Starts thread which loops constantly and sends metrics to the Split API
|
96
|
-
def metrics_sender
|
97
|
-
MetricsSender.new(@metrics_repository, @api_key, @config).call
|
98
|
-
end
|
99
|
-
|
100
|
-
# Starts thread which loops constantly and sends events to the Split API
|
101
|
-
def events_sender
|
102
|
-
EventsSender.new(@events_repository, @config).call
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|