Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for newIntSet (0.12 sec)

  1. plugin/pkg/auth/authorizer/node/intset_test.go

    limitations under the License.
    */
    
    package node
    
    import (
    	"testing"
    
    	"github.com/stretchr/testify/assert"
    )
    
    func TestIntSet(t *testing.T) {
    	i := newIntSet()
    
    	assert.False(t, i.has(1))
    	assert.False(t, i.has(2))
    	assert.False(t, i.has(3))
    	assert.False(t, i.has(4))
    
    	i.reset()
    	i.increment(1) // to 1
    	i.increment(2) // to 1
    
    	assert.True(t, i.has(1))
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Feb 10 18:24:13 UTC 2020
    - 1.5K bytes
    - Viewed (0)
  2. plugin/pkg/auth/authorizer/node/intset.go

    limitations under the License.
    */
    
    package node
    
    // intSet maintains a map of id to refcounts
    type intSet struct {
    	// members is a map of id to refcounts
    	members map[int]int
    }
    
    func newIntSet() *intSet {
    	return &intSet{members: map[int]int{}}
    }
    
    // has returns true if the specified id has a positive refcount.
    // it is safe to call concurrently, but must not be called concurrently with any of the other methods.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Feb 10 18:24:13 UTC 2020
    - 1.6K bytes
    - Viewed (0)
  3. plugin/pkg/auth/authorizer/node/graph.go

    	if edgeCount < g.destinationEdgeThreshold {
    		delete(g.destinationEdgeIndex, n.ID())
    		return
    	}
    
    	// get or create the index
    	index := g.destinationEdgeIndex[n.ID()]
    	if index == nil {
    		index = newIntSet()
    	} else {
    		index.reset()
    	}
    
    	// populate the index
    	g.graph.VisitFrom(n, func(dest graph.Node) bool {
    		if destinationEdge, ok := g.graph.EdgeBetween(n, dest).(*destinationEdge); ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 21:22:55 UTC 2024
    - 17.5K bytes
    - Viewed (0)
Back to top