src/client/pfs.go
func (w *PutObjectWriteCloserAsync) Write(p []byte) (int, error) {
	select {
	case err := <-w.errChan:
		if err != nil {
			return 0, grpcutil.ScrubGRPC(err)
		}
	default:
		for len(w.buf)+len(p) > cap(w.buf) {
			// Write the bytes that fit into w.buf, then
			// remove those bytes from p.
			i := cap(w.buf) - len(w.buf)
			w.buf = append(w.buf, p[:i]...)
			p = p[i:]
			w.writeChan <- w.buf
			w.buf = grpcutil.GetBuffer()[:0]
		}
		w.buf = append(w.buf, p...)
	}
	return len(p), nil
}
func (w *PutObjectWriteCloserAsync) Write(p []byte) (int, error) {
	select {
	case err := <-w.errChan:
		if err != nil {
			return 0, grpcutil.ScrubGRPC(err)
		}
	default:
		for len(w.buf)+len(p) > cap(w.buf) {
			// Write the bytes that fit into w.buf, then
			// remove those bytes from p.
			i := cap(w.buf) - len(w.buf)
			w.buf = append(w.buf, p[:i]...)
			p = p[i:]
			w.writeChan <- w.buf
			w.buf = grpcutil.GetBuffer()[:0]
		}
		w.buf = append(w.buf, p...)
	}
	return len(p), nil
}
// Write performs a write.