func (s *localBlockAPIServer) PutBlock(putBlockServer pfs.BlockAPI_PutBlockServer) (retErr error) {
	result := &pfs.BlockRefs{}
	defer func(start time.Time) { s.Log(nil, result, retErr, time.Since(start)) }(time.Now())
	scanner := bufio.NewScanner(protostream.NewStreamingBytesReader(putBlockServer))
	for {
		blockRef, err := s.putOneBlock(scanner)
		if err != nil {
			return err
		}
		result.BlockRef = append(result.BlockRef, blockRef)
		if (blockRef.Range.Upper - blockRef.Range.Lower) < uint64(blockSize) {
			break
		}
	}
	return putBlockServer.SendAndClose(result)
}
func (s *objBlockAPIServer) PutBlock(putBlockServer pfs.BlockAPI_PutBlockServer) (retErr error) {
	result := &pfs.BlockRefs{}
	defer func(start time.Time) { s.Log(nil, result, retErr, time.Since(start)) }(time.Now())
	scanner := bufio.NewScanner(protostream.NewStreamingBytesReader(putBlockServer))
	var wg sync.WaitGroup
	var loopErr error
	for {
		blockRef, err := s.localServer.putOneBlock(scanner)
		if err != nil {
			return err
		}
		result.BlockRef = append(result.BlockRef, blockRef)
		if (blockRef.Range.Upper - blockRef.Range.Lower) < uint64(blockSize) {
			break
		}
		wg.Add(1)
		go func() {
			defer wg.Done()
			writer, err := s.objClient.Writer(s.localServer.blockPath(blockRef.Block))
			if err != nil && loopErr == nil {
				loopErr = err
			}
			defer func() {
				if err := writer.Close(); err != nil && loopErr == nil {
					loopErr = err
				}
			}()
			file, err := s.localServer.blockFile(blockRef.Block)
			if err != nil && loopErr == nil {
				loopErr = err
			}
			defer func() {
				if err := file.Close(); err != nil && loopErr == nil {
					loopErr = err
				}
			}()
			if _, err := io.Copy(writer, file); err != nil && loopErr == nil {
				loopErr = err
			}
		}()
	}
	wg.Wait()
	if loopErr != nil {
		return loopErr
	}
	return putBlockServer.SendAndClose(result)
}