Class: LaunchDarkly::Impl::Integrations::DynamoDB::DynamoDBBigSegmentStore
Overview
Constant Summary
collapse
- KEY_METADATA =
'big_segments_metadata'
- KEY_CONTEXT_DATA =
'big_segments_user'
- ATTR_SYNC_TIME =
'synchronizedOn'
- ATTR_INCLUDED =
'included'
- ATTR_EXCLUDED =
'excluded'
LaunchDarkly::Impl::Integrations::DynamoDB::DynamoDBStoreImplBase::PARTITION_KEY, LaunchDarkly::Impl::Integrations::DynamoDB::DynamoDBStoreImplBase::SORT_KEY
Instance Method Summary
collapse
#stop
Constructor Details
Returns a new instance of DynamoDBBigSegmentStore.
240
241
242
|
# File 'lib/ldclient-rb/impl/integrations/dynamodb_impl.rb', line 240
def initialize(table_name, opts)
super(table_name, opts)
end
|
Instance Method Details
#description ⇒ Object
244
245
246
|
# File 'lib/ldclient-rb/impl/integrations/dynamodb_impl.rb', line 244
def description
"DynamoDBBigSegmentStore"
end
|
#get_membership(context_hash) ⇒ Object
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
# File 'lib/ldclient-rb/impl/integrations/dynamodb_impl.rb', line 262
def get_membership(context_hash)
data = @client.get_item(
table_name: @table_name,
key: {
PARTITION_KEY => @prefix + KEY_CONTEXT_DATA,
SORT_KEY => context_hash,
})
return nil unless data.item
excluded_refs = data.item[ATTR_EXCLUDED] || []
included_refs = data.item[ATTR_INCLUDED] || []
if excluded_refs.empty? && included_refs.empty?
nil
else
membership = {}
excluded_refs.each { |ref| membership[ref] = false }
included_refs.each { |ref| membership[ref] = true }
membership
end
end
|