mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Two way streams for upcoming locking enhancements (#19796)
This commit is contained in:
@@ -89,12 +89,26 @@ func (s *Stream) Results(next func(b []byte) error) (err error) {
|
||||
return nil
|
||||
}
|
||||
if resp.Err != nil {
|
||||
s.cancel(resp.Err)
|
||||
return resp.Err
|
||||
}
|
||||
err = next(resp.Msg)
|
||||
if err != nil {
|
||||
s.cancel(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Done will return a channel that will be closed when the stream is done.
|
||||
// This mirrors context.Done().
|
||||
func (s *Stream) Done() <-chan struct{} {
|
||||
return s.ctx.Done()
|
||||
}
|
||||
|
||||
// Err will return the error that caused the stream to end.
|
||||
// This mirrors context.Err().
|
||||
func (s *Stream) Err() error {
|
||||
return s.ctx.Err()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user