Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 26 for SafeClose (0.25 sec)

  1. internal/grid/handlers.go

    		}
    		go func() {
    			defer xioutil.SafeClose(stream.Requests)
    			for req := range reqT {
    				b, err := req.MarshalMsg(GetByteBufferCap(req.Msgsize()))
    				if err != nil {
    					gridLogOnceIf(ctx, err, err.Error())
    				}
    				h.PutRequest(req)
    				stream.Requests <- b
    			}
    		}()
    	} else if stream.Requests != nil {
    		xioutil.SafeClose(stream.Requests)
    	}
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Tue Apr 23 17:15:52 GMT 2024
    - 27.1K bytes
    - Viewed (0)
  2. cmd/storage-rest-server.go

    func (c *closeNotifier) Read(p []byte) (n int, err error) {
    	n, err = c.rc.Read(p)
    	if err != nil {
    		if c.done != nil {
    			xioutil.SafeClose(c.done)
    			c.done = nil
    		}
    	}
    	return n, err
    }
    
    func (c *closeNotifier) Close() error {
    	if c.done != nil {
    		xioutil.SafeClose(c.done)
    		c.done = nil
    	}
    	return c.rc.Close()
    }
    
    // keepHTTPReqResponseAlive can be used to avoid timeouts with long storage
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 44.8K bytes
    - Viewed (0)
  3. internal/ioutil/ioutil.go

    			// that we promised that we would write.
    			if totalSize > 0 && written != totalSize {
    				return written, io.ErrUnexpectedEOF
    			}
    			return written, nil
    		}
    	}
    }
    
    // SafeClose safely closes any channel of any type
    func SafeClose[T any](c chan<- T) {
    	if c != nil {
    		close(c)
    		return
    	}
    	// Print stack to check who is sending `c` as `nil`
    	// without crashing the server.
    	debug.PrintStack()
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 19 11:26:59 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  4. cmd/erasure-server-pool.go

    			disks, infos, _ := set.getOnlineDisksWithHealingAndInfo(true)
    			if len(disks) == 0 {
    				xioutil.SafeClose(results)
    				cancel()
    				return fmt.Errorf("Walk: no online disks found in pool %d, set %d", setIdx, poolIdx)
    			}
    			go func() {
    				defer xioutil.SafeClose(listOut)
    				send := func(e metaCacheEntry) {
    					if e.isDir() {
    						// Ignore directories.
    						return
    					}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri May 03 20:08:20 GMT 2024
    - 80.5K bytes
    - Viewed (0)
  5. cmd/xl-storage-disk-id-check.go

    	if contextCanceled(ctx) {
    		xioutil.SafeClose(updates)
    		return dataUsageCache{}, ctx.Err()
    	}
    
    	if err := p.checkDiskStale(); err != nil {
    		xioutil.SafeClose(updates)
    		return dataUsageCache{}, err
    	}
    
    	weSleep := func() bool {
    		return scannerIdleMode.Load() == 0
    	}
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 33K bytes
    - Viewed (0)
  6. cmd/erasure.go

    		}
    	}
    	for _, idx := range permutes {
    		b := buckets[idx]
    		if e := oldCache.find(b.Name); e != nil {
    			cache.replace(b.Name, dataUsageRoot, *e)
    			bucketCh <- b
    		}
    	}
    	xioutil.SafeClose(bucketCh)
    
    	bucketResults := make(chan dataUsageEntryInfo, len(disks))
    
    	// Start async collector/saver.
    	// This goroutine owns the cache.
    	var saverWg sync.WaitGroup
    	saverWg.Add(1)
    	go func() {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 26 06:32:14 GMT 2024
    - 16K bytes
    - Viewed (1)
  7. cmd/storage-rest-client.go

    	return nil
    }
    
    func (client *storageRESTClient) NSScanner(ctx context.Context, cache dataUsageCache, updates chan<- dataUsageEntry, scanMode madmin.HealScanMode, _ func() bool) (dataUsageCache, error) {
    	defer xioutil.SafeClose(updates)
    
    	st, err := storageNSScannerRPC.Call(ctx, client.gridConn, &nsScannerOptions{
    		DiskID:   *client.diskID.Load(),
    		ScanMode: int(scanMode),
    		Cache:    &cache,
    	})
    	if err != nil {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 26.1K bytes
    - Viewed (0)
  8. cmd/bucket-replication.go

    		i := i
    		go p.AddLargeWorker(p.lrgworkers[i])
    	}
    	go func() {
    		<-p.ctx.Done()
    		for i := 0; i < LargeWorkerCount; i++ {
    			xioutil.SafeClose(p.lrgworkers[i])
    		}
    	}()
    }
    
    // AddLargeWorker adds a replication worker to the static pool for large uploads.
    func (p *ReplicationPool) AddLargeWorker(input <-chan ReplicationWorkerOperation) {
    	for {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Wed May 01 01:09:56 GMT 2024
    - 112.2K bytes
    - Viewed (1)
  9. cmd/notification.go

    						return
    					}
    				case <-ctx.Done():
    					return
    				}
    			}
    		}(ctx, peerChannels[index], &wg)
    	}
    	go func(wg *sync.WaitGroup, ch chan MetricV2) {
    		wg.Wait()
    		xioutil.SafeClose(ch)
    	}(&wg, ch)
    	return ch
    }
    
    // GetBucketMetrics - gets the cluster level bucket metrics from all nodes excluding self.
    func (sys *NotificationSys) GetBucketMetrics(ctx context.Context) <-chan MetricV2 {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 12 18:13:36 GMT 2024
    - 44.5K bytes
    - Viewed (0)
  10. cmd/erasure-decode.go

    	if p.offset+p.shardSize > p.shardFileSize {
    		p.shardSize = p.shardFileSize - p.offset
    	}
    	if p.shardSize == 0 {
    		return newBuf, nil
    	}
    
    	readTriggerCh := make(chan bool, len(p.readers))
    	defer xioutil.SafeClose(readTriggerCh) // close the channel upon return
    
    	for i := 0; i < p.dataBlocks; i++ {
    		// Setup read triggers for p.dataBlocks number of reads so that it reads in parallel.
    		readTriggerCh <- true
    	}
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 19 16:44:59 GMT 2024
    - 9.4K bytes
    - Viewed (0)
Back to top