Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for NewDeadlineWriter (0.36 sec)

  1. internal/ioutil/ioutil_test.go

    func (w *sleepWriter) Write(p []byte) (n int, err error) {
    	time.Sleep(w.timeout)
    	return len(p), nil
    }
    
    func (w *sleepWriter) Close() error {
    	return nil
    }
    
    func TestDeadlineWriter(t *testing.T) {
    	w := NewDeadlineWriter(&sleepWriter{timeout: 500 * time.Millisecond}, 450*time.Millisecond)
    	_, err := w.Write([]byte("1"))
    	if err != context.DeadlineExceeded {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Feb 02 11:02:31 GMT 2024
    - 5.1K bytes
    - Viewed (0)
  2. internal/ioutil/ioutil.go

    		return r.err
    	case <-t.C:
    		return context.DeadlineExceeded
    	}
    }
    
    // NewDeadlineWriter wraps a writer to make it respect given deadline
    // value per Write(). If there is a blocking write, the returned Writer
    // will return whenever the timer hits (the return values are n=0
    // and err=context.DeadlineExceeded.)
    func NewDeadlineWriter(w io.WriteCloser, timeout time.Duration) io.WriteCloser {
    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)
  3. cmd/bitrot-streaming.go

    	r, w := io.Pipe()
    	h := algo.New()
    
    	bw := &streamingBitrotWriter{
    		iow:          ioutil.NewDeadlineWriter(w, globalDriveConfig.GetMaxTimeout()),
    		closeWithErr: w.CloseWithError,
    		h:            h,
    		shardSize:    shardSize,
    		canClose:     &sync.WaitGroup{},
    	}
    	bw.canClose.Add(1)
    	go func() {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Wed Jan 31 02:11:45 GMT 2024
    - 5.8K bytes
    - Viewed (0)
Back to top