_gsi_set_compare

in lib/aws-record/record/table_config.rb [548:579]


      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(&: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?
          else
            raise ArgumentError, "Unsupported billing mode #{@billing_mode}"
          end

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

          ks_match && pt_match && p_match
        end
      end