Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 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)
Back to top