Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for GetLock (0.25 sec)

  1. internal/lsync/lrwmutex.go

    func (lm *LRWMutex) Lock() {
    	const isWriteLock = true
    	lm.lockLoop(context.Background(), lm.id, lm.source, math.MaxInt64, isWriteLock)
    }
    
    // GetLock tries to get a write lock on lm before the timeout occurs.
    func (lm *LRWMutex) GetLock(ctx context.Context, id string, source string, timeout time.Duration) (locked bool) {
    	const isWriteLock = true
    	return lm.lockLoop(ctx, id, source, timeout, isWriteLock)
    }
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Jan 02 17:15:06 GMT 2022
    - 4.8K bytes
    - Viewed (0)
  2. internal/dsync/dsync_test.go

    	}
    
    	dm := NewDRWMutex(ds, "aap")
    	dm.refreshInterval = testDrwMutexRefreshInterval
    
    	ctx, cancel := context.WithCancel(context.Background())
    
    	if !dm.GetLock(ctx, cancel, id, source, Options{Timeout: 5 * time.Minute}) {
    		t.Fatal("GetLock() should be successful")
    	}
    
    	// Make it run twice.
    	timer := time.NewTimer(testDrwMutexRefreshInterval * 2)
    
    	select {
    	case <-ctx.Done():
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sat Dec 24 03:49:07 GMT 2022
    - 11K bytes
    - Viewed (0)
  3. cmd/namespace-lock.go

    	opsID   string
    }
    
    // Lock - block until write lock is taken or timeout has occurred.
    func (di *distLockInstance) GetLock(ctx context.Context, timeout *dynamicTimeout) (LockContext, error) {
    	lockSource := getSource(2)
    	start := UTCNow()
    
    	newCtx, cancel := context.WithCancel(ctx)
    	if !di.rwMutex.GetLock(newCtx, cancel, di.opsID, lockSource, dsync.Options{
    		Timeout:       timeout.Timeout(),
    		RetryInterval: timeout.RetryInterval(),
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Mon Jun 05 23:56:35 GMT 2023
    - 9.2K bytes
    - Viewed (0)
  4. cmd/shared-lock.go

    	lockContext chan LockContext
    }
    
    func (ld sharedLock) backgroundRoutine(ctx context.Context, objAPI ObjectLayer, lockName string) {
    	for {
    		locker := objAPI.NewNSLock(minioMetaBucket, lockName)
    		lkctx, err := locker.GetLock(ctx, sharedLockTimeout)
    		if err != nil {
    			continue
    		}
    
    	keepLock:
    		for {
    			select {
    			case <-ctx.Done():
    				return
    			case <-lkctx.Context().Done():
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Mon Feb 13 09:26:38 GMT 2023
    - 2.3K bytes
    - Viewed (0)
  5. internal/lsync/lrwmutex_test.go

    	// fmt.Println("Getting initial write lock")
    	if !lrwm.GetLock(ctx, "", "", time.Second) {
    		panic("Failed to acquire initial write lock")
    	}
    
    	go func() {
    		time.Sleep(2 * time.Second)
    		lrwm.Unlock()
    		// fmt.Println("Initial write lock released, waiting...")
    	}()
    
    	// fmt.Println("Trying to acquire 2nd write lock, waiting...")
    	locked = lrwm.GetLock(ctx, "", "", duration)
    	if locked {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Mar 05 04:57:35 GMT 2023
    - 7.9K bytes
    - Viewed (0)
  6. internal/dsync/drwmutex_test.go

    	}()
    
    	drwm3 := NewDRWMutex(ds, "simplelock")
    	// fmt.Println("Trying to acquire write lock, waiting...")
    	ctx3, cancel3 := context.WithCancel(context.Background())
    	locked = drwm3.GetLock(ctx3, cancel3, id, source, Options{Timeout: duration})
    	if locked {
    		// fmt.Println("Write lock acquired, waiting...")
    		time.Sleep(testDrwMutexAcquireTimeout)
    
    		drwm3.Unlock(context.Background())
    	}
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sat Dec 24 03:49:07 GMT 2022
    - 9.7K bytes
    - Viewed (0)
  7. cmd/license-update.go

    				duration = time.Second
    			}
    			time.Sleep(duration)
    		}
    	}()
    }
    
    func licenceUpdaterLoop(ctx context.Context, objAPI ObjectLayer) {
    	ctx, cancel := globalLeaderLock.GetLock(ctx)
    	defer cancel()
    
    	licenseUpdateTimer := time.NewTimer(licUpdateCycle)
    	defer licenseUpdateTimer.Stop()
    
    	for {
    		select {
    		case <-ctx.Done():
    			return
    		case <-licenseUpdateTimer.C:
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  8. cmd/erasure-server-pool.go

    			return BucketNameInvalid{Bucket: bucket}
    		}
    
    		if !opts.NoLock {
    			// Lock the bucket name before creating.
    			lk := z.NewNSLock(minioMetaTmpBucket, bucket+".lck")
    			lkctx, err := lk.GetLock(ctx, globalOperationTimeout)
    			if err != nil {
    				return err
    			}
    
    			ctx = lkctx.Context()
    			defer lk.Unlock(lkctx)
    		}
    	}
    
    	if err := z.s3Peer.MakeBucket(ctx, bucket, opts); err != nil {
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 26 06:32:14 GMT 2024
    - 80.1K bytes
    - Viewed (0)
  9. cmd/callhome.go

    }
    
    func runCallhome(ctx context.Context, objAPI ObjectLayer) bool {
    	// Make sure only 1 callhome is running on the cluster.
    	locker := objAPI.NewNSLock(minioMetaBucket, "callhome/runCallhome.lock")
    	lkctx, err := locker.GetLock(ctx, callhomeLeaderLockTimeout)
    	if err != nil {
    		// lock timedout means some other node is the leader,
    		// cycle back return 'true'
    		return true
    	}
    
    	ctx = lkctx.Context()
    	defer locker.Unlock(lkctx)
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 5.1K bytes
    - Viewed (1)
  10. cmd/erasure-multipart.go

    	// streamto avoid any concurrent updates.
    	//
    	// Must be held throughout this call.
    	partIDLock := er.NewNSLock(bucket, pathJoin(object, uploadID, strconv.Itoa(partID)))
    	plkctx, err := partIDLock.GetLock(ctx, globalOperationTimeout)
    	if err != nil {
    		return PartInfo{}, err
    	}
    	pctx := plkctx.Context()
    	defer partIDLock.Unlock(plkctx)
    
    	onlineDisks := er.getDisks()
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 43K bytes
    - Viewed (0)
Back to top