class SplitIoClient::Telemetry::MemoryRuntimeConsumer

def events_stats(type)

def events_stats(type)
  @adapter.events_data_records.find { |l| l[:type] == type }[:value].value
end

def find_http_errors(type)

def find_http_errors(type)
  @adapter.http_errors.find { |l| l[:type] == type }[:value]
end

def find_http_latencies(type)

def find_http_latencies(type)
  @adapter.http_latencies.find { |l| l[:type] == type }[:value]
end

def find_last_synchronization(type)

def find_last_synchronization(type)
  @adapter.last_synchronization.find { |l| l[:type] == type }[:value].value
end

def impressions_stats(type)

def impressions_stats(type)
  @adapter.impressions_data_records.find { |l| l[:type] == type }[:value].value
end

def initialize(config)

def initialize(config)
  @config = config
  @adapter = config.telemetry_adapter
end

def last_synchronizations

def last_synchronizations
  splits = find_last_synchronization(Domain::Constants::SPLIT_SYNC)
  segments = find_last_synchronization(Domain::Constants::SEGMENT_SYNC)
  impressions = find_last_synchronization(Domain::Constants::IMPRESSIONS_SYNC)
  imp_count = find_last_synchronization(Domain::Constants::IMPRESSION_COUNT_SYNC)
  events = find_last_synchronization(Domain::Constants::EVENT_SYNC)
  telemetry = find_last_synchronization(Domain::Constants::TELEMETRY_SYNC)
  token = find_last_synchronization(Domain::Constants::TOKEN_SYNC)
  LastSynchronization.new(splits, segments, impressions, imp_count, events, telemetry, token)
end

def pop_auth_rejections

def pop_auth_rejections
  to_return = @adapter.auth_rejections
  @adapter.init_auth_rejections
  to_return.value
end

def pop_http_errors

def pop_http_errors
  splits = find_http_errors(Domain::Constants::SPLIT_SYNC)
  segments = find_http_errors(Domain::Constants::SEGMENT_SYNC)
  impressions = find_http_errors(Domain::Constants::IMPRESSIONS_SYNC)
  imp_count = find_http_errors(Domain::Constants::IMPRESSION_COUNT_SYNC)
  events = find_http_errors(Domain::Constants::EVENT_SYNC)
  telemetry = find_http_errors(Domain::Constants::TELEMETRY_SYNC)
  token = find_http_errors(Domain::Constants::TOKEN_SYNC)
  @adapter.init_http_errors
  HttpErrors.new(splits, segments, impressions, imp_count, events, telemetry, token)
end

def pop_http_latencies

def pop_http_latencies
  splits = find_http_latencies(Domain::Constants::SPLIT_SYNC)
  segments = find_http_latencies(Domain::Constants::SEGMENT_SYNC)
  impressions = find_http_latencies(Domain::Constants::IMPRESSIONS_SYNC)
  imp_count = find_http_latencies(Domain::Constants::IMPRESSION_COUNT_SYNC)
  events = find_http_latencies(Domain::Constants::EVENT_SYNC)
  telemetry = find_http_latencies(Domain::Constants::TELEMETRY_SYNC)
  token = find_http_latencies(Domain::Constants::TOKEN_SYNC)
  @adapter.init_http_latencies
  HttpLatencies.new(splits, segments, impressions, imp_count, events, telemetry, token)
end

def pop_streaming_events

def pop_streaming_events
  events = @adapter.streaming_events
  @adapter.init_streaming_events.map
  events
end

def pop_tags

def pop_tags
  to_return = @adapter.tags
  @adapter.init_tags
  to_return
end

def pop_token_refreshes

def pop_token_refreshes
  to_return = @adapter.token_refreshes
  @adapter.init_token_refreshes
  to_return.value
end

def pop_updates_from_sse

def pop_updates_from_sse
  splits = @adapter.updates_from_sse[Domain::Constants::SPLITS]
  @adapter.updates_from_sse[Domain::Constants::SPLITS] = 0
  UpdatesFromSSE.new(splits)
end

def session_length

def session_length
  @adapter.session_length.value
end