Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for NewDRWMutex (0.19 sec)

  1. internal/dsync/drwmutex_test.go

    func testSimpleWriteLock(t *testing.T, duration time.Duration) (locked bool) {
    	drwm1 := NewDRWMutex(ds, "simplelock")
    	ctx1, cancel1 := context.WithCancel(context.Background())
    	if !drwm1.GetRLock(ctx1, cancel1, id, source, Options{Timeout: time.Second}) {
    		panic("Failed to acquire read lock")
    	}
    	// fmt.Println("1st read lock acquired, waiting...")
    
    	drwm2 := NewDRWMutex(ds, "simplelock")
    	ctx2, cancel2 := context.WithCancel(context.Background())
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sat Dec 24 03:49:07 GMT 2022
    - 9.7K bytes
    - Viewed (0)
  2. internal/dsync/dsync_test.go

    }
    
    // Test three locks for same resource, one succeeds, one fails (after timeout)
    func TestThreeSimultaneousLocksForSameResource(t *testing.T) {
    	dm1st := NewDRWMutex(ds, "aap")
    	dm2nd := NewDRWMutex(ds, "aap")
    	dm3rd := NewDRWMutex(ds, "aap")
    
    	dm1st.Lock(id, source)
    	started := time.Now()
    	var expect time.Duration
    	// Release lock after 10 seconds
    	go func() {
    		// TOTAL
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sat Dec 24 03:49:07 GMT 2022
    - 11K bytes
    - Viewed (0)
  3. internal/dsync/drwmutex.go

    }
    
    func (g *Granted) isLocked() bool {
    	return isLocked(g.lockUID)
    }
    
    func isLocked(uid string) bool {
    	return len(uid) > 0
    }
    
    // NewDRWMutex - initializes a new dsync RW mutex.
    func NewDRWMutex(clnt *Dsync, names ...string) *DRWMutex {
    	restClnts, _ := clnt.GetLockers()
    	sort.Strings(names)
    	return &DRWMutex{
    		writeLocks:           make([]string, len(restClnts)),
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Feb 22 06:26:06 GMT 2024
    - 19.7K bytes
    - Viewed (0)
  4. cmd/namespace-lock.go

    // volume, path and operation ID.
    func (n *nsLockMap) NewNSLock(lockers func() ([]dsync.NetLocker, string), volume string, paths ...string) RWLocker {
    	opsID := mustGetUUID()
    	if n.isDistErasure {
    		drwmutex := dsync.NewDRWMutex(&dsync.Dsync{
    			GetLockers: lockers,
    			Timeouts:   dsync.DefaultTimeouts,
    		}, pathsJoinPrefix(volume, paths...)...)
    		return &distLockInstance{drwmutex, opsID}
    	}
    	sort.Strings(paths)
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Jun 05 23:56:35 GMT 2023
    - 9.2K bytes
    - Viewed (0)
Back to top