Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ldclient-rb/impl/data_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def update_status(new_state, new_error)
private def send_change_events(affected_items)
affected_items.each do |item|
if item[:kind] == Impl::DataStore::FEATURES
@flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key]))
@flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key].to_s))
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/ldclient-rb/impl/data_store/in_memory_feature_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def initialized?
#
# Initializes the store with a full set of data, replacing any existing data.
#
# @param collections [Hash<LaunchDarkly::Impl::DataStore::DataKind, Hash<String, Hash>>] Hash of data kinds to collections of items
# @param collections [Hash<LaunchDarkly::Impl::DataStore::DataKind, Hash<Symbol, Hash>>] Hash of data kinds to collections of items
# @return [Boolean] true if successful, false otherwise
#
def set_basis(collections)
Expand All @@ -80,7 +80,7 @@ def set_basis(collections)
#
# Applies a delta update to the store.
#
# @param collections [Hash<LaunchDarkly::Impl::DataStore::DataKind, Hash<String, Hash>>] Hash of data kinds to collections with updates
# @param collections [Hash<LaunchDarkly::Impl::DataStore::DataKind, Hash<Symbol, Hash>>] Hash of data kinds to collections with updates
# @return [Boolean] true if successful, false otherwise
#
def apply_delta(collections)
Expand All @@ -105,7 +105,7 @@ def apply_delta(collections)
#
# Decodes a collection of items.
#
# @param collections [Hash<LaunchDarkly::Impl::DataStore::DataKind, Hash<String, Hash>>] Hash of data kinds to collections
# @param collections [Hash<LaunchDarkly::Impl::DataStore::DataKind, Hash<Symbol, Hash>>] Hash of data kinds to collections
# @return [Hash<LaunchDarkly::Impl::DataStore::DataKind, Hash<Symbol, Hash>>, nil] Decoded collection with symbol keys, or nil on error
#
private def decode_collection(collections)
Expand Down
10 changes: 5 additions & 5 deletions lib/ldclient-rb/impl/data_store/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_data_store_status_provider
#
# Set the basis of the store. Any existing data is discarded.
#
# @param collections [Hash{Object => Hash{String => Hash}}] Hash of data kinds to collections of items
# @param collections [Hash{Object => Hash{Symbol => Hash}}] Hash of data kinds to collections of items
# @param selector [LaunchDarkly::Interfaces::DataSystem::Selector, nil] The selector
# @param persist [Boolean] Whether to persist the data
# @return [void]
Expand Down Expand Up @@ -234,7 +234,7 @@ def get_data_store_status_provider
#
# Apply a delta update to the store.
#
# @param collections [Hash{Object => Hash{String => Hash}}] Hash of data kinds to collections with updates
# @param collections [Hash{Object => Hash{Symbol => Hash}}] Hash of data kinds to collections with updates
# @param selector [LaunchDarkly::Interfaces::DataSystem::Selector, nil] The selector
# @param persist [Boolean] Whether to persist the changes
# @return [void]
Expand Down Expand Up @@ -328,16 +328,16 @@ def get_data_store_status_provider
private def send_change_events(affected_items)
affected_items.each do |item|
if item[:kind] == FEATURES
@flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key]))
@flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key].to_s))
end
end
end

#
# Compute which items changed between old and new data sets.
#
# @param old_data [Hash{DataKind => Hash{String => Hash}}] Old data hash
# @param new_data [Hash{DataKind => Hash{String => Hash}}] New data hash
# @param old_data [Hash{DataKind => Hash{Symbol => Hash}}] Old data hash
# @param new_data [Hash{DataKind => Hash{Symbol => Hash}}] New data hash
# @return [Set<Hash>] Set of {kind:, key:} hashes
#
private def compute_changed_items_for_full_data_set(old_data, new_data)
Expand Down
2 changes: 1 addition & 1 deletion lib/ldclient-rb/impl/dependency_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(logger = nil)
# Updates the dependency graph when an item has changed.
#
# @param from_kind [Object] the changed item's kind
# @param from_key [String] the changed item's key
# @param from_key [Symbol] the changed item's key
# @param from_item [Object] the changed item (can be a Hash, model object, or nil)
#
def update_dependencies_from(from_kind, from_key, from_item)
Expand Down
2 changes: 1 addition & 1 deletion lib/ldclient-rb/impl/flag_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def add_flag_value_change_listener(key, context, listener)
# An adapter which turns a normal flag change listener into a flag value change listener.
#
class FlagValueChangeAdapter
# @param [Symbol] flag_key
# @param [String] flag_key
# @param [LaunchDarkly::LDContext] context
# @param [#update] listener
# @param [#call] eval_fn
Expand Down
10 changes: 5 additions & 5 deletions lib/ldclient-rb/interfaces/flag_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def remove_listener(listener) end
# The returned listener represents the subscription that was created by this method
# call; to unsubscribe, pass that object (not your listener) to {#remove_listener}.
#
# @param key [Symbol]
# @param key [String]
# @param context [LaunchDarkly::LDContext]
# @param listener [#update]
#
Expand All @@ -79,7 +79,7 @@ def add_flag_value_change_listener(key, context, listener) end
class FlagChange
attr_accessor :key

# @param [Symbol] key
# @param key [String]
def initialize(key)
@key = key
end
Expand All @@ -93,9 +93,9 @@ class FlagValueChange
attr_accessor :old_value
attr_accessor :new_value

# @param [Symbol] key
# @param [Object] old_value
# @param [Object] new_value
# @param key [String]
# @param old_value [Object]
# @param new_value [Object]
def initialize(key, old_value, new_value)
@key = key
@old_value = old_value
Expand Down
18 changes: 9 additions & 9 deletions spec/impl/data_system/fdv2_datasystem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def build(_sdk_key, _config)
expect(modified.wait(1)).to be true

expect(changes.length).to eq(3)
expect(changes[0].key).to eq(:flagkey)
expect(changes[1].key).to eq(:flagkey)
expect(changes[2].key).to eq(:flagkey)
expect(changes[0].key).to eq("flagkey")
expect(changes[1].key).to eq("flagkey")
expect(changes[2].key).to eq("flagkey")

fdv2.stop
end
Expand Down Expand Up @@ -166,8 +166,8 @@ def build(_sdk_key, _config)
expect(changed.wait(2)).to be true

expect(changes.length).to eq(2)
expect(changes[0].key).to eq(:flagkey)
expect(changes[1].key).to eq(:flagkey)
expect(changes[0].key).to eq("flagkey")
expect(changes[1].key).to eq("flagkey")

fdv2.stop
end
Expand Down Expand Up @@ -263,7 +263,7 @@ def build(_sdk_key, _config)

# Verify we got flag changes from FDv1
expect(changes.length).to be > 0
expect(changes.any? { |change| change.key == :fdv1flag }).to be true
expect(changes.any? { |change| change.key == "fdv1flag" }).to be true

fdv2.stop
end
Expand Down Expand Up @@ -318,7 +318,7 @@ def build(_sdk_key, _config)

# Verify FDv1 is active and we got both changes
expect(changes.length).to eq(2)
expect(changes.all? { |change| change.key == :fdv1fallbackflag }).to be true
expect(changes.all? { |change| change.key == "fdv1fallbackflag" }).to be true

fdv2.stop
end
Expand Down Expand Up @@ -369,8 +369,8 @@ def build(_sdk_key, _config)

# Verify we got changes for both flags
flag_keys = changes.map { |change| change.key }
expect(flag_keys).to include(:initialflag)
expect(flag_keys).to include(:fdv1replacementflag)
expect(flag_keys).to include("initialflag")
expect(flag_keys).to include("fdv1replacementflag")

fdv2.stop
end
Expand Down
6 changes: 3 additions & 3 deletions spec/impl/data_system/fdv2_persistence_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get_data_snapshot
listener = Object.new
listener.define_singleton_method(:update) do |flag_change|
changes << flag_change
flag_changed.set if flag_change.key == :newflag
flag_changed.set if flag_change.key == "newflag"
end
fdv2.flag_change_broadcaster.add_listener(listener)

Expand Down Expand Up @@ -326,7 +326,7 @@ def get_data_snapshot
flag_changed = Concurrent::Event.new
listener = Object.new
listener.define_singleton_method(:update) do |flag_change|
flag_changed.set if flag_change.key == :flagkey
flag_changed.set if flag_change.key == "flagkey"
end

fdv2.flag_change_broadcaster.add_listener(listener)
Expand Down Expand Up @@ -412,7 +412,7 @@ def get_data_snapshot

listener = Object.new
listener.define_singleton_method(:update) do |flag_change|
sync_flag_arrived.set if flag_change.key == :"sync-flag"
sync_flag_arrived.set if flag_change.key == "sync-flag"
end

fdv2.flag_change_broadcaster.add_listener(listener)
Expand Down