Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for InsertContains (0.39 sec)

  1. pilot/test/xdstest/validate.go

    	t.Helper()
    
    	vhosts := sets.New[string]()
    	domains := sets.New[string]()
    	for _, vhost := range l.VirtualHosts {
    		if vhosts.InsertContains(vhost.Name) {
    			t.Errorf("duplicate virtual host found %s", vhost.Name)
    		}
    		for _, domain := range vhost.Domains {
    			if domains.InsertContains(domain) {
    				t.Errorf("duplicate virtual host domain found %s", domain)
    			}
    		}
    	}
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Mar 28 17:09:02 UTC 2024
    - 9.2K bytes
    - Viewed (0)
  2. pkg/util/sets/set_test.go

    			}
    		})
    	}
    }
    
    func TestInsertContains(t *testing.T) {
    	s := New[string]()
    	assert.Equal(t, s.InsertContains("k1"), false)
    	assert.Equal(t, s.InsertContains("k1"), true)
    	assert.Equal(t, s.InsertContains("k2"), false)
    	assert.Equal(t, s.InsertContains("k2"), true)
    }
    
    func BenchmarkSet(b *testing.B) {
    	containsTest := New[string]()
    	for i := 0; i < 1000; i++ {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Sat Mar 30 05:26:03 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  3. pkg/util/sets/set.go

    	res := s.UnsortedList()
    	slices.Sort(res)
    	return res
    }
    
    // InsertContains inserts the item into the set and returns if it was already present.
    // Example:
    //
    //		if !set.InsertContains(item) {
    //			fmt.Println("Added item for the first time", item)
    //	  }
    func (s Set[T]) InsertContains(item T) bool {
    	if s.Contains(item) {
    		return true
    	}
    	s[item] = struct{}{}
    	return false
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Sat Mar 30 05:26:03 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  4. pilot/pkg/networking/plugin/authn/util.go

    	}
    	return dedupTrustDomains(tds)
    }
    
    func dedupTrustDomains(tds []string) []string {
    	known := sets.New[string]()
    	deduped := make([]string, 0, len(tds))
    
    	for _, td := range tds {
    		if td != "" && !known.InsertContains(td) {
    			deduped = append(deduped, td)
    		}
    	}
    	return deduped
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Feb 24 16:11:07 UTC 2023
    - 1.3K bytes
    - Viewed (0)
  5. pilot/pkg/config/aggregate/config.go

    	for _, curConfigs := range storeConfigs {
    		configs = append(configs, curConfigs...)
    	}
    	configs = slices.FilterInPlace[config.Config](configs, func(cfg config.Config) bool {
    		return !configMap.InsertContains(cfg.NamespacedName())
    	})
    
    	return configs
    }
    
    func (cr *store) Delete(typ config.GroupVersionKind, name, namespace string, resourceVersion *string) error {
    	if cr.writer == nil {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Dec 26 01:14:27 UTC 2023
    - 5.4K bytes
    - Viewed (0)
  6. pkg/config/schema/ast/ast.go

    				} else {
    					validateFn = "validation." + validateFn
    				}
    			}
    			m.Resources[i].Validate = validateFn
    		}
    		if r.Identifier == "" {
    			r.Identifier = r.Kind
    		}
    		if seen.InsertContains(r.Identifier) {
    			return fmt.Errorf("identifier %q already registered, set a unique identifier", r.Identifier)
    		}
    	}
    
    	return nil
    }
    
    // Parse and return a yaml representation of Metadata
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Sat Mar 30 00:31:03 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  7. pkg/kube/krt/join.go

    		}
    	}
    	return nil
    }
    
    func (j *join[T]) List() []T {
    	res := []T{}
    	found := sets.New[Key[T]]()
    	for _, c := range j.collections {
    		for _, i := range c.List() {
    			key := GetKey(i)
    			if !found.InsertContains(key) {
    				// Only keep it if it is the first time we saw it, as our merging mechanism is to keep the first one
    				res = append(res, i)
    			}
    		}
    	}
    	return res
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 10 23:33:56 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  8. tests/fuzz/regression_test.go

    		{"FuzzJwtUtil", FuzzJwtUtil},
    		{"FuzzFindRootCertFromCertificateChainBytes", FuzzFindRootCertFromCertificateChainBytes},
    		{"FuzzCRDRoundtrip", FuzzCRDRoundtrip},
    	}
    	for _, tt := range cases {
    		if testedFuzzers.InsertContains(tt.name) {
    			t.Fatalf("dupliate fuzzer test %v", tt.name)
    		}
    		t.Run(tt.name, func(t *testing.T) {
    			runRegressionTest(t, tt.name, tt.fuzzer)
    		})
    	}
    	t.Run("completeness", func(t *testing.T) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Feb 10 16:43:09 UTC 2023
    - 5.9K bytes
    - Viewed (0)
  9. pkg/test/framework/suitecontext.go

    // debugging
    func (c *suiteContext) allocateContextID(prefix string) string {
    	c.contextMu.Lock()
    	defer c.contextMu.Unlock()
    
    	candidate := prefix
    	discriminator := 0
    	for {
    		if !c.contextNames.InsertContains(candidate) {
    			return candidate
    		}
    
    		candidate = fmt.Sprintf("%s-%d", prefix, discriminator)
    		discriminator++
    	}
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Apr 08 22:02:59 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  10. pilot/pkg/trustbundle/trustbundle.go

    	certMap := sets.New[string]()
    
    	tb.mutex.Lock()
    	defer tb.mutex.Unlock()
    
    	for _, configSource := range tb.sourceConfig {
    		for _, cert := range configSource.Certs {
    			if !certMap.InsertContains(cert) {
    				mergeCerts = append(mergeCerts, cert)
    			}
    		}
    	}
    	tb.mergedCerts = mergeCerts
    	sort.Strings(tb.mergedCerts)
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu May 23 21:07:03 UTC 2024
    - 7.8K bytes
    - Viewed (0)
Back to top