_gsi_set_compare

in lib/aws-record/record/table_config.rb [572:603]


      def _gsi_set_compare(remote_gsis, local_gsis)
        local_gsis.all? do |lgsi|
          rgsi = remote_gsis.find do |r|
            r.index_name == lgsi[:index_name].to_s
          end

          remote_key_schema = rgsi.key_schema.map { |i| i.to_h }
          ks_match = _array_unsorted_eql(remote_key_schema, lgsi[:key_schema])

          
          rpt = rgsi.provisioned_throughput.to_h
          lpt = lgsi[:provisioned_throughput]
          if @billing_mode == "PROVISIONED"
            pt_match = lpt.all? do |k,v|
              rpt[k] == v
            end
          elsif @billing_mode == "PAY_PER_REQUEST"
            pt_match = lpt.nil? ? true : false
          else
            raise ArgumentError, "Unsupported billing mode #{@billing_mode}"
          end

          rp = rgsi.projection.to_h
          lp = lgsi[:projection]
          rp[:non_key_attributes].sort! if rp[:non_key_attributes]
          lp[:non_key_attributes].sort! if lp[:non_key_attributes]
          p_match = rp == lp

          ks_match && pt_match && p_match
        end
      end