Exception: SplitIoClient::SplitAdapter
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::SplitAdapter
- Defined in:
- lib/splitclient-rb/engine/parser/split_adapter.rb
Overview
acts as an api adapater to connect to split endpoints uses a configuration object that can be modified when creating the client instance also, uses safe threads to execute fetches and post give the time execution values from the config
Instance Attribute Summary collapse
-
#impressions_repository ⇒ Object
readonly
Returns the value of attribute impressions_repository.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#segments_repository ⇒ Object
readonly
Returns the value of attribute segments_repository.
-
#splits_repository ⇒ Object
readonly
Returns the value of attribute splits_repository.
Instance Method Summary collapse
-
#events_sender ⇒ Object
Starts thread which loops constantly and sends events to the Split API.
-
#impressions_sender ⇒ Object
Starts thread which loops constantly and sends impressions to the Split API.
-
#initialize(api_key, splits_repository, segments_repository, impressions_repository, metrics_repository, events_repository, sdk_blocker, config) ⇒ SplitIoClient
constructor
Creates a new split api adapter instance that consumes split api endpoints.
-
#localhost_repo_cleaner ⇒ Object
Starts thread which loops constantly and cleans up repositories to avoid memory issues in localhost mode.
-
#localhost_split_store ⇒ Object
Starts thread which loops constantly and retrieves splits from a file source.
-
#metrics_sender ⇒ Object
Starts thread which loops constantly and sends metrics to the Split API.
-
#segment_store ⇒ Object
Starts thread which loops constantly and stores segments in the segments_repository of choice.
-
#split_store ⇒ Object
Starts thread which loops constantly and stores splits in the splits_repository of choice.
- #start_localhost_components ⇒ Object
- #start_standalone_components ⇒ Object
Constructor Details
#initialize(api_key, splits_repository, segments_repository, impressions_repository, metrics_repository, events_repository, sdk_blocker, config) ⇒ SplitIoClient
Creates a new split api adapter instance that consumes split api endpoints
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 27 def initialize( api_key, splits_repository, segments_repository, impressions_repository, metrics_repository, events_repository, sdk_blocker, config ) @api_key = api_key @splits_repository = splits_repository @segments_repository = segments_repository @impressions_repository = impressions_repository @metrics_repository = metrics_repository @events_repository = events_repository @metrics = Metrics.new(100, @metrics_repository) @sdk_blocker = sdk_blocker @config = config start_localhost_components if @config.localhost_mode start_standalone_components if @config.standalone? && !@config.localhost_mode end |
Instance Attribute Details
#impressions_repository ⇒ Object (readonly)
Returns the value of attribute impressions_repository.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def impressions_repository @impressions_repository end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def metrics @metrics end |
#segments_repository ⇒ Object (readonly)
Returns the value of attribute segments_repository.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def segments_repository @segments_repository end |
#splits_repository ⇒ Object (readonly)
Returns the value of attribute splits_repository.
14 15 16 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 14 def splits_repository @splits_repository end |
Instance Method Details
#events_sender ⇒ Object
Starts thread which loops constantly and sends events to the Split API
96 97 98 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 96 def events_sender EventsSender.new(@events_repository, @config).call end |
#impressions_sender ⇒ Object
Starts thread which loops constantly and sends impressions to the Split API
86 87 88 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 86 def impressions_sender ImpressionsSender.new(@impressions_repository, @api_key, @config).call end |
#localhost_repo_cleaner ⇒ Object
Starts thread which loops constantly and cleans up repositories to avoid memory issues in localhost mode
71 72 73 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 71 def localhost_repo_cleaner LocalhostRepoCleaner.new(@impressions_repository, @metrics_repository, @events_repository, @config).call end |
#localhost_split_store ⇒ Object
Starts thread which loops constantly and retrieves splits from a file source
66 67 68 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 66 def localhost_split_store LocalhostSplitStore.new(@splits_repository, @config, @sdk_blocker).call end |
#metrics_sender ⇒ Object
Starts thread which loops constantly and sends metrics to the Split API
91 92 93 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 91 def metrics_sender MetricsSender.new(@metrics_repository, @api_key, @config).call end |
#segment_store ⇒ Object
Starts thread which loops constantly and stores segments in the segments_repository of choice
81 82 83 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 81 def segment_store SegmentStore.new(@segments_repository, @api_key, @metrics, @config, @sdk_blocker).call end |
#split_store ⇒ Object
Starts thread which loops constantly and stores splits in the splits_repository of choice
76 77 78 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 76 def split_store SplitStore.new(@splits_repository, @api_key, @metrics, @config, @sdk_blocker).call end |
#start_localhost_components ⇒ Object
60 61 62 63 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 60 def start_localhost_components localhost_split_store localhost_repo_cleaner end |
#start_standalone_components ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/splitclient-rb/engine/parser/split_adapter.rb', line 52 def start_standalone_components split_store segment_store metrics_sender impressions_sender events_sender end |